Cc Implement

You are initiating Claude Code implementation mode. This command delegates code generation to the Coder Sub-Agent for focused, co…

lebobo88 updated 7mo ago
Claude CodeGeneric
View source ↗
# TDD Implementation with Coder Sub-Agent

You are initiating Claude Code implementation mode. This command delegates code generation to the Coder Sub-Agent for focused, context-efficient development.

## Automatic Context Priming

This command automatically loads:
- Task file(s) from `RLM/tasks/active/`
- Parent feature specification
- `RLM/specs/constitution.md` - Project standards
- Configuration from `RLM/progress/cc-config.json`

## Arguments

`$ARGUMENTS` can be:
- `TASK-XXX` - Implement specific task
- `all` - Implement all active tasks **IN PARALLEL**
- `resume` - Resume interrupted session

## Workflow

### Step 1: Determine Implementation Scope

If `$ARGUMENTS` is a task ID (e.g., TASK-001):
- Read `RLM/tasks/active/TASK-XXX.md`
- Read parent feature spec from task metadata
- Execute single-task workflow (Step 3)

If `$ARGUMENTS` is `all`:
- List all files in `RLM/tasks/active/`
- Sort by priority/dependencies
- **Execute parallel-task workflow (Step 3-PARALLEL)**

If `$ARGUMENTS` is `resume`:
- Read `RLM/progress/status.json` for last state
- Read context bundle from `RLM/progress/bundles/`
- Continue from interrupted task

### Step 2: Pre-Implementation Check
For each task, verify:
- [ ] Task file exists and is complete
- [ ] Dependencies are satisfied
- [ ] No blockers documented
- [ ] Test file location identified

### Step 3: Delegate to Coder Sub-Agent (Single Task)
Use the Task tool to spawn the Coder Sub-Agent:
- **subagent_type**: Use Task tool with `coder` prompt referencing `.claude/agents/coder.md`
- **prompt**: Include:

Task: [Task ID and title] Task File: [Path to task file] Feature Spec: [Path to parent feature] Constitution: [Path to constitution.md]

Requirements:

  1. Follow TDD - write tests first
  2. Implement to pass tests
  3. Refactor while green
  4. Report completion status

### Step 3-PARALLEL: Spawn Multiple Coder Sub-Agents (All Tasks)

When `$ARGUMENTS` is `all`, spawn multiple sub-agents **in a single message**:

Load config: parallel_limit = 5 (from cc-config.json)

Tasks available: [TASK-001, TASK-002, ..., TASK-010] Tasks respecting dependencies: [TASK-001, TASK-003, TASK-005, TASK-007, TASK-009] (batch 1)

SPAWN IN SINGLE MESSAGE (multiple Task tool calls): ├─► Task tool call 1: Coder Sub-Agent → TASK-001 ├─► Task tool call 2: Coder Sub-Agent → TASK-003 ├─► Task tool call 3: Coder Sub-Agent → TASK-005 ├─► Task tool call 4: Coder Sub-Agent → TASK-007 └─► Task tool call 5: Coder Sub-Agent → TASK-009

Wait for all 5 to complete...

Results: ├─► TASK-001: SUCCESS (tests passing) ├─► TASK-003: SUCCESS ├─► TASK-005: BLOCKED (dependency issue) ├─► TASK-007: SUCCESS └─► TASK-009: SUCCESS

Move completed to RLM/tasks/completed/ Log blocker for TASK-005

SPAWN NEXT BATCH: ├─► Task tool call 1: Coder Sub-Agent → TASK-002 (was waiting on TASK-001) ├─► Task tool call 2: Coder Sub-Agent → TASK-004 └─► ... continue until all tasks complete


**Parallel Spawning Rules**:
1. **Use single message**: All Task tool calls in one response
2. **Respect dependencies**: Only spawn tasks whose dependencies are complete
3. **Respect parallel_limit**: Never exceed configured limit (default: 5)
4. **Token awareness**: Reduce batch size if approaching budget threshold
5. **Handle failures**: Continue with other tasks, log blockers

### Step 4: Monitor and Validate
After sub-agent completes:
1. Verify tests pass: `npm test` or equivalent
2. Check for any reported blockers
3. Update task status

### Step 4.5: Integrated Review (Per Task)

After implementation, run review checklist automatically:

┌─────────────────────────────────────────────────────────────────┐ │ 📋 Quick Review: TASK-XXX │ ├─────────────────────────────────────────────────────────────────┤ │ ✓ Tests passing: 12/12 │ │ ✓ Linting: Clean │ │ ✓ Type checking: No errors │ │ ✓ Security: No issues │ │ ✓ Constitution: Compliant │ │ ✓ Design tokens: Used correctly (if DESIGN_REQUIRED) │ └─────────────────────────────────────────────────────────────────┘


**If any issues found:**
1. Sub-agent fixes issues automatically (AUTO mode)
2. Report to user for approval (SUPERVISED mode)
3. Log fixes made to progress log

**Review Checklist:**
- [ ] No hardcoded values (use design tokens)
- [ ] All 8 component states (if UI component)
- [ ] Error handling present
- [ ] Functions < 50 lines
- [ ] Tests cover edge cases

### Step 5: Update Progress
Move completed task:

RLM/tasks/active/TASK-XXX.md → RLM/tasks/completed/TASK-XXX.md


Update `RLM/progress/status.json`:
```json
{
  "lastTask": "TASK-XXX",
  "status": "completed",
  "timestamp": "ISO-8601"
}

Log to RLM/progress/logs/YYYY-MM-DD.md

Step 5.5: Feature Verification (Automatic)

After updating progress, check if the completed task was the LAST task for its feature:

Check Feature Completion:
├─► Get parent feature ID (FTR-XXX) from task metadata
├─► Count tasks for FTR-XXX: active=0, blocked=0, completed=5
├─► If all tasks completed → Trigger automatic verification
└─► If tasks remaining → Continue to next task

When Feature Completes:

┌─────────────────────────────────────────────────────────────────┐
│ 🎉 Feature FTR-XXX Complete - Triggering Verification           │
├─────────────────────────────────────────────────────────────────┤
│ All 5 tasks implemented. Running verification suite...          │
└─────────────────────────────────────────────────────────────────┘

Verification Steps:

  1. Update feature status: verification-pending
  2. Generate E2E tests from acceptance criteria
  3. Run functional tests (Playwright)
  4. Run accessibility tests (axe-core, if DESIGN_REQUIRED)
  5. Run visual regression (if configured)

**Verification Results ```

Maintain Cc Implement?

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

[Cc Implement on getagentictools](https://getagentictools.com/loops/lebobo88-tdd-implementation-with-coder-sub-agent?ref=badge)