# Claude Flow Boilerplates

Comprehensive boilerplate templates for 54+ project types with Claude Flow agent orchestration using the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology.

## 🔥 What This Package Does

This package provides **54 production-ready boilerplate templates** that integrate with **Claude Flow's AI agent system** to automatically generate, architect, and develop complete software projects using the proven **SPARC methodology**.

**Two Modes Available:**
- 🚀 **BuildApp Mode** (`--buildapp`): Complete application generation with AI agents
- 📋 **Template Mode** (`--template-only`): Traditional template files with manual workflow

Instead of starting from scratch, you get:
- ✅ **Complete applications** (BuildApp mode) or **project templates** (Template mode)
- ✅ **Specialized AI agents** for your specific domain (healthcare, fintech, etc.)
- ✅ **SPARC methodology** for systematic development
- ✅ **Parallel agent execution** for 2.8x faster development
- ✅ **Production-ready architecture** patterns and best practices

## 🚨 REQUIREMENTS

### Required: Claude Flow (for BuildApp Mode)

**Claude Flow is REQUIRED** for `--buildapp` mode to work properly. It provides the AI agent orchestration system.

```bash
# Install Claude Flow first
npm install -g claude-flow@alpha

# Initialize Claude Flow (sets up MCP server automatically)
npx claude-flow@alpha init --force
```

**Note**: Template mode (`--template-only`) works without Claude Flow, but you'll miss out on the intelligent application generation capabilities.

### Required: Claude Code CLI

