How this skill is triggered — by the user, by Claude, or both
Slash command
/forgeplan:buildThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Target:** $ARGUMENTS
Target: $ARGUMENTS
--all)If the argument is --all, build all eligible nodes sequentially in dependency order:
node "${CLAUDE_PLUGIN_ROOT}/scripts/topo-sort.js" to get the build order.forgeplan/state.json and manifest to find nodes with status "specced" or "revised" whose dependencies are all satisfied AND (node.phase || 1) <= (manifest.project.build_phase || 1). Skip nodes already "built", "reviewed", or "reviewed-with-findings" — they should move to review/integration, not be rebuilt by default. Skip future-phase nodes with log: "Skipping [node-id] — phase [N] (current build_phase: [M])."/forgeplan:review on each built node first, then /forgeplan:integrate after all are reviewed. Built-but-unreviewed nodes must be reviewed before integration.Before building, verify node.phase <= project.build_phase (read from manifest). If the node is in a future phase, stop IMMEDIATELY — do NOT proceed to the Setup section, do NOT write to state.json:
"Node [id] is phase [N] but current build_phase is [M]. Complete phase [M] nodes first (check /forgeplan:status for progress), then advance via /forgeplan:deep-build."
This is also enforced by pre-tool-use.js Layer 1, but checking here prevents stuck-state scenarios.
Before dispatching the Builder agent, load skills from the registry:
.forgeplan/skills-registry.yaml. If missing or stale, run node "${CLAUDE_PLUGIN_ROOT}/scripts/skill-registry.js" refresh first.assignments.builder — get the list of skill paths, names, descriptions, and hints.tech_filter specifically matches the node's type or interfaces (e.g., supabase-postgres for a database node), upgrade its hint to read_now. Otherwise keep as reference.read_now skill: "READ NOW: [path] — [description]. Directly relevant to this node. Read the full skill before writing code."reference skill: "REFERENCE: [path] — [description]. Read if you need guidance on this topic during implementation."For SMALL tier: Skip skill loading entirely (skills disabled by default for SMALL).
If the target node is frontend-facing, check these files before dispatching the Builder:
DESIGN.mddocs/DESIGN.md.forgeplan/wiki/design.mdAlso check .forgeplan/config.yaml for:
design.profilesdesign.mixinsdesign.blend_notesBefore dispatching the Builder, run:
node "${CLAUDE_PLUGIN_ROOT}/scripts/compose-design-context.js"
If the script returns a composed brief, include that brief in the Builder context as the design north star. If the script reports no explicit design context, proceed normally. Do not try to manually mash multiple profile files together in the prompt when the composer can do it deterministically.
Build the specified node following its spec with layered enforcement:
Target node: $ARGUMENTS
.forgeplan/manifest.yaml must exist.forgeplan/specs/[node-id].yaml must exist and be complete"specced", "built", "reviewed", "reviewed-with-findings", or "revised" (not "pending", "building", "reviewing", "review-fixing", "revising", or "sweeping")depends_on list must have status "built", "reviewed", or "reviewed-with-findings" (NOT "revised" — revised means stale code that needs rebuild).forgeplan/config.yaml if it exists and resolve the builder model using this precedence:
models.builder_override.[node-id]models.buildersonnet for SMALL/MEDIUM, opus for LARGE)
Record both the chosen model and the reason it was selected.file_scope before building starts. This enables PostToolUse to distinguish genuinely new files from pre-existing ones. Use the Glob tool with the node's file_scope pattern to list all matching files. Store the result as nodes.[node-id].pre_build_files in state.json. The Glob tool handles all glob patterns correctly regardless of platform.node "${CLAUDE_PLUGIN_ROOT}/scripts/state-transition.js" start-build "[node-id]" "[previous-status]" "[selected-model]" "[selection-reason]" '[pre-build-files-json]'
This atomically sets:
nodes.[node-id].previous_statusactive_nodenodes.[node-id].statusnodes.[node-id].selected_builder_modelnodes.[node-id].selected_builder_model_reasonnodes.[node-id].pre_build_filesnodes.[node-id].bounce_countnodes.[node-id].files_creatednodes.[node-id].files_modifiedlast_updated
Do not manually edit .forgeplan/state.json for this transition.The Builder agent receives:
Model selection — tier-aware with user override:
sonnet (fast, sufficient for simple builds)sonnet, consider opus for nodes with complex integrationsopus (strongest reasoning for complex code generation)models.builder in .forgeplan/config.yamlmodels.builder_override.[node-id]: "opus" for specific complex nodesmodels.builder_override.[node-id] > models.builder > tier defaultnodes.[node-id].selected_builder_model so deep-build reporting can show which model actually built each nodeopus because discovery requires the strongest reasoning regardless of tier.Do NOT manually update nodes.[node-id].status to "built" or clear active_node. The Stop hook is the sole gate between "building" and "built":
stop-hook.js) checks bounce counter, Layer 2 (prompt) evaluates every acceptance criterion by IDnode "${CLAUDE_PLUGIN_ROOT}/scripts/state-transition.js" complete-build "[node-id]"
This marks the node as "built", sets last_build_completed, resets bounce_count, clears previous_status, clears active_node, and resets stop_hook_active.
After complete-build, the node-scoped build is finished. Do not run additional set-node-status ... "built" transitions, and do not perform root-scope integration edits such as router registration in main.py from the same build flow.node "${CLAUDE_PLUGIN_ROOT}/scripts/state-transition.js" increment-bounce "[node-id]"
Then continue building to address the unmet acceptance criteria. After 3 bounces, escalate via /forgeplan:recover.After the Stop hook allows completion, suggest running /forgeplan:review [node-id] next.
Also compute the autonomy handoff explicitly with:
node "${CLAUDE_PLUGIN_ROOT}/scripts/autonomy-handoff.js"
If it reports autonomous_available: true, tell the user they can either:
/forgeplan:deep-buildDo not make the user infer that autonomy can resume from the current state.
Manually marking as "built" would bypass acceptance criteria verification — the entire point of the Stop hook.
If /forgeplan:review issues REQUEST CHANGES, re-run /forgeplan:build [node-id]. Each re-build spawns a fresh Builder agent with:
This fresh-agent pattern prevents the Builder from getting stuck in its own reasoning loop. The cycle is: specced → building → built → reviewing → reviewed|reviewed-with-findings. After revision: revised → building → built → reviewing → reviewed|reviewed-with-findings (review is required after every rebuild).
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cspergel/forgedev --plugin forgeplan