afc-implement
Execute code implementation — implement features, refactors, or planned changes
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Execute code implementation — implement features, refactors, or planned changes
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Code and component analysis — analyze code, trace flows, audit consistency, inspect components
Architecture analysis and design review
Full auto pipeline — run spec-to-clean cycle automatically for new features
Save session state for later resumption
Resolve spec ambiguities with clarifying questions
Pipeline artifact cleanup and codebase hygiene
| name | afc:implement |
| description | Execute code implementation — implement features, refactors, or planned changes |
| argument-hint | [task ID or phase specification] |
Executes implementation phase by phase with dependency-aware scheduling. Generates tasks.md automatically from plan.md if absent. Swarm mode activates for high-parallelism phases.
$ARGUMENTS — (optional) Specific task ID or phase to run (e.g., T005, phase3)!cat .claude/afc.config.md 2>/dev/null || echo "[CONFIG NOT FOUND] .claude/afc.config.md not found. Create it with /afc:init."
Always read .claude/afc.config.md first (read manually if not auto-loaded above).
If config file is missing:
.claude/afc.config.md not found. Run /afc:init to set up the project?"/afc:init, then restart this command with the original $ARGUMENTSBefore starting implementation, create a rollback point:
git tag -f afc/pre-implement
git reset --hard afc/pre-implement/afc:implement run/afc:auto pipeline (the afc/pre-auto tag already exists)Standalone safety activation (skip if inside /afc:auto):
If no active pipeline state exists, activate it for the duration of this command:
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" start {feature-name-from-plan.md}
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" phase implement
This enables Stop Gate and CI Gate hooks during standalone implementation. Release on completion (Step 7) or failure rollback.
BRANCH_NAME.claude/afc/specs/{feature}/:
/afc:plan first."git log --oneline -20{config.gate} before starting:
{config.test} is non-empty): run {config.test}:
Depends On, Phase- [ ] T{NNN} {[P]} {description} \{file}` {depends: [TXXX]}`[P] to tasks in the same Phase with no file dependency overlapDepends On column to depends: [TXXX] references"${CLAUDE_SKILL_DIR}/../../scripts/afc-dag-validate.sh" .claude/afc/specs/{feature}/tasks.md
"${CLAUDE_SKILL_DIR}/../../scripts/afc-parallel-validate.sh" .claude/afc/specs/{feature}/tasks.md
.claude/afc/specs/{feature}/tasks.mdIf tasks.md already exists: use as-is, skip generation.
depends: list[x] tasksIf .claude/afc/memory/retrospectives/ exists, load the most recent 3 files and scan for patterns relevant to the current task (file conflicts, unexpected dependencies, CI failures after parallel execution). Flag similar patterns. Skip gracefully if absent. Do not load more than 3 files — diminishing returns beyond recent history.
Progress: {completed}/{total} ({percent}%)
Next: {first incomplete task ID} - {description}
$ARGUMENTS, start from that itemExecute each phase in order. Choose orchestration mode based on whether multi-agent coordination overhead is justified.
| Condition | Mode |
|---|---|
| No [P] markers | Sequential |
| [P] tasks but delegation criteria NOT met | Sequential |
| [P] tasks, ALL criteria met, moderate parallelism | Parallel Batch |
| [P] tasks, ALL criteria met, high parallelism (multiple rounds needed) | Swarm |
Default is direct execution: main agent executes tasks directly unless all 4 parallel delegation criteria are met. See docs/orchestration-modes.md for full criteria, execution patterns, failure recovery, and dependency resolution.
Execute one at a time in order. On start: ▶ {ID}: {description}. On complete: ✓ {ID} complete.
Dependent task chaining: When Task B depends on Task A (same worker), use SendMessage to resume the existing worker instead of spawning a new one. This preserves Task A's full context (file reads, decisions, test results) for Task B.
For moderate independent [P] tasks. Launch multiple Task() calls in a single message (concurrent). See docs/orchestration-modes.md for prompt template, verification steps, and failure recovery.
Key constraints:
run_in_background: true is never used on Task callsFor high-parallelism phases requiring multiple orchestrator rounds. Orchestrator pre-assigns tasks — workers never self-claim. Max 5 concurrent sub-agents (platform limit). See docs/orchestration-modes.md for full swarm protocol, worker prompt template, and failure recovery.
Always read
${CLAUDE_SKILL_DIR}/../../docs/phase-gate-protocol.mdfirst and perform all steps in order. Cannot advance to the next phase without passing the gate. Abort and report after 3 consecutive CI failures.
After passing the gate:
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" phase-tag {phase_number}
For each task:
{config.tdd} is strict or guide: enforce order. If off or unset: recommended only.{config.gate}[x]{config.ci}
/afc:debug logic inline with the CI error as input{config.ci} after fixAfter CI passes, run a convergence-based Critic Loop to verify design alignment.
Always read
${CLAUDE_SKILL_DIR}/../../docs/critic-loop-rules.mdfirst and follow it.
Critic Loop until convergence (safety cap: 5):
Fast-path: If total changed files ≤ 3 AND no new public API surface: run SCOPE_ADHERENCE + CORRECTNESS only (skip ARCHITECTURE and SIDE_EFFECT_SAFETY). Adversarial pass: 1 perspective instead of 3. This reduces overhead for small, contained changes without sacrificing correctness.
Full critic (when fast-path does not apply):
git diff changed files against plan.md File Change Map. "M of N files match."{config.architecture} rules. "N of M rules checked."{config.ci}. ESCALATE → pause for user. DEFER → record reason.Standalone cleanup (if pipeline was activated in Step 0):
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" end
Implementation complete
├─ Tasks: {completed}/{total}
├─ Phases: {phase count} complete
├─ CI: {config.ci} passed
├─ Changed files: {file count}
└─ Next step: /afc:review (optional)
{config.architecture} rules.{config.ci} gate: must pass on phase completion. Do not bypass.docs/orchestration-modes.md