# Parallel Development Workflows

## Overview

This command provides access to structured parallel development workflows with comprehensive planning and tracking capabilities.

## Available Workflows

### 1. Parallel Feature Development

Execute multiple features in parallel with conflict detection and wave management.

```bash
/parallel-dev:workflow feature-development
```

**Use when:**

- Developing multiple independent features
- Team has capacity for parallel work
- Features have been analyzed for conflicts
- Integration strategy is defined

### 2. Parallel Story Execution

Execute sprint stories in parallel with intelligent grouping.

```bash
/parallel-dev:workflow story-execution
```

**Use when:**

- Sprint has multiple ready stories
- Stories have clear acceptance criteria
- Team needs to maximize velocity
- Quick feedback cycles required

### 3. Parallel Bug Fixing

Fix multiple bugs efficiently with isolation and testing.

```bash
/parallel-dev:workflow bug-fixing
```

**Use when:**

- Multiple bugs need urgent attention
- Bugs affect different components
- Regression risk needs management
- Quick turnaround required

## Workflow Commands

### Start a Workflow

```bash
/parallel-dev:workflow <workflow-name>
```

### Create Workflow Plan

```bash
/parallel-dev:plan <workflow-type>
```

Creates a detailed workflow plan with:

- Conflict analysis
- Wave assignments
- Timeline estimates
- Success metrics

### Check Workflow Status

```bash
/parallel-dev:workflow-status
```

Shows:

- Active workflow plan
- Current phase and progress
- Wave completion status
- Pending decisions

## Workflow Integration

### With Existing Commands

Workflows integrate with core parallel-dev commands:

```bash
# Execute work according to workflow plan
/parallel-dev "Feature A" feat-a "Feature B" feat-b

# Check progress against workflow
/parallel-dev:status

# Clean up following workflow
/parallel-dev:cleanup
```

### With BMAD Agents

Workflows coordinate with BMAD agents:

- **Architect**: Conflict analysis and technical planning
- **Dev**: Implementation and integration
- **QA**: Parallel testing strategies
- **SM**: Progress tracking and coordination

## Workflow Plan Example

When you run `/parallel-dev:plan feature-development`, you'll get:

```markdown
# Parallel Development Workflow Plan: Feature Development

## Wave Assignments

Wave 1 (No conflicts):

- Feature A: Authentication refactor
- Feature C: Dashboard widgets

Wave 2 (After Wave 1):

- Feature B: User profile (depends on auth)
- Feature D: API versioning

## Timeline

- Wave 1: 3 days (parallel)
- Integration: 1 day
- Wave 2: 3 days (parallel)
- Final Integration: 1 day
- Total: 8 days (vs 16 sequential)

## Success Metrics

- Parallel Efficiency Target: >75%
- Integration Success Rate: >95%
```

## Best Practices

### Before Starting a Workflow

1. **Analyze Conflicts**: Use workflow planning to identify conflicts
2. **Assign Waves**: Group conflict-free work together
3. **Set Up Tracking**: Configure progress monitoring
4. **Brief Team**: Ensure everyone understands the plan

### During Workflow Execution

1. **Monitor Progress**: Check dashboard regularly
2. **Communicate**: Use defined sync points
3. **Handle Conflicts**: Address immediately when detected
4. **Track Metrics**: Measure efficiency continuously

### After Workflow Completion

1. **Clean Up**: Remove worktrees and branches
2. **Analyze Metrics**: Calculate actual efficiency
3. **Capture Learnings**: Document improvements
4. **Update Process**: Refine for next iteration

## Workflow Customization

### Custom Wave Strategies

```yaml
# In your project's .bmad/parallel-config.yml
wave_strategies:
  conservative:
    max_parallel: 3
    conflict_threshold: low
    integration: continuous

  aggressive:
    max_parallel: 10
    conflict_threshold: high
    integration: batch
```

### Project-Specific Workflows

Create custom workflows in `.bmad/workflows/`:

```yaml
name: custom-parallel-workflow
type: parallel-development
phases:
  - analysis:
      tasks: [conflict-detection, wave-assignment]
  - execution:
      parallel: true
      waves: dynamic
  - integration:
      strategy: continuous
```

## Troubleshooting

### Common Issues

**Workflow not found:**

```bash
# List available workflows
/parallel-dev:list-workflows
```

**Workflow plan conflicts:**

```bash
# Re-analyze with updated code
/parallel-dev:reanalyze
```

**Wave progression blocked:**

```bash
# Check blockers
/parallel-dev:status --verbose

# Force progression (use carefully)
/parallel-dev:next-wave --force
```

## Integration with CI/CD

Workflows can trigger CI/CD actions:

```yaml
# .github/workflows/parallel-dev.yml
on:
  workflow_dispatch:
    inputs:
      wave:
        description: "Wave number"
        required: true

jobs:
  wave-validation:
    runs-on: ubuntu-latest
    steps:
      - name: Validate Wave ${{ github.event.inputs.wave }}
        run: |
          # Run tests for current wave
          # Update workflow progress
```

## Summary

Parallel development workflows provide:

- Structured approach to parallel execution
- Conflict management strategies
- Progress tracking and metrics
- Integration coordination
- Team communication frameworks

Use workflows to maximize development efficiency while maintaining code quality and team coordination.
