Implement Feature
Maximum utilization of parallel subagent execution for feature implementation with built-in scope control and reflection.
Quick Start
/implement user authentication /implement real-time notifications /implement dashboard analytics
STEP 0: Verify User Intent with AskUserQuestion
BEFORE creating tasks or doing ANY work, ask the user to clarify scope:
AskUserQuestion(
questions=[
{
"question": "What scope for this implementation?",
"header": "Scope",
"options": [
{"label": "Full-stack (Recommended)", "description": "Backend + frontend + tests + docs"},
{"label": "Backend only", "description": "API + database + backend tests"},
{"label": "Frontend only", "description": "UI components + state + frontend tests"},
{"label": "Quick prototype", "description": "Minimal working version, skip tests"}
],
"multiSelect": false
},
{
"question": "Any constraints I should know about?",
"header": "Constraints",
"options": [
{"label": "None (Recommended)", "description": "Use best practices and modern patterns"},
{"label": "Match existing patterns", "description": "Follow existing codebase conventions exactly"},
{"label": "Minimal dependencies", "description": "Avoid adding new packages"},
{"label": "Specific tech stack", "description": "I'll specify the technologies to use"}
],
"multiSelect": false
}
]
)
Based on user's answers, adjust the workflow:
- •Full-stack: All 10 phases, all parallel agents
- •Backend only: Skip frontend agents (phases 5b, 6b)
- •Frontend only: Skip backend agents (phases 5a, 6a)
- •Quick prototype: Skip phases 7-10 (scope check, verification, docs, reflection)
CRITICAL: Task Management is MANDATORY (CC 2.1.16)
BEFORE doing ANYTHING else, create tasks to track progress:
# 1. Create main implementation task IMMEDIATELY
TaskCreate(
subject="Implement: {feature}",
description="Full-stack implementation with parallel agents",
activeForm="Implementing {feature}"
)
# 2. Create subtasks for each phase (10-phase process)
TaskCreate(subject="Research best practices", activeForm="Researching best practices")
TaskCreate(subject="Design architecture", activeForm="Designing architecture")
TaskCreate(subject="Micro-plan each task", activeForm="Creating micro-plans")
TaskCreate(subject="Setup git worktree (optional)", activeForm="Setting up worktree")
TaskCreate(subject="Implement backend", activeForm="Implementing backend")
TaskCreate(subject="Implement frontend", activeForm="Implementing frontend")
TaskCreate(subject="Write tests", activeForm="Writing tests")
TaskCreate(subject="Integration verification", activeForm="Verifying integration")
TaskCreate(subject="Scope creep check", activeForm="Checking for scope creep")
TaskCreate(subject="Post-implementation reflection", activeForm="Reflecting on implementation")
# 3. Update status as you progress
TaskUpdate(taskId="2", status="in_progress") # When starting
TaskUpdate(taskId="2", status="completed") # When done
Workflow Overview
| Phase | Activities | Output |
|---|---|---|
| 1. Discovery & Planning | Research, break into tasks | Task list |
| 2. Micro-Planning | Detailed plan per task | Micro-plans |
| 3. Worktree Setup | Isolate in git worktree (optional) | Clean workspace |
| 4. Architecture Design | 5 parallel agents | Design specs |
| 5. Implementation | 8 parallel agents | Working code |
| 6. Integration & Validation | 4 parallel agents | Tested code |
| 7. Scope Creep Check | Compare vs original scope | Scope report |
| 8. E2E Verification | Browser testing | Evidence |
| 9. Documentation | Save decisions to memory | Persisted knowledge |
| 10. Reflection | What worked, what didn't | Lessons learned |
Phase 1: Discovery & Planning
1a. Create Task List
Break into small, deliverable, testable tasks:
- •Each task completable in one focused session
- •Each task MUST include its tests
- •Group by domain (frontend, backend, AI, shared)
1b. Research Current Best Practices
# PARALLEL - Web searches (launch all in ONE message)
WebSearch("React 19 best practices 2026")
WebSearch("FastAPI async patterns 2026")
WebSearch("TypeScript 5.x strict mode 2026")
1c. Context7 Documentation
# PARALLEL - Library docs (launch all in ONE message) mcp__context7__query-docs(libraryId="/vercel/next.js", query="app router") mcp__context7__query-docs(libraryId="/tiangolo/fastapi", query="dependencies")
Phase 2: Micro-Planning Per Task (NEW)
Goal: Create detailed mini-plans for each task BEFORE implementation.
Micro-Plan Template
For each task from Phase 1, create a micro-plan:
## Micro-Plan: [Task Name] ### Scope (What's IN) - [ ] Specific change 1 - [ ] Specific change 2 - [ ] Test for change 1 - [ ] Test for change 2 ### Out of Scope (What's NOT in this task) - Feature X (separate task) - Optimization Y (future task) ### Files to Touch | File | Change Type | Description | |------|-------------|-------------| | path/file.py | CREATE | New service class | | path/test.py | CREATE | Tests for service | | path/api.py | MODIFY | Add endpoint | ### Acceptance Criteria - [ ] Tests pass - [ ] Lint clean - [ ] Types valid - [ ] Manually verified ### Estimated Time [X] minutes / hours
Phase 3: Git Worktree Isolation (Optional but Recommended)
Goal: Isolate feature work in a dedicated worktree to avoid polluting main workspace.
When to Use Worktrees
| Scenario | Use Worktree? |
|---|---|
| Large feature (5+ files) | YES |
| Experimental/risky changes | YES |
| Quick bug fix (1-2 files) | No |
| Hotfix to production | YES |
| Parallel feature development | YES |
Worktree Setup
# Create feature worktree git worktree add ../project-feature-name feature/feature-name # Navigate to worktree cd ../project-feature-name # Work in isolation... # When done, merge and cleanup git checkout main git merge feature/feature-name git worktree remove ../project-feature-name
Phase 4: Parallel Architecture Design (5 Agents)
Launch ALL 5 agents in ONE Task message with run_in_background: true:
| Agent | Focus |
|---|---|
| workflow-architect | Architecture planning, dependency graph |
| backend-system-architect | API, services, database |
| frontend-ui-developer | Components, state, hooks |
| llm-integrator | LLM integration (if needed) |
| ux-researcher | User experience, accessibility |
Launch all 5 agents with run_in_background=True. Each agent returns a SUMMARY line.
Phase 5: Parallel Implementation (8 Agents)
| Agent | Task |
|---|---|
| backend-system-architect #1 | API endpoints |
| backend-system-architect #2 | Database layer |
| frontend-ui-developer #1 | UI components |
| frontend-ui-developer #2 | State & API hooks |
| llm-integrator | AI integration |
| rapid-ui-designer | Styling |
| test-generator #1 | Test suite |
| prioritization-analyst | Progress tracking |
Phase 6: Integration & Validation (4 Agents)
| Agent | Task |
|---|---|
| backend-system-architect | Backend + database integration |
| frontend-ui-developer | Frontend + API integration |
| code-quality-reviewer #1 | Full test suite |
| security-auditor | Security audit |
Phase 7: Scope Creep Detector (NEW)
Goal: Compare implementation against original scope to catch unplanned additions.
Scope Creep Check Process
Task(
subagent_type="workflow-architect",
prompt="""SCOPE CREEP DETECTION for: $ARGUMENTS
Compare implementation against original micro-plans:
1. PLANNED vs ACTUAL FILES
- Files that were planned
- Files actually modified
- Unplanned file changes?
2. PLANNED vs ACTUAL FEATURES
- Features in original scope
- Features actually implemented
- Unplanned features added?
3. SCOPE CREEP INDICATORS
- "While I'm here..." changes
- Premature optimization
- Goldplating (unnecessary polish)
- Refactoring outside scope
4. IMPACT ASSESSMENT
- Time spent on unplanned work
- Risk introduced by unplanned changes
- Testing gaps from scope expansion
Output:
{
"planned_files": N,
"actual_files": M,
"unplanned_changes": ["file - change type - justification needed"],
"scope_creep_score": 0-10 (0=perfect, 10=major creep),
"recommendations": ["action"]
}
SUMMARY: End with: "SCOPE: [score]/10 creep - [N] unplanned changes - [key issue]"
""",
run_in_background=True
)
Scope Creep Response
| Score | Level | Action |
|---|---|---|
| 0-2 | Minimal | Proceed to reflection |
| 3-5 | Moderate | Document unplanned changes, justify or revert |
| 6-8 | Significant | Review with user, potentially split into separate PR |
| 9-10 | Major | Stop, reassess, likely need to split work |
Phase 8: E2E Verification
If UI changes, verify with agent-browser:
agent-browser open http://localhost:5173 agent-browser wait --load networkidle agent-browser snapshot -i agent-browser screenshot /tmp/feature.png agent-browser close
Phase 9: Documentation
Save implementation decisions to memory MCP for future reference:
mcp__mem0__add-memory(content="Implementation decisions...", userId="project-decisions")
Phase 10: Post-Implementation Reflection (NEW)
Goal: Capture lessons learned while context is fresh.
Reflection Questions
After implementation is complete and verified, answer these questions:
Task(
subagent_type="workflow-architect",
prompt="""POST-IMPLEMENTATION REFLECTION for: $ARGUMENTS
Reflect on the implementation process:
1. WHAT WENT WELL
- Approaches that worked smoothly
- Good decisions made
- Time-saving patterns used
2. WHAT COULD BE IMPROVED
- Pain points encountered
- Decisions that had to be revised
- Time sinks
3. ESTIMATION ACCURACY
- Original estimate: [X]
- Actual time: [Y]
- Variance reason: [why]
4. REUSABLE PATTERNS
- Patterns worth extracting to skills
- Code worth making into utilities
- Documentation worth adding
5. TECHNICAL DEBT
- Shortcuts taken (with justification)
- TODOs left behind
- Known limitations
6. KNOWLEDGE GAPS DISCOVERED
- Things we didn't know at start
- Research needed mid-implementation
- Skills/tools to learn for future
Output:
{
"went_well": ["item"],
"improvements": ["item"],
"estimate_accuracy": "X%",
"reusable_patterns": ["pattern - where to use"],
"tech_debt": ["debt - priority - plan"],
"knowledge_gaps": ["gap - how filled"]
}
SUMMARY: End with: "REFLECTION: [estimate accuracy]% accuracy - [key lesson]"
""",
run_in_background=True
)
Persist Lessons Learned
# Store in memory for future implementations
mcp__memory__create_entities(entities=[{
"name": "{feature}-lessons-learned",
"entityType": "Reflection",
"observations": [
"Lesson 1: ...",
"Lesson 2: ...",
"Pattern to reuse: ..."
]
}])
Continuous Feedback Loop (NEW)
Throughout implementation, maintain a feedback loop:
After Each Task Completion
# Quick checkpoint after each task
print(f"""
TASK CHECKPOINT: {task_name}
- Completed: {what_was_done}
- Tests: {pass/fail}
- Time: {actual} vs {estimated}
- Blockers: {any issues}
- Scope changes: {any deviations}
""")
# Update task status
TaskUpdate(taskId=task_id, status="completed")
Feedback Triggers
| Trigger | Action |
|---|---|
| Task takes 2x estimated time | Pause, reassess scope |
| Test keeps failing | Consider design issue, not just implementation |
| Scope creep detected | Stop, discuss with user |
| Blocker found | Create blocking task, switch to parallel work |
Summary
Total Parallel Agents: 17 across 4 phases
Tools Used:
- •context7 MCP (library documentation)
- •mem0 MCP (decision persistence)
- •agent-browser CLI (E2E verification)
Key Principles:
- •Tests are NOT optional
- •Parallel when independent (use
run_in_background: true) - •CC 2.1.6 auto-loads skills from agent frontmatter
- •Evidence-based completion
- •Micro-plan before implementing
- •Detect and address scope creep
- •Reflect and capture lessons learned
Related Skills
- •explore: Explore codebase before implementing
- •verify: Verify implementations work correctly
- •worktree-coordination: Git worktree management patterns