Parallel Feature Build

Orchestrated parallel implementation of complex features using multiple agents, with dependency-aware batching and synchronized p…

qdhenry 1.3k updated 4mo ago
Claude CodeGeneric
View source ↗
# Parallel Feature Build Command

Orchestrated parallel implementation of complex features using multiple agents, with dependency-aware batching and synchronized progress tracking.

## Instructions

Build features in parallel using agent orchestration for: **$ARGUMENTS**

This command extends the incremental approach with parallel execution capabilities, launching multiple agents to work on independent features simultaneously while maintaining strict tracking and clean merge protocols.

> **Note:** `$ARGUMENTS` is automatically replaced with the text following the command invocation.
> Example: `/dev:parallel-feature-build e-commerce checkout` sets `$ARGUMENTS` to "e-commerce checkout"

---

## Phase 1: Feature Requirements & Dependency Analysis

### 1.1 Create Feature Tracking Directory

```bash
# Create tracking directories with error handling
mkdir -p .feature-tracking/{agents,batches,merges} || { echo "ERROR: Cannot create directories. Check permissions."; exit 1; }

If directory creation fails, verify:

  • You have write permissions in the current directory
  • Sufficient disk space is available

1.2 Generate Comprehensive Feature List

Same as incremental approach - expand user request into granular features.

Create file: .feature-tracking/features.json

{
  "project": "$ARGUMENTS",
  "created": "YYYY-MM-DD",
  "version": "1.0.0",
  "mode": "parallel",
  "summary": {
    "total": 0,
    "passing": 0,
    "failing": 0,
    "in_progress": 0
  },
  "agents": {
    "max_parallel": 4,
    "active": []
  },
  "features": []
}

1.3 Enhanced Feature Schema for Parallel Execution

{
  "id": "FEAT-001",
  "category": "functional|ui|integration|performance|security|accessibility",
  "priority": "critical|high|medium|low",
  "description": "Clear, actionable description",
  "steps": ["Step 1", "Step 2", "Step 3"],
  "dependencies": ["FEAT-000"],
  "dependents": ["FEAT-002", "FEAT-003"],
  "status": "pending|in_progress|passed|blocked",
  "assignedAgent": null,
  "branch": null,
  "batch": null,
  "implementedAt": null,
  "mergedAt": null,
  "commitHash": null
}

1.4 Build Dependency Graph

Create file: .feature-tracking/dependency-graph.json

{
  "generated": "YYYY-MM-DD HH:MM",
  "criticalPath": ["FEAT-001", "FEAT-005", "FEAT-012"],
  "criticalPathLength": 3,
  "batches": [
    {
      "batch": 1,
      "features": ["FEAT-001", "FEAT-002", "FEAT-003"],
      "parallel": true,
      "blockedBy": []
    },
    {
      "batch": 2,
      "features": ["FEAT-004", "FEAT-005"],
      "parallel": true,
      "blockedBy": [1]
    }
  ],
  "isolatedFeatures": ["FEAT-010", "FEAT-011"],
  "graph": {
    "FEAT-001": { "in": [], "out": ["FEAT-004", "FEAT-005"] },
    "FEAT-002": { "in": [], "out": ["FEAT-006"] }
  }
}

1.5 Dependency Analysis Rules

  1. No Dependencies: Can start immediately in Batch 1
  2. Single Dependency: Waits for that feature only
  3. Multiple Dependencies: Waits for ALL dependencies
  4. Circular Detection: FAIL if cycles found - must restructure

Circular Dependency Detection

Before proceeding, verify no cycles exist in the dependency graph:

# Using jq to detect cycles (simplified check)
# This finds features that depend on features that depend back on them
cat .feature-tracking/features.json | jq '
  .features as $all |
  [.features[] |
    select(.dependencies[] as $dep |
      $all[] | select(.id == $dep) | .dependencies[] == .id
    )
  ] | if length > 0 then
    "CIRCULAR DEPENDENCY DETECTED: \(.[].id)"
  else
    "No cycles detected"
  end
'

If cycles are detected:

  1. Identify the circular chain (A → B → A)
  2. Break the cycle by splitting one feature into sub-features
  3. Or merge dependent features into a single feature
  4. Re-run dependency analysis

Phase 2: Parallel Execution Planning

2.1 Calculate Optimal Batches

Use topological sort to determine execution order:

Batch 1: All features with no dependencies (run in parallel)
Batch 2: Features depending only on Batch 1 (run in parallel after Batch 1)
Batch 3: Features depending on Batch 1 or 2 (run in parallel after Batch 2)
...continue until all features assigned

2.2 Agent Assignment Strategy

Create file: .feature-tracking/agent-assignments.json

{
  "strategy": "round-robin|load-balanced|priority-based",
  "maxAgents": 4,
  "assignments": [
    {
      "agentId": "agent-1",
      "features": ["FEAT-001", "FEAT-004"],
      "branch": "feature/agent-1-batch",
      "status": "idle|working|waiting"
    }
  ]
}

2.3 Create Main Feature Branch

Before launching agents, create the integration branch where all features will be merged:

# Create and switch to the main feature branch
git checkout -b feature/$PROJECT_NAME-main

# Push to establish remote tracking
git push -u origin feature/$PROJECT_NAME-main

# Record in coordination files
echo "feature/$PROJECT_NAME-main" > .feature-tracking/main-branch.txt

Important: All agent branches will merge INTO this branch, not directly to main/master.

2.4 Create Master Coordination Document

Create file: .feature-tracking/COORDINATION.md

# Parallel Feature Build Coordination

## Project: $ARGUMENTS
## Mode: Parallel Execution
## Max Agents: 4

---

## Execution Batches

### Batch 1 (No Dependencies) - PARALLEL
| Feature | Agent | Branch | Status |
|---------|-------|--------|--------|
| FEAT-001 | agent-1 | feat/agent-1-b1 | pending |
| FEAT-002 | agent-2 | feat/agent-2-b1 | pending |
| FEAT-003 | agent-3 | feat/agent-3-b1 | pending |

### Batch 2 (Depends on Batch 1) - PARALLEL after Batch 1
| Feature | Agent | Branch | Status |
|---------|-------|--------|--------|

---

## Merge Queue

| Order | Feature | From Branch | Status |
|-------|---------|-------------|--------|

---

## Active Agents

| Agent ID | Current Feature | Branch | Started |
|----------|-----------------|--------|---------|


Maintain Parallel Feature Build?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

Parallel Feature Build on getagentictools
[![Parallel Feature Build on getagentictools](https://getagentictools.com/badge/loops/qdhenry-parallel-feature-build-command.svg)](https://getagentictools.com/loops/qdhenry-parallel-feature-build-command?ref=badge)