Files
ruflo/v2/examples/README-batch-init.md
T
rUvandClaude Opus 4.5 1b6a1971f7 feat(v3): add comprehensive v3 implementation plans and swarm architecture
- Reorganize v3/ into implementation/ subfolders:
  - planning/, architecture/, migration/, integration/
  - security/, adrs/, research/, swarm-plans/

- Add 15-agent concurrent swarm implementation plans:
  - SWARM-OVERVIEW.md: Hierarchical mesh topology, 4 phases
  - AGENT-SPECIFICATIONS.md: 15 agent configs with capabilities
  - TDD-LONDON-SCHOOL-PLAN.md: Mock-first TDD methodology
  - BENCHMARK-OPTIMIZATION.md: Performance targets (2.49x-7.47x)
  - DEPLOYMENT-PLAN.md: Release strategy, CI/CD, rollback
  - GITHUB-ISSUE-TRACKING.md: Issue workflow with agent replies

- Update .claude/settings.json with proper hooks format
- Add bash aliases for claude --dangerously-skip-permissions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 15:40:51 +00:00

10 KiB

Batch Initialization Examples

This directory contains comprehensive examples demonstrating the powerful batch initialization features of Claude-Flow.

Quick Start

  1. Simple Batch Setup

    claude-flow init --batch-init project1,project2,project3 --sparc
    
  2. Template-Based Setup

    claude-flow init --batch-init api-v1,api-v2 --template web-api --environments dev,staging
    
  3. Configuration File Setup

    claude-flow init --config examples/batch-config-enterprise.json
    

Example Files

Configuration Files

batch-config-simple.json

Basic configuration for 3 projects with web-api template across dev and staging environments.

Usage:

claude-flow init --config examples/batch-config-simple.json

Creates:

  • api-service-dev/ and api-service-staging/
  • web-frontend-dev/ and web-frontend-staging/
  • admin-dashboard-dev/ and admin-dashboard-staging/

batch-config-advanced.json

Advanced configuration with project-specific templates and customizations.

Usage:

claude-flow init --config examples/batch-config-advanced.json

Creates:

  • user-api/ (Web API with PostgreSQL)
  • notification-service/ (Microservice with RabbitMQ)
  • admin-portal/ (React app with Material-UI)
  • cli-tools/ (CLI tool for Node/Deno)
  • payment-gateway/ (High-security microservice)

batch-config-enterprise.json

Enterprise-scale configuration with 12 projects across all environments.

Usage:

claude-flow init --config examples/batch-config-enterprise.json --max-concurrent 8

Creates:

  • Core API (prod, staging, dev versions)
  • Web applications (prod, staging, dev versions)
  • Microservices (user, notification, payment)
  • Tools (admin CLI, monitoring dashboard, load testing)

Demo and Test Files

batch-init-demo.js

Interactive demonstration of all batch initialization features.

Usage:

deno run --allow-all examples/batch-init-demo.js

Shows:

  • All available templates and environments
  • Command examples and use cases
  • Performance features and benefits
  • Integration with SPARC methodology

../tests/batch-init.test.js

Comprehensive test suite for batch initialization functionality.

Usage:

deno run --allow-all tests/batch-init.test.js

Tests:

  • Options validation
  • Template functionality
  • Environment configurations
  • Error handling
  • Performance monitoring

Use Cases by Scale

Small Teams (1-5 projects)

# Quick setup for small team
claude-flow init --batch-init api,web,mobile --template web-api --sparc

Best for:

  • Startups
  • Small development teams
  • Proof of concepts
  • Personal projects

Medium Teams (5-15 projects)

# Use configuration file for better organization
claude-flow init --config batch-config-advanced.json --parallel

Best for:

  • Growing companies
  • Multi-service architectures
  • Cross-functional teams
  • Product development

Enterprise (15+ projects)

# Enterprise-scale with high concurrency
claude-flow init --config batch-config-enterprise.json --max-concurrent 8 --parallel

Best for:

  • Large organizations
  • Microservice architectures
  • Multi-team coordination
  • Complex deployments

Performance Examples

Sequential vs Parallel Comparison

# Sequential (slower but lower resource usage)
claude-flow init --batch-init project1,project2,project3,project4,project5 --no-parallel

# Parallel (faster with optimal concurrency)
claude-flow init --batch-init project1,project2,project3,project4,project5 --parallel --max-concurrent 3

Resource Monitoring

# With performance monitoring
claude-flow init --config batch-config-advanced.json --verbose

# Estimate before running
claude-flow batch estimate batch-config-enterprise.json

Template Examples

Web API Projects

# Multiple API services
claude-flow init --batch-init user-api,product-api,order-api --template web-api

# With different environments
claude-flow init --batch-init inventory-api --template web-api --environments dev,staging,prod

React Applications

# Frontend applications
claude-flow init --batch-init customer-portal,admin-panel --template react-app

# With SPARC for TDD
claude-flow init --batch-init dashboard --template react-app --sparc

Microservices