You need **Claude Code CLI** (Anthropic's official CLI tool) to run the AI agents and SPARC methodology.

1. **Claude Code CLI**: The official command-line interface from Anthropic
2. **MCP Integration**: Claude Flow connects through MCP to orchestrate AI agents
3. **Agent Execution**: All agents run through `claude-code task` commands

### System Requirements

- **Node.js** 18+
- **Claude Code CLI** installed and configured
- **Claude Flow** installed globally
- **Internet connection** for AI agent communication

## 🚀 Quick Start

### Step 1: Install Prerequisites
```bash
# Install Claude Flow (required for BuildApp mode)
npm install -g claude-flow@alpha

# Initialize Claude Flow (this sets up MCP server automatically)
npx claude-flow@alpha init --force
```

### Step 2: Install This Package
```bash
# Install the boilerplate generator
npm install -g claude-flow-boilerplates
```

### Step 3: Generate Your First Project
```bash
# List available templates
cfb list

# BuildApp Mode (Recommended) - Complete application generation
cfb generate --type healthcare --name "HealthApp" --prd examples/sample-prd.md --buildapp

# Template Mode - Basic templates only
cfb generate --type saas --name "TaskFlow" --template-only
```

### Step 4: Your Application is Ready! (BuildApp Mode)
```bash
cd HealthApp

# Your complete application is generated with:
# ✅ Production-ready code
# ✅ Comprehensive tests
# ✅ SPARC documentation
# ✅ Jira user stories
# ✅ Deployment scripts

# Optional: Run additional customizations
./run-sparc.sh
```

### Step 5: Manual SPARC Methodology (Template Mode Only)
```bash
# Only needed if you used --template-only
cd TaskFlow

# Initialize agents
npx claude-flow@alpha init --force

# Follow manual SPARC commands in run-sparc.md
cat run-sparc.md
```

## 📋 Available Templates

This package includes **54 comprehensive boilerplate templates** across major software domains:

### 🏢 Business Applications
- **saas** - Multi-tenant SaaS platforms with subscription billing
- **ecommerce** - Online stores with payment processing
- **marketplace** - Multi-vendor trading platforms
- **enterprise** - Large-scale business applications
- **subscription** - Recurring billing and membership sites

### 🏥 Industry-Specific Solutions
- **healthcare** - HIPAA-compliant medical applications
- **fintech** - Financial services with compliance
- **legal** - Legal practice management systems
- **government** - Public sector applications
- **hotel** - Hospitality and booking management

### 💻 Technology-Focused
- **mobile** - React Native cross-platform apps
- **blockchain** - DeFi, NFT, and Web3 applications
- **iot** - Internet of Things and edge computing
- **ml** - Machine learning and AI platforms
- **api** - API gateways and microservices

### 🛠 Development & Infrastructure
- **cicd** - CI/CD pipeline automation
- **devtools** - Developer productivity tools
- **container** - Kubernetes orchestration
- **monitoring** - Observability platforms

**[See complete list with `cfb list`]**

## 🤖 Framework Engine Integration

### Intelligent Project Generation

The package now includes an **intelligent framework engine** that transforms simple templates into complete applications:

**New Framework Features:**
- **Automated SPARC Execution**: Complete methodology automation
- **Intelligent Agent Orchestration**: Parallel AI agent coordination
- **Automatic Jira Story Generation**: Professional project management artifacts
- **Quality Gates**: Built-in validation and error checking
- **Complete Application Generation**: Production-ready code output

### BuildApp vs Template Mode

**Template Mode** (Traditional):
```bash
cfb generate --type healthcare --name "HealthApp" --template-only
# Generates: Template files + manual SPARC commands
```

**BuildApp Mode** (New - Requires PRD):
```bash
cfb generate --type healthcare --name "HealthApp" --prd sample-prd.md --buildapp
# Generates: Complete application + Jira stories + SPARC outputs + Tests
# Note: --buildapp REQUIRES --prd flag
```

### What is Claude Flow?

**Claude Flow** is an advanced AI agent orchestration platform that:
- Coordinates multiple specialized AI agents
- Implements the SPARC development methodology
- Provides 84.8% SWE-Bench solve rate
- Offers 2.8-4.4x speed improvement over manual development
- Manages 71+ specialized agents across 17 categories

### How Templates Use Claude Flow

Each template includes:

1. **Specialized Agents Configuration**
   ```json
   // Example: Healthcare template agents
   "healthcare": [
     "hipaa-compliance-specialist",
     "patient-data-manager",
     "medical-workflow-designer",
     "healthcare-integration-engineer"
   ]
   ```

2. **SPARC Methodology Scripts**
   ```bash
   # Auto-generated for each project
   # Phase 1: Specification
   claude-code task "Analyze healthcare requirements" specification

   # Phase 2: Architecture
   claude-code task "Design HIPAA-compliant architecture" system-architect

   # Phase 3: Parallel Implementation
   claude-code task "Implement patient data security" patient-data-manager
   claude-code task "Create medical workflows" medical-workflow-designer
   ```

3. **Intelligent Agent Coordination**
   - Agents share context through memory
   - Parallel execution with dependency management
   - Automatic quality gates and validation
   - Cross-agent result correlation

### SPARC Methodology Phases

1. **🔍 Specification** - AI analyzes requirements from your template
2. **📝 Pseudocode** - Agents design algorithms and data flows
3. **🏗 Architecture** - System design with best practices
4. **⚡ Refinement** - TDD implementation with specialized agents
5. **🎯 Completion** - Integration, testing, and deployment

## 🛠 CLI Commands Reference

### Template Management
```bash
cfb list                            # Show all 54 templates
cfb show <template>                 # View template details
cfb examples                        # Show Jira/PRD examples + framework demo commands
```

### BuildApp Engine (New)
```bash
cfb generate -t <type> -n <name> --prd <file> --buildapp  # BuildApp requires PRD
cfb framework -t <type> -n <name> --prd <file>            # Run framework on existing project
```

### Traditional Template Generation
```bash
cfb generate --template-only        # Template files only (no buildapp)
cfb generate -t <type> -n <name> --template-only  # Skip buildapp execution
```

### Claude Flow Setup
```bash
cfb init                           # Show Claude Flow setup commands
npx claude-flow@alpha init --force # Initialize in project
npx claude-flow@alpha agents list  # List available agents
```

## 📁 Generated Project Structure

Each project includes everything needed for SPARC development:

```
my-project/
├── 📄 project-template.md          # Complete boilerplate specification
├── 📁 examples/                    # Jira user stories & PRD templates
│   ├── jira-user-story-template.md
│   └── prd-template.md
├── ⚙️ config/                      # Claude Flow agent configurations
│   └── agents.json
├── 🚀 run-sparc.md                # Step-by-step SPARC commands
├── 💻 src/                        # Source code directory
├── 📚 docs/                       # Documentation
├── 🧪 tests/                      # Test files
├── 📋 README.md                   # Project-specific readme
└── 📦 [Additional framework files based on template]
```

## 🔧 Advanced Usage

### Template-Specific Agent Workflows

Different templates include specialized agents:

```bash
# Healthcare: HIPAA compliance focus
claude-code task "Implement HIPAA data handling" hipaa-compliance-specialist
claude-code task "Design patient workflows" medical-workflow-designer

# Fintech: Financial compliance
claude-code task "Implement payment security" payment-security-specialist
claude-code task "Design compliance reporting" financial-compliance-auditor

# Blockchain: Web3 integration
claude-code task "Develop smart contracts" smart-contract-developer
claude-code task "Design token economics" tokenomics-analyst
```

### Parallel Agent Execution

Claude Flow enables concurrent agent execution:

```bash
# Single command runs multiple agents in parallel
claude-code task "Full-stack development with parallel agents:
- Backend API implementation
- Frontend React development
- Database schema design
- Test suite creation
- Documentation writing" fullstack-developer
```

### Quality Gates and Validation

```bash
# Built-in quality checks
claude-code task "Review code quality and security" reviewer
claude-code task "Validate production readiness" production-validator
claude-code task "Analyze performance bottlenecks" perf-analyzer
```

## 💡 Example: Intelligent Healthcare Application Generation

### BuildApp Engine Mode (Recommended)
```bash
# 1. Generate complete healthcare application with BuildApp engine (PRD required)
cfb generate --type healthcare --name "HealthTracker" --prd examples/sample-prd.md --buildapp

# Result: Complete application generated automatically including:
# ✅ HIPAA-compliant backend API
# ✅ React patient portal
# ✅ Database schema with encryption
# ✅ Comprehensive test suite (90% coverage)
# ✅ Professional Jira user stories
# ✅ Complete SPARC documentation
# ✅ Production-ready deployment scripts

# 2. Your application is ready!
cd HealthTracker
./run-sparc.sh  # Optional: Run additional framework customizations
```

### Traditional Template Mode
```bash
# 1. Generate healthcare boilerplate template
cfb generate --type healthcare --name "HealthApp" --template-only

# 2. Manual SPARC execution (old way)
cd HealthApp
npx claude-flow@alpha init --force
# ... follow 20+ manual commands in run-sparc.md

# Result: Template files + manual workflow
```

### Framework Execution Command
```bash
# Run framework on existing project
cfb framework --type healthcare --name "HealthTracker" --prd requirements.md --verbose
```

## 🎯 Template Feature Breakdown

Each template includes:

### 📋 Complete Specifications
- **Overview** - Project description and market fit
- **Tech Stack** - Curated technology recommendations
- **Key Features** - Core functionality requirements
- **Architecture Patterns** - Proven design patterns
- **Implementation Requirements** - Technical specifications

### 🤖 Specialized Agent Recommendations
- **Domain Experts** - Industry-specific agents (healthcare, fintech, etc.)
- **Technical Specialists** - Architecture, security, performance agents
- **Quality Assurance** - Testing, review, and validation agents

### 📚 Best Practices Integration
- **Compliance Requirements** - Industry standards (HIPAA, SOX, GDPR)
- **Security Patterns** - Authentication, authorization, data protection
- **Performance Optimization** - Caching, scaling, monitoring
- **Testing Strategies** - Unit, integration, e2e testing approaches

## 🔄 Troubleshooting

### Claude Flow Not Found
```bash
# Install Claude Flow
npm install -g claude-flow@alpha

# Verify installation
claude-flow --version

# CRITICAL: Add MCP server (this step is often forgotten!)
claude mcp add claude-flow npx claude-flow@alpha mcp start
```

### MCP Server Not Configured
If you get "claude-code command not found" or agents don't work:
```bash
# Re-run Claude Flow initialization
npx claude-flow@alpha init --force

# Check if MCP server is added
claude mcp list

# If claude-flow is missing, add it manually:
claude mcp add claude-flow npx claude-flow@alpha mcp start
```

### Agents Not Responding
```bash
# Check agent status
npx claude-flow@alpha agents list

# Restart Claude Flow
npx claude-flow@alpha init --force

# Verify MCP connection in Claude Code CLI
```

### Template Generation Issues
```bash
# Check package installation
cfb --version

# List available templates
cfb list

# Try with explicit paths
cfb generate --type saas --output ./test-project
```

## 📖 Learning Resources

### Documentation
- [Claude Flow Documentation](https://github.com/ruvnet/claude-flow)
- [SPARC Methodology Guide](https://docs.anthropic.com/claude/docs/sparc-methodology)
- [Claude Code CLI MCP Setup](https://docs.anthropic.com/claude/docs/mcp)

### Example Projects
The package includes production-ready examples:
- **Jira User Story Template** - Agile development workflows
- **PRD Template** - Product requirements documentation
- **Agent Configuration Examples** - Custom agent setups

## 🤝 Contributing

We welcome contributions! Areas for contribution:

- **New Templates** - Additional project types and domains
- **Agent Configurations** - Specialized agent workflows
- **SPARC Improvements** - Enhanced methodology implementations
- **Documentation** - Tutorials, guides, and examples

## 📄 License

MIT License - see LICENSE file for details.

## 🔗 Links

- **NPM Package**: https://www.npmjs.com/package/claude-flow-boilerplates
- **GitHub Repository**: https://github.com/yourusername/claude-flow-boilerplates
- **Claude Flow**: https://github.com/ruvnet/claude-flow
- **Claude Code CLI**: https://claude.ai/code

## 🏷 Keywords

`claude-flow` `claude` `sparc` `boilerplate` `templates` `ai` `agents` `code-generation` `project-templates` `development` `automation` `saas` `ecommerce` `healthcare` `fintech` `enterprise`

---

## ⚡ Generate professional projects in minutes with AI-powered development workflows!

**Get started**: `npm install -g claude-flow-boilerplates && cfb generate`