decompose
Decompose an approved feature spec into work packages. Reads plans/<feature>/spec.md and emits one wp-NN-<slug>/ folder per work package, each containing overview.md ONLY (status: spec) in the C1 eight-section shape with C2 frontmatter, a checklist of `- [ ] Tn <outcome> {files: a, b} [b1,b2]` lines, and a per-WP contract_slice. No per-item files, no todo.md. Also owns --add-wp: append ONE new WP to an existing feature without a re-decomposition. Trigger: the user asks to decompose, break down, or plan the work packages for a feature with an approved spec.md, or to add a single WP mid-flight.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- decompose
- hooks
- { "Stop": [ { "hooks": [ { "type": "command", "command": "$HOME/.claude/hooks/skill-trace.sh goalforge-decompose:stop" } ] } ] }
- metadata
- { "version": "2.0.0", "skill-kind": "preference" }
- description
- Decompose an approved feature spec into work packages. Reads plans/<feature>/spec.md and emits one wp-NN-<slug>/ folder per work package, each containing overview.md ONLY (status: spec) in the C1 eight-section shape with C2 frontmatter, a checklist of `- [ ] Tn <outcome> {files: a, b} [b1,b2]` lines, and a per-WP contract_slice. No per-item files, no todo.md. Also owns --add-wp: append ONE new WP to an existing feature without a re-decomposition. Trigger: the user asks to decompose, break down, or plan the work packages for a feature with an approved spec.md, or to add a single WP mid-flight.
02 资源文件 9
- 参考文档evals/evals.json4.2 KB
- 参考文档evals/fixtures/goal/overview.md647 B
- 参考文档evals/fixtures/goal/spec.md946 B
- 参考文档evals/fixtures/goal/wp-01-cascading-goal/overview.md838 B
- 参考文档evals/fixtures/goal/wp-01-cascading-goal/task-01-scaffold.md378 B
- 参考文档evals/fixtures/overview.md411 B
- 参考文档evals/fixtures/spec.md828 B
- 脚本evals/run.sh5.3 KB
- 参考文档references/gotchas.md1.3 KB
03 SKILL.md 正文
goalforge-decompose
Emits the WP folder tree for an approved spec. Writes only
<feature>/<wp-id>/overview.md (born status: spec, never another status) and
the feature <feature>/overview.md; spec.md is read-only here. Schema (and
§PLANS_ROOT resolution): ${CLAUDE_PLUGIN_ROOT}/references/schema.md. Template:
${CLAUDE_PLUGIN_ROOT}/references/templates/wp-overview.md.
Step 1 — Read the spec
Preconditions: <PLANS_ROOT>/<feature>/spec.md exists with an
## Interface Contract, the feature overview.md is status: ready, and the
feature is next-to-execute — decomposing ahead buffers WPs that drift; confirm.
Extract the WP table (title, scope, dependencies, parallelism), Design,
## Interface Contract, Non-Goals, and the feature goal: block with its
verification.behaviors[]. Absent a WP table, derive WPs from Design by
vertical slice — one complete testable increment each, never a horizontal
layer. Never author work that implements a non-goal.
Size each WP by goal, not item count: split when the title needs an "and" (two
distinct outcomes) or when the WP is not one measurable goal.outcome
sentence; more than 8 owned files is a batching signal (C5), not a split
signal. Confirm the list when a WP is large or the decomposition is non-obvious.
Step 2 — Derive the WP frontmatter (C2) and goal block
Per WP: name: wp-NN-<slug>, severity, task_type, register,
depends_on (backward-pointing slugs only), parallel,
owned_files (the file boundary), contract_slice (the ### C… ids of the
Interface Contract this WP depends on — schema.md §Contract-slice hash),
human_required: null or a reason string (C7), schema_version: 6,
plan: <feature>, goal_approved_version: null.
Copy register: from the spec; write spike only when the spec declares it.
goal.outcome/goal.verification are always WP-authored, never inherited: one
measurable outcome sentence, one strategy, one command-only
verification.command, and the behaviors[] rows this WP's checklist cites.
constraints/boundaries union with the feature's; iteration_policy/
blocked_stop inherit via inherits_from:.
Step 3 — Author the checklist
- [ ] T1 <imperative outcome> {files: a, b} [b1,b2]
One line per work item, in execution order; [b1,b2] names the behavior ids it
satisfies. An item carries no status, complexity, verify, depends_on, or commit
field — the WP ships as one commit (C5).
Step 4 — Stamp overview.md
Idempotency is folder-level: an existing WP folder is skipped without
modification. Otherwise stamp from the template — frontmatter from Step 2, body
in the C1 order ## Goal, ## Verification, ## Owned Files, ## Depends On,
## Checklist, ## Open Questions, ## Decisions, ## Goal Changelog, and no
other H2. Double-quote free-text frontmatter that may carry a colon (title:,
goal.outcome:) — an unquoted colon-space breaks the block. status: spec is a
birth state, not a transition: never call goalforge-transition.sh here.
Step 5 — Self-check (four rules, fixed in place)
- Deterministic gate. Every
verification.commandis command-only and runs offline — no live run, network call, or manual step. - Facet coverage. Every facet of
goal.outcomeis covered bygoal.verificationor abehaviors[]row, and every item cites a behavior id. - One owner, backward deps.
owned_filessets are pairwise disjoint across WPs, every{files: …}is a subset of its own WP'sowned_files, and nodepends_onpoints at a later WP. - Hermetic oracle. Every
behaviors[]entry names the input its check runs against, and that input ships as a fixture under the WP'sowned_files— never a live corpus root ($HOME,$CLAUDE_CONFIG_DIR); lint V6 WARNs.
A rule that needs a spec change surfaces to the user; never encode a guess.
Step 6 — Lint, then update the feature overview
bash ${CLAUDE_PLUGIN_ROOT}/scripts/goalforge-section-lint.sh <wp-path>/overview.md
bash ${CLAUDE_PLUGIN_ROOT}/scripts/goalforge-validate.sh --feature <feature> --show <PLANS_ROOT>
Section lint exit 2 = a disallowed H2. Fix every invalid YAML frontmatter
ERROR here — malformed frontmatter reads as an empty status: downstream.
Then set work_packages: to the WP slug list, fill the Work Packages table
(WP | Title | Status, every row spec), set the feature updated: and each WP
stage_updated: to today, then report one line per WP — wp-NN-<slug> (<M> checklist items, contract_slice: [C1, C3]) — and Next: goalforge-harden <wp>.
Add-WP mode (--add-wp <slug> --goal "<outcome>")
Append ONE WP: Steps 2-6 for that WP alone, numbered with the next free NN,
touching no existing WP. Optional overrides for depends_on, severity and
task_type, plus --derived-from <ref> (stamped verbatim as a top-level
derived_from: scalar and a relationships: mirror row) and repeatable
--source <record> (appended verbatim to the feature sources[]) — both
schema-blind: stamped, never parsed. A learning that changes or drops an
existing WP is a restructure: use goalforge-redecompose.
Gotchas
- Folder-level idempotency means editing
spec.mdand re-running does NOT update an already-stamped WP — delete the folder to force a re-stamp. - A live or manual step inside a
strategy: deterministiccommand is the most common decompose defect: harden's V5 lint blocks on it. - The section lint checks H2 names, not line shape: a checklist item citing no behavior id passes it, and only self-check rule 2 catches it.
04 同仓库更多 Skills
wayfind
goalforge-internal — use entry commands; do not auto-trigger Chart a foggy, multi-session effort into a decision map BEFORE goalforge-capture — when the work is too big to spec yet, spans multiple sessions, and needs a decision map before anyone can write a real spec. Triggers: "chart this foggy effort", "multi-session decision map", "too big to spec yet", "map the unknowns before we plan". Establishes <PLANS_ROOT>/<effort>/wayfind/ (map.md pointer-index + one-decision-per-ticket files), drives a frontier-computed work loop across sessions, and graduates the converged map into goalforge-capture. SKIP when the effort is one session and already clear — a single well-understood feature goes straight to goalforge-capture with no map. SKIP for a bounded one-off edit, and for anything already past spec (that is the SDD chain, not wayfind).
verify
goalforge-internal — use entry commands; do not auto-trigger Verify a work package at `status: implemented`: gate A deterministic (lint, typecheck, verification.command, diff ⊆ owned_files), gate B one fresh-context review of the WP diff, gate C goal judge plus one second opinion. Advances `implemented → verified` — the sole authority for that edge. TRIGGER: /verify <wp-path>, or when the chain reaches the verify step.
spec
goalforge-internal — use entry commands; do not auto-trigger Run a design pass on a captured feature and propose the spec document, or propose a revision of an approved spec when a learning falsifies it (the respec edge). Reads plans/<feature>/overview.md, optionally invokes personas or architect for a multi-lens review, writes plans/<feature>/spec.md from the feature-spec template as the proposal (draft → spec), and ratifies it on spec → ready. HUMAN-GATED: spec → ready needs explicit user approval. Trigger: the user asks to spec, design, or elaborate on a feature that already has an overview.md (status: draft), or a feature sits at status: spec with a proposal awaiting ratification.
run
goalforge-internal — use entry commands; do not auto-trigger Chain driver for the goalforge stages: capture → spec → decompose → harden → execute → verify. Reads the target's on-disk `status:` and enters the one step that status admits; supports --dry-run. Use it to drive a feature end-to-end; for a single stage, use the entry command for that stage.
redecompose
goalforge-internal — use entry commands; do not auto-trigger Reconcile a proposed re-decomposition against a partially-executed feature's verified WPs. Calls goalforge-reconcile-diff.sh to produce a 5-bucket diff, then routes: same → untouched (no-op), changed+new → status: spec and onto the harden frontier via goalforge-transition.sh, dropped-verified → supersede in place (ledger row, never delete), ambiguous (slug changed, goal matches a verified WP) → judgment/human — never auto-rename or auto-supersede. Logs goal mutations via goalforge-goal-changelog.sh. Idempotent: re-run on unchanged decomposition is a byte-identical no-op. TRIGGER: /goalforge-redecompose <feature-dir> --learning '<text>' or when goalforge-run loops back on a learning event.
prototype
goalforge-internal — use entry commands; do not auto-trigger Throwaway spike answering exactly ONE design question with runnable code — logic branch (pure logic module + interactive terminal harness, LOGIC.md), UI branch (several radically different variations, UI.md), or perf branch (benchmark study of rival implementations with a scaling curve, PERF.md). Keep the answer, delete the code. Use when an open question is of kind "how should it behave / which approach wins / how should it look / is it fast enough, does it scale, is the optimization worth it" and more interviewing or reading will not settle it — a spike will. Entry points: handoff mode `prototype` (cross-session dispatch seam), goalforge-harden open-question routing, idea-refine, or the user saying "spike this" / "quick prototype to check" / "benchmark this". Refuses to start without a single question AND explicit success criteria.