# Containerized services
claude-flow init --batch-init auth-service,payment-service,notification-service --template microservice

# Production-ready with monitoring
claude-flow init --batch-init core-services --template microservice --environments prod --sparc

CLI Tools

# Command-line utilities
claude-flow init --batch-init deployment-tool,migration-tool --template cli-tool

# Cross-platform tools
claude-flow init --batch-init admin-cli --template cli-tool --environments dev

Environment Examples

Development Setup

# Development environment with debugging
claude-flow init --batch-init myapp --environments dev --template web-api

Creates:

  • Debug mode enabled
  • Hot reload configuration
  • Verbose logging
  • Development database settings

Staging Environment

# Staging environment for testing
claude-flow init --batch-init myapp --environments staging --template microservice

Creates:

  • Testing tools enabled
  • Monitoring setup
  • Preview mode features
  • Integration test configuration

Production Environment

# Production environment with security
claude-flow init --batch-init myapp --environments prod --template microservice

Creates:

  • Security hardening
  • Performance optimization
  • Minimal logging
  • Production database settings

Multi-Environment Pipeline

# Complete CI/CD pipeline
claude-flow init --batch-init payment-service --environments dev,staging,prod --template microservice

Creates:

  • payment-service-dev/ - Development version
  • payment-service-staging/ - Testing version
  • payment-service-prod/ - Production version

Integration Examples

With SPARC Development

# SPARC-enabled batch initialization
claude-flow init --batch-init project1,project2 --sparc --template web-api

Creates:

  • .claude/commands/ - Claude Code slash commands
  • SPARC methodology integration
  • TDD workflow support
  • Architecture documentation

With Custom Configuration

# Custom batch configuration
cat > my-batch.json << 'EOF'
{
  "projects": ["my-api", "my-web"],
  "baseOptions": {
    "sparc": true,
    "template": "web-api",
    "environments": ["dev"],
    "parallel": true,
    "maxConcurrency": 2
  }
}
EOF

claude-flow init --config my-batch.json

Batch Manager Examples

Configuration Management

# Create interactive configuration
claude-flow batch create-config --interactive

# Validate configuration
claude-flow batch validate-config my-batch.json

# Estimate resources
claude-flow batch estimate my-batch.json

Template and Environment Discovery

# List available templates
claude-flow batch list-templates

# List available environments
claude-flow batch list-environments

# Get help
claude-flow batch help

Troubleshooting Examples

Common Issues

Memory Usage Too High

# Reduce concurrency
claude-flow init --batch-init projects --max-concurrent 2

# Use minimal template
claude-flow init --batch-init projects --minimal

Slow Performance

# Enable parallel processing
claude-flow init --batch-init projects --parallel

# Use faster template
claude-flow init --batch-init projects --template cli-tool

Configuration Errors

# Validate first
claude-flow batch validate-config my-batch.json

# Use force if needed
claude-flow init --config my-batch.json --force

Debug Mode

# Verbose output for debugging
claude-flow init --batch-init projects --verbose

# Sequential mode for easier debugging
claude-flow init --batch-init projects --no-parallel

Best Practices

1. Start Small

# Test with a few projects first
claude-flow init --batch-init test1,test2 --template web-api

2. Use Configuration Files

# Better for complex setups
claude-flow batch create-config enterprise-setup.json
# Edit the file, then:
claude-flow init --config enterprise-setup.json

3. Validate Before Running

# Always validate configurations
claude-flow batch validate-config my-batch.json

# Estimate resources
claude-flow batch estimate my-batch.json

4. Monitor Performance

# Use performance monitoring
claude-flow init --config my-batch.json --verbose

# Adjust concurrency based on system
claude-flow init --config my-batch.json --max-concurrent 4

5. Environment Consistency

# Use same template across environments
claude-flow init --batch-init myapp --environments dev,staging,prod --template microservice

Advanced Examples

Custom Resource Limits

# Configure resource limits in batch config
{
  "baseOptions": {
    "maxConcurrency": 3,
    "performanceMonitoring": true,
    "resourceLimits": {
      "maxMemoryMB": 2048,
      "maxCPUPercent": 80
    }
  }
}

Conditional Project Creation

# Use project-specific configurations
{
  "projectConfigs": {
    "high-performance-api": {
      "template": "microservice",
      "environment": "prod",
      "customConfig": {
        "optimization": "aggressive",
        "caching": "redis",
        "monitoring": "detailed"
      }
    }
  }
}

Integration with CI/CD

# CI/CD pipeline integration
name: Batch Project Setup
on: workflow_dispatch
jobs:
  setup:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup projects
        run: |
          npx claude-flow@latest init --config .github/batch-config.json

Next Steps

  1. Try the Examples: Run the provided configuration files
  2. Create Custom Configs: Use claude-flow batch create-config --interactive
  3. Scale Gradually: Start small and increase complexity
  4. Monitor Performance: Use built-in monitoring features
  5. Integrate with SPARC: Enable SPARC for advanced development workflows

For more information, see the Batch Initialization Documentation.