Implement Feature
Parallel subagent execution for feature implementation with scope control and reflection.
Quick Start
/ork:implement user authentication /ork:implement --model=opus real-time notifications /ork:implement dashboard analytics
Argument Resolution
FEATURE_DESC = "$ARGUMENTS" # Full argument string, e.g., "user authentication"
$ARGUMENTS[0] is the first token, $ARGUMENTS[1] second, etc. (CC 2.1.59)
Model override detection (CC 2.1.72)
MODEL_OVERRIDE = None for token in "$ARGUMENTS".split(): if token.startswith("--model="): MODEL_OVERRIDE = token.split("=", 1)[1] # "opus", "sonnet", "haiku" FEATURE_DESC = FEATURE_DESC.replace(token, "").strip()
Pass MODEL_OVERRIDE to all Agent() calls via model=MODEL_OVERRIDE when set. Accepts symbolic names (opus , sonnet , haiku ) or full IDs (claude-opus-4-6 ) per CC 2.1.74.
Step -1: MCP Probe + Resume Check
Run BEFORE any other step. Detect available MCP servers and check for resumable state.
Probe MCPs (parallel — all in ONE message):
ToolSearch(query="select:mcp__memory__search_nodes") ToolSearch(query="select:mcp__context7__resolve-library-id")
Write(".claude/chain/capabilities.json", JSON.stringify({ "memory": <true if found>, "context7": <true if found>, "timestamp": now() }))
Resume check:
Read(".claude/chain/state.json")
If exists and skill == "implement":
Read last handoff (e.g., 04-architecture.json)
Skip to current_phase
"Resuming from Phase {N} — architecture decided in previous session"
If not: write initial state
Write(".claude/chain/state.json", JSON.stringify({ "skill": "implement", "feature": FEATURE_DESC, "current_phase": 1, "completed_phases": [], "capabilities": capabilities }))
Load: Read("${CLAUDE_PLUGIN_ROOT}/skills/chain-patterns/references/checkpoint-resume.md")
Step 0: Project Context Discovery
BEFORE any work, detect the project tier. This becomes the complexity ceiling for all patterns.
Scan codebase signals and classify into tiers 1-6 (Interview through Open Source). Each tier sets an architecture ceiling and determines which phases/agents to use.
Load tier details, workflow mapping, and orchestration mode: Read("${CLAUDE_SKILL_DIR}/references/tier-classification.md")
Worktree Isolation (CC 2.1.49)
For features touching 5+ files, offer worktree isolation to prevent conflicts with the main working tree:
AskUserQuestion(questions=[{
"question": "Isolate this feature in a git worktree?",
"header": "Isolation",
"options": [
{"label": "Yes — worktree (Recommended)", "description": "Creates isolated branch via EnterWorktree, merges back on completion", "markdown": "\nWorktree Isolation\n──────────────────\nmain ─────────────────────────────▶\n \\ /\n └─ feat-{slug} (worktree) ───┘\n ├── Isolated directory\n ├── Own branch + index\n └── Auto-merge on completion\n\nSafe: main stays untouched until done\n"},
{"label": "No — work in-place", "description": "Edit files directly in current branch", "markdown": "\nIn-Place Editing\n────────────────\nmain ──[edit]──[edit]──[edit]───▶\n ▲ ▲ ▲\n │ │ │\n direct modifications\n\nFast: no branch overhead\nRisk: changes visible immediately\n"},
{"label": "Plan first", "description": "Research and design in plan mode before writing code", "markdown": "\nPlan Mode Flow\n──────────────\n 1. EnterPlanMode($ARGUMENTS)\n 2. Read existing code\n 3. Research patterns\n 4. Design approach\n 5. ExitPlanMode → plan\n 6. User approves plan\n 7. Execute implementation\n\n Best for: Large features,\n unfamiliar codebases,\n architectural decisions\n"}
],
"multiSelect": false
}])
If 'Plan first' selected: Call EnterPlanMode("Research and design: $ARGUMENTS") , perform research using Read/Grep/Glob only, then ExitPlanMode with the plan for user approval before proceeding.
If worktree selected:
-
Call EnterWorktree(name: "feat-{slug}") to create isolated branch
-
All agents work in the worktree directory
-
On completion, merge back: git checkout {original-branch} && git merge feat-{slug}
-
If merge conflicts arise, present diff to user via AskUserQuestion
Load worktree details: Read("${CLAUDE_SKILL_DIR}/references/worktree-isolation-mode.md")
Task Management (MANDATORY)
Create tasks with TaskCreate BEFORE doing any work. Each phase gets a subtask. Update status with TaskUpdate as you progress.
Workflow (10 Phases)
Phase Activities Agents
-
Discovery Research best practices, Context7 docs, break into tasks —
-
Micro-Planning Detailed plan per task (load ${CLAUDE_SKILL_DIR}/references/micro-planning-guide.md ) —
-
Worktree Isolate in git worktree for 5+ file features (load ${CLAUDE_SKILL_DIR}/references/worktree-workflow.md ) —
-
Architecture 4 parallel background agents workflow-architect, backend-system-architect, frontend-ui-developer, llm-integrator
-
Implementation + Tests Parallel agents, single-pass artifacts with mandatory tests backend-system-architect, frontend-ui-developer, llm-integrator, test-generator
-
Integration Verification Code review + real-service integration tests backend, frontend, code-quality-reviewer, security-auditor
-
Scope Creep Compare planned vs actual (load ${CLAUDE_SKILL_DIR}/references/scope-creep-detection.md ) workflow-architect
-
E2E Verification Browser + API E2E testing (load ${CLAUDE_SKILL_DIR}/references/e2e-verification.md ) —
-
Documentation Save decisions to memory graph —
-
Reflection Lessons learned, estimation accuracy workflow-architect
Load agent prompts: Read("${CLAUDE_SKILL_DIR}/references/agent-phases.md")
For Agent Teams mode: Read("${CLAUDE_SKILL_DIR}/references/agent-teams-phases.md")
Phase Handoffs (CC 2.1.71)
Write handoff JSON after major phases. See chain-patterns skill for schema.
After Phase Handoff File Key Outputs
- Discovery 01-discovery.json
Best practices, library docs, task breakdown
- Micro-Plan 02-plan.json
File map, acceptance criteria per task
- Architecture 04-architecture.json
Decisions, patterns chosen, agent results
- Implementation 05-implementation.json
Files created/modified, test results
- Scope Creep 07-scope.json
Planned vs actual, PR split recommendation
Worktree-Isolated Implementation (CC 2.1.50)
Phase 5 agents SHOULD use isolation: "worktree" to prevent file conflicts:
Agent(subagent_type="backend-system-architect", prompt="Implement backend: {feature}. Architecture: {from 04-architecture.json}", isolation="worktree", run_in_background=true) Agent(subagent_type="frontend-ui-developer", prompt="Implement frontend: {feature}...", isolation="worktree", run_in_background=true) Agent(subagent_type="test-generator", prompt="Generate tests: {feature}...", isolation="worktree", run_in_background=true)
Post-Deploy Monitoring (CC 2.1.71)
After final PR, schedule health monitoring:
Guard: Skip cron in headless/CI (CLAUDE_CODE_DISABLE_CRON)
if env CLAUDE_CODE_DISABLE_CRON is set, run a single check instead
CronCreate( schedule="0 */6 * * *", prompt="Health check for {feature} in PR #{pr}: gh pr checks {pr} --repo {repo}. If healthy 24h → CronDelete. If errors → alert." )
context7 with Detection
if capabilities.context7: mcp__context7__resolve-library-id({ libraryName: "next-auth" }) mcp__context7__query-docs({ libraryId: "...", query: "..." }) else: WebFetch("https://docs.example.com/api") # T1 fallback
Issue Tracking
If working on a GitHub issue, run the Start Work ceremony from issue-progress-tracking and post progress comments after major phases.
Feedback Loop
Maintain checkpoints after each task. Load triggers: Read("${CLAUDE_SKILL_DIR}/references/feedback-loop.md")
Test Requirements Matrix
Phase 5 test-generator MUST produce tests matching the change type. Each change type maps to specific required tests and testing rules.
Load test matrix, real-service detection, and phase 9 gate: Read("${CLAUDE_SKILL_DIR}/references/test-requirements-matrix.md")
Key Principles
-
Tests are NOT optional — each task includes its tests, matched to change type (see matrix above)
-
Parallel when independent — use run_in_background: true , launch all agents in ONE message
-
128K output — generate complete artifacts in a single pass, don't split unnecessarily
-
Micro-plan before implementing — scope boundaries, file list, acceptance criteria
-
Detect scope creep (phase 7) — score 0-10, split PR if significant
-
Real services when available — if docker-compose/testcontainers exist, use them in Phase 6
-
Reflect and capture lessons (phase 10) — persist to memory graph
-
Clean up agents — use TeamDelete() after completion; press Ctrl+F twice as manual fallback. Note: /clear (CC 2.1.72+) preserves background agents
-
Exit worktrees — call ExitWorktree(action: "keep") in Phase 10 if worktree was entered in Step 0; never leave orphaned worktrees
Related Skills
-
ork:explore : Explore codebase before implementing
-
ork:verify : Verify implementations work correctly
-
ork:issue-progress-tracking : Auto-updates GitHub issues with commit progress
References
Load on demand with Read("${CLAUDE_SKILL_DIR}/references/<file>") :
File Content
agent-phases.md
Agent prompts and spawn templates
agent-teams-phases.md
Agent Teams mode phases
interview-mode.md
Interview/take-home constraints
orchestration-modes.md
Task tool vs Agent Teams selection
feedback-loop.md
Checkpoint triggers and actions
cc-enhancements.md
CC version-specific features
agent-teams-full-stack.md
Full-stack pipeline for teams
team-worktree-setup.md
Team worktree configuration
micro-planning-guide.md
Detailed micro-planning guide
scope-creep-detection.md
Planned vs actual comparison
worktree-workflow.md
Git worktree workflow
e2e-verification.md
Browser + API E2E testing guide
worktree-isolation-mode.md
Worktree isolation details
tier-classification.md
Tier classification, workflow mapping, orchestration mode
test-requirements-matrix.md
Test matrix by change type, real-service detection, phase 9 gate