From code-forge
Executes pending feature implementation tasks from a plan with TDD, sub-agent isolation, and progress tracking. Supports multi-repo parallel execution via --repos flag.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-forge:implThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
@../shared/execution-entrypoint.md
@../shared/execution-entrypoint.md
For this skill: start at Step 1. If you catch yourself about to say "falling back to manual implementation", STOP and go to the indicated step.
Execute pending implementation tasks for a feature, following the plan generated by /code-forge:plan.
state.json + tasks/ directory) ready for execution/code-forge:impl user-auth # Execute tasks for user-auth feature
/code-forge:impl # Auto-detect pending feature
/code-forge:impl core-dispatcher --repos ~/apcore-python ~/apcore-typescript ~/apcore-rust
Locate Feature → Confirm Execution → Task Loop (sub-agents) → Verify → Complete
Step 3 dispatches a dedicated sub-agent for each task, so code changes from one task don't pollute the context of the next. The main context only handles coordination: reading state, dispatching sub-agents, and updating status.
@../shared/configuration.md
If $ARGUMENTS does not contain --repos, skip this step and continue below.
If --repos is present: first, resolve <cf_scripts> per Locating the script layer (the configuration step). The code-forge install directory <cf_install> is its grandparent (<cf_scripts>/../.. — the folder that contains skills/); this is the install, not the user's project. Then dispatch Agent(subagent_type="general-purpose", description="Impl --repos coordinator") with prompt containing the resolved absolute paths:
Read these two files and follow them exactly:
<cf_install>/skills/shared/multi-repo.md— the protocol steps MR-1~MR-5<cf_install>/skills/impl/multi-repo-defs.md— the impl-specific definitionsThe code-forge scripts are at
<cf_install>/skills/shared/scripts/— pass this absolute path to each repo sub-agent.User arguments: $ARGUMENTS
Then stop — do not continue to Step 0.5.
Before executing tasks, ensure the project context is understood:
@../shared/project-analysis.md
Execute PA.1 (Project Profile), PA.3 (Language-Specific Deep Scan for the feature's modules), and PA.5 (Existing Test Assessment). This context is passed to each task sub-agent so they:
If the user provided a feature name (e.g., /code-forge:impl user-auth):
{output_dir}/{feature_name}/state.json{output_dir}/*/state.json for a feature whose feature field matchesoutput_dir, also search .code-forge/tmp/{feature_name}/state.json and .code-forge/tmp/*/state.json (plan may have been created with --tmp)/code-forge:status to see available features."If found in .code-forge/tmp/, set output_dir to .code-forge/tmp/ and tmp_mode to true for the rest of the session.
If no feature name is provided:
{output_dir}/*/state.json and .code-forge/tmp/*/state.json for all featuresstatus = "pending" or "in_progress" (exclude "completed")/code-forge:plan to create one."[tmp] suffix) and use AskUserQuestion to let user selectAfter locating the feature:
state.jsontasks array is non-emptytasks/ directory exist"completed": "All tasks already completed. Run /code-forge:review {feature} to review."Use AskUserQuestion:
/code-forge:impl {feature})assignee, sync state.jsonEach task is executed by a dedicated sub-agent to prevent cross-task context accumulation. The main context only handles coordination: reading state, dispatching sub-agents, and updating status.
Deterministic state operations: use the state helper for every state.json
read and mutation in this loop — it recomputes progress, fixes timestamps, and
derives the next runnable task without pulling the whole file into context.
Resolve <cf_scripts> once (see Locating the script layer in the configuration
step) and quote paths, then:
python3 "<cf_scripts>/cf-state.py" next "<state.json>" → prints
id\ttitle, or ALL_DONE.python3 "<cf_scripts>/cf-state.py" set-status "<state.json>" <id> <status>
(status ∈ in_progress|completed|skipped|blocked|pending).python3 "<cf_scripts>/cf-state.py" show "<state.json>".
If python3 is unavailable, fall back to editing state.json by hand (set the
task status, fix started_at/completed_at, recompute the progress block and
the feature-level status).cf-state.py next <state.json>ALL_DONE: display "All tasks completed!" and exit loopcf-state.py set-status <state.json> {id} in_progressAskUserQuestion: "Is the task completed?"
set-status {id} completed, continue loopset-status {id} blocked (or leave in_progress), exit loopset-status {id} skipped, continue loopSpawn an Agent tool call with:
subagent_type: "general-purpose"description: "Execute task: {task_id}"Sub-agent prompt must include:
{output_dir}/{feature_name}/tasks/{task_id}.md (sub-agent reads it)@../shared/coding-standards.md
@../shared/design-first.md
Sub-agent executes:
Sub-agent must return a concise execution summary:
STATUS: completed | partial | blocked
FILES_CHANGED:
- path/to/file.ext (created | modified)
- ...
TEST_RESULTS: X passed, Y failed
SUMMARY: <1-2 sentence description of what was done>
ISSUES: <any blockers or concerns, or "none">
Main context retains: Only the execution summary (~0.5-1KB per task). All code changes, test outputs, and file reads stay in the sub-agent's context and are discarded.
When multiple pending tasks have no mutual dependencies (none depends on another), they may be dispatched as parallel sub-agents using multiple Agent tool calls in a single message. Each sub-agent works in isolation on its own task.
Use parallel execution only when:
depends on the other)After all parallel sub-agents complete, review each summary and update state.json for all completed tasks before continuing the loop.
Before completion summary, verify all generated files:
Fast path: run the structural validator and act on its result:
python3 "<cf_scripts>/cf-verify-plan.py" "<output_dir>/<feature>" --output-dir "<output_dir>"
It prints a PASS/FAIL/WARN checklist and exits non-zero on any structural error
(missing/empty required files, invalid or inconsistent state.json, a referenced
task file that is missing). Treat content-section gaps as warnings. On a non-zero
exit, apply the auto-fixes below and re-run. If python3 is unavailable, run the
checks by hand.
Checks (the validator covers all of these):
overview.md, plan.md, state.jsontasks/ directory exists and contains .md files with descriptive namesstate.json is valid JSON with required fields (feature, status, tasks, execution_order); task count matches task files; all IDs in execution_order match tasks entriesplan.md contains: title heading, ## Goal, ## Task Breakdown, ## Acceptance Criteriaoverview.md contains ## Task Execution Order tableOn pass: Show checklist with all items passing, continue.
On error (missing required files): Show what's missing. Attempt auto-fix:
overview.md → generate template from plan datatasks/ → create directorystate.json → generate initial state from task files found
Then re-verify.On warnings (count mismatch, missing optional section): Show warnings, continue by default.
After all tasks are completed:
state.json: python3 "<cf_scripts>/cf-state.py" recompute "<state.json>" (recomputes the progress block and sets the feature-level status). Fall back to editing by hand if python3 is unavailable.{output_dir}/overview.md)Feature implementation completed!
Completed tasks: {completed}/{total}
Location: {output_dir}/{feature_name}/
Total time: {actual_time}
Next steps:
/code-forge:review {feature_name} Review code quality
/code-forge:verify Verify all tests pass
/code-forge:finish {feature_name} Merge / create PR
npx claudepluginhub tercel/tercel-claude-plugins --plugin code-forgeGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.