/agent-skills:decompose-specfrom agent-skills
Decomposes a large specification into optimally-sized, dependency-ordered tickets for multi-session builds. Seeds a ledger, contract files, and manifest runbook. Pairs with orchestrate-build.
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turn one large spec into the fewest self-contained tickets that can each be implemented in a single
fresh context — then seed the durable build ledger that orchestrate-build drives to completion.
This is the planning half of a multi-session build. It does not implement anything, create branches, or run code. Its entire job is to answer "what are the units of work, in what order, and where do we cut?" — well, because the decomposition is the ceiling on the whole build: a bad split produces tickets with hidden cross-dependencies that no downstream rigor can recover from (the multi-session analogue of "the build is only as good as its spec"). Treat this as the highest-leverage, highest-rigor step, not a formality.
When to use: a spec too large for one focused implementation run, that you intend to ship as a chain of reviewable PRs across multiple sessions. For a spec that fits one sitting, skip this and run
implement-specdirectly. The per-ticket worker in both cases isimplement-spec.
Minimize the number of tickets N, subject to — for every ticket:
It fits one fresh-context implement-spec run with rigor headroom. The ticket's working set (its spec
slice + the code it must read + the tests + the self-review/gap/verify passes implement-spec runs inside
it) stays well under half the context window of the recorded worker (Phase 0.0). For the baseline,
Opus 5.5 at 1M tokens, that is a working set of roughly 350K tokens or less. Whether overflow is soft or hard
depends on whether that worker can compact:
headless, manual, and subagent on a harness whose sub-agents auto-compact. On Claude Code,
sub-agents auto-compact as their own context nears the auto-compact window, and nest three levels below
the main session by default (CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH; 1 turns nesting off). The worker
compacts, trading gap-analysis fidelity for survival; the margin exists so it rarely has to.subagent on a harness whose sub-agents can't compact: treat one window as a hard limit and
size conservatively, because a ticket that overflows fails.On Claude Code v2.1.334 and later a native-1M model compacts on auto near 400K tokens (about 367K) unless
the worker starts with --autocompact 1M (or CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000); the ~350K target
keeps a baseline ticket under that line either way. A smaller worker window scales the target down with it.
It is one coherent, independently landable concern — a single logical thing that stands alone as one CI-green PR, traceable to spec section(s). Soft proxies (not laws): ~one focused change, on the order of a few files and a few hundred lines. A large mechanical rename can be far bigger and still trivial; LOC is a proxy for cognitive size, not the target.
It respects the dependency order — a ticket never forks from work that hasn't landed yet.
Its boundaries fall on the weakest-coupling seams — cut where two units share the least (few cross-references, no shared implicit decisions), so each cut creates the fewest integration seams the capstone must later reconcile. High cohesion within a ticket; low coupling across.
The two bounds you are balancing:
So the balance is precise: make each ticket as large as rule 1 safely allows, then stop splitting the moment a
cut would sever a shared implicit decision. granularity only nudges where inside that safe band you land.
worker and dispatch_target were passed, ask the operator — with AskUserQuestion or
the harness's equivalent, a plain question where it has none — for the missing one: which harness, model,
context window and effort the ticket workers will run, and which dispatch tier. Recommend the baseline:
Claude Code, Opus 5.5 with the 1M context window, high effort, headless
(claude-code/claude-opus-5-5[1m]/high). A non-interactive run (no one to ask) uses the baseline and records
it as assumed, not confirmed. mode=extend reuses the worker the ledger records and asks only when there
is none (a ledger written before this field) or the operator says the worker changed. Record the result in
both places the plan keeps its parameters (Phase 5): the ledger's
dispatchTarget: <tier> · worker=<harness>/<model-id>/<effort> · window=<tokens> · <confirmed|assumed>
(the baseline: headless · worker=claude-code/claude-opus-5-5[1m]/high · window=1M · confirmed), and a
## Decomposition decisions line in the manifest with the same values, the size target it implies, and the
operator's answer verbatim (or "assumed: non-interactive run"). Any per-ticket effort override the operator
names (e.g. xhigh for the hardest tickets) goes on that line too, by ticket id.For a large spec, this reading is itself broad: you MAY fan out read-only subagents over subsystems (reading is safe to parallelize; only writes must stay single-threaded). Each returns a compact map of its area's seams and dependencies.
In mode=extend (a re-planning round on an existing build), also read the current build state before
cutting: docs/build/LEDGER.md (what has landed, chainTip, round), docs/tickets/DEFERRALS.md (owed work
that a new round may close), docs/research-ledger.md §Q (operator decisions), and docs/build/BACKLOG.csv
(carried debt). Also read the open stack's CI state (orchestrate-build/scripts/ci-boundary.sh --ledger docs/build/LEDGER.md --stack --no-wait — BM-CI-01) and the latest operator digest under
docs/build/reports/digests/ (BM-DIGEST-01; orchestrate-build/scripts/digest.sh writes one if none is recent), so
a round is never planned on top of red PRs. The new round's tickets fork from the current chainTip; you open a new
numbered round banner in the manifest's chain table, append under it and to ## Plan extensions, and never rename
an existing ticket file (BM-COMPAT-05).
A run-time insert is a scoped extend. When orchestrate-build needs a ticket inserted mid-round (a red-CI
fix, an operator-requested production change, a split), run mode=extend on just that scope: Phase 3 writes its
contract, Phase 4 reviews it in a fresh context, and it lands as a suffix-letter file (16a_…) under the current
round banner with a ## Plan extensions line — never a contract drafted ad hoc at a boundary (BM-MANIFEST-03).
Before cutting, understand the structure you are cutting:
Apply the objective. Produce, as a table, one row per ticket:
| Ticket | Scope (spec §§) | Files/anchors | forks-from / PR-base | Acceptance (deterministic / agentic) | Tests |
Rules for filling it:
T1..Tn so every forks-from points at a ticket that lands earlier (no forward
references). Chained tickets fork from the previous ticket's branch (the chainTip at run time); the PR
--base is that same branch so each PR diff is exactly one ticket.chainTip and
record their dependency as informational.build-memory's templates/HUMAN.md / templates/GATE.md):
human prerequisites (NN[a-z]_HUMAN-H<k>__<slug>.md — account registrations, outreach, procurement, work
only the operator can do; listed so the chain never silently blocks on them) and milestone gates
(NN[a-z]_GATE-G<k>__<slug>.md — a hard synchronization barrier or a pre-registered go/no-go, its thresholds
quoted verbatim from the spec and recorded before the gated work begins). Neither is an implement-spec
input: they do not advance chainTip. A gate is a pause, not a block — it is dispositioned by the operator
(recorded in the ledger's GATE DECISIONS + a readouts/GATE-G<k>.md) and never guessed past; a pending gate is
a RETURN PASS row, not a blockedOn. HUMAN rows are scheduled like tickets: each names an owner and a
target date -u or trigger ticket (BM-TICKET-05), and the tickets that depend on it list the claims they withhold.decision row into GATE DECISIONS. An authorization the operator gives at planning time is recorded as a
pre-authorization row (the operator's words verbatim, explicit item ids, expires:, voided-by:) — never a
blanket rule (BM-LEDGER-04).Kind: skeleton,
a > Skeleton only banner naming the gate, and only the header + ## Scope (one line) + ## Spec §§ +
## REQ coverage. A skeleton carries no run line — the validator refuses to run one and implement-spec
stops if asked to.worker and dispatch_target (rule 1) for every row (Phase-4 review
re-checks this explicitly).implement-spec diffs its work against a contract. If the spec already states a precise per-ticket contract,
reuse it. Where it only gives loose scope, author the missing contract for each such ticket — concrete enough
that a fresh context can implement against it without re-deriving the design:
Keep the cross-cutting invariants and out-of-scope list from Phase 0 at the top of the contract set — every ticket's gap-analysis re-checks them. If the spec is so underspecified that contracts cannot be derived (no decomposition and no derivable design), that is design work, not decomposition: stop and tell the operator the spec needs a design pass first — do not invent a design.
Each contract is its own file, from build-memory's templates/ticket.md (BM-TICKET-01) — written to the
tickets directory (committed mode: docs/tickets; otherwise the gitignored scratch dir) as
NN[a-z]?_<ID>__<slug>.md when sequence_prefix is true (the global sequence, zero-padded so lexical order is
chain order), else the legacy T<nn>__<slug>.md / P<phase>.<k>__<slug>.md. It carries the template's full
header (sequence, phase, kind, base_branch: current checkout, depends-on, the literal Run: line, Gate status, Live stage, Production mutations, Size budget) and body sections — ACs tagged with the layer they
must reach, a ## Operating clauses section citing the manifest's ## Operating rules — ending with the universal
phase-gate AC (BM-TICKET-02), so a fresh worker loads one small file and nothing else. A ticket over its size
budget is split here, before it is written. Two disciplines make the layout safe:
The partition is the ceiling on the build, and the context that just authored it is a biased reviewer of it. Run a fresh-context critique — a subagent given only the spec, the plan, and the invariants where the harness supports subagents; otherwise the explicit discipline of re-reading the spec and plan from disk and arguing each judgment from what is there, not from memory of authoring it. Hunt specifically for:
forks-from references.Revise the plan until the critique is clean or the remaining tradeoffs are consciously recorded. The plan is a
starting point, not a contract in stone: orchestrate-build may split an overflowing ticket or merge trivial
ones at run time and write the change back to the ledger. Note that explicitly so a later session knows the plan
is revisable.
build-memory owns the layout; decompose-spec fills it. Everything below cites
skills/build-memory/layout.md and does not restate the tree. If ledger=false, skip every write and present
the plan + all sections to the operator instead.
Where docs/ is (BM-ROOT-03). Resolve the root first: bash skills/build-memory/scripts/memory-root.sh --paths --allow-missing. In a monorepo subproject (BUILD_MEMORY_ROOT=<sub>/docs/build) every docs/build/…,
docs/tickets/…, docs/adr/… and docs/… path in this phase is the same path under <sub>/ (the printed
root=, tickets=, adr=, docs=), and the ledger's path values are written toplevel-relative —
manifest: <sub>/docs/tickets/00_MANIFEST.md, memoryRoot: <sub>/docs/build, run lines
implement-spec spec=<sub>/docs/tickets/<file> — so an agent at the worktree toplevel opens them directly (the
validator resolves both forms). With BUILD_MEMORY_ROOT unset these are the literal docs/… paths, unchanged.
1. Initialise the layout. Invoke the build-memory skill in init mode (idempotent — never overwrites an
existing file). In committed mode this creates docs/build/{README.md (with the marker), LEDGER.md, BUILD_INDEX.md, logs/.gitignore}, docs/adr/{README.md, _TEMPLATE.md}, docs/tickets/{_TEMPLATE.md, DEFERRALS.md}, the AGENTS.md build-memory section and the docs/README.md rows. A repo that has not opted
in stays in scratch mode — byte-for-byte the 0.1.x behaviour (a gitignored ${build_name}-build-ledger.md and a
scratch tickets dir); everything below still applies, minus the commit.
2. Write the state-only ledger (docs/build/LEDGER.md, from the template, BM-LEDGER-01/02). It holds
state only — the manifest is the plan. The CURRENT STATE fenced block carries exactly the keyset in layout
order (projectStatus … round … updatedAt); seed projectStatus: NOT_STARTED, nextTicket: SETUP,
manifest: docs/tickets/00_MANIFEST.md, canonicalSpec, memoryRoot, dispatchTarget (the Phase 0.0 worker
line), round: 1, updatedAt from date -u.
Below it: empty OPEN FINDINGS, RETURN PASS tables, a GATE DECISIONS table holding nothing but
pre-authorization rows (if the operator gave any), and, last, ## PHASE LOG — Round 1 with one seed entry
(ROUND1 round: spec, ticket count, tail, "the plan is revisable at run time"). No PHASE PLAN / SETUP /
CAPSTONE sections — those moved to the manifest (the plan) and to tail tickets.
3. Write the per-ticket contracts (Phase 3) and the manifest.
4. Write docs/tickets/00_MANIFEST.md from the template (BM-MANIFEST-01), the human-facing runbook that
makes the chain self-driving without the ledger: the three banners (committed contract record; cite-don't-copy
with the spec amendment protocol; deferrals companion), a companions: line and an optional req_id_pattern:
line, ## How to build (the four rules + the run-line pattern), ## Human prerequisites, ## The chain
(| # | file | phase | kind | scope | gate |, HUMAN/GATE marker and skeleton rows interleaved in order, every row
under a numbered round banner ### Round <n>; mode=extend opens the next banner and appends under it),
## Milestone gates, ## Phase gates & ownership notes, ## Cross-cutting invariants, ## Operating rules
(the template's short forms plus the project's own OPERATING MODE rules), ## Out of scope,
## Requirement-ID → ticket index, ## Spec amendments applied, ## Decomposition decisions (incl. the Phase-4
adversarial review record), ## Plan extensions.
5. Append the tail (BM-TAIL-01) when the chain has more than one implement-spec ticket: instantiate
build-memory's templates/tail/ — tail=minimal (default: CAP.1, CAP.3, GATE-ACCEPT, DOC — CAP.3 then depends
on CAP.1) or tail=full (CAP.1, CAP.2, CAP.3, GATE-ACCEPT, REC.1, REC.2, REC.3, DOC.1, DOC.2; record why in
## Decomposition decisions) — filling the placeholders ({{build_name}}, {{spec_path}},
{{req_id_pattern}}, {{ticket_count}}, {{last_ticket}}). Each becomes an ordinary chain row (kind capstone
| reconcile | docs). tail=none is refused when N > 1. The capstone is tickets — there is no CAPSTONE ledger
section.
6. Persist the hand-off when this run was invoked from a docs/decomposition-prompt.md — keep that file as
the frozen record of the exact invocation and binding constraints.
7. Validate. Run bash skills/build-memory/scripts/check-build-memory.sh . (with BUILD_MEMORY_ROOT set in a
subproject) — it must exit 0 (layout, ticket
grammar + unique sequence, manifest ↔ files, backward deps, skeletons w/o run lines, DEFERRALS, ADR index, ledger
keys, REQ coverage). A failure is a real block: fix the seed, don't hand off a red layout. In committed mode,
this is the state orchestrate-build commits at SETUP.
Ticket files cite the spec; they never copy the design (a restated design forks the spec, and the drift
arrives with the first amendment). To change a requirement: amend the source spec first; bump its
version/delta; requirement ids are append-only; add a ## Spec amendments applied manifest line (date,
section, before/after or pointer, approver); write an ADR when a design decision changes; then update the
affected tickets' Load/AC lines (executed contracts get an appended > Amended <date -u +%F>: note, never a rewrite).
Print a concise summary: the ticket count and the one-line scope of each, the worker and dispatch tier the tickets were sized for (confirmed or assumed), the chain shape (with out-of-chain rows called out), any conscious tradeoffs from Phase 4, the ledger path, and the exact next step:
▶ To build: run orchestrate-build with ledger=<path> (it will SETUP, then drive each ticket via implement-spec).
Also print the manual floor — it needs no orchestrator at all:
▶ Or by hand: in a fresh session, run implement-spec spec=docs/tickets/<first ticket file>
then, per docs/tickets/00_MANIFEST.md, chain the next file from the branch each ticket leaves checked out.
Each worker closes its own ticket in docs/build/LEDGER.md (committed mode), so the chain advances with no orchestrator.
Report the validator result (check-build-memory.sh exit 0) as part of the hand-off. Do not create worktrees,
branches, or run anything — that is orchestrate-build's job.
orchestrate-build at
SETUP; the ledger leaves placeholders.What SKILL.md sets; muted values are Claude Code's defaults
12 skills in this plugin
/address-pr-commentsWork through unresolved review comments on your PR as the author: triage every thread, implement fixes where the reviewer is right, push back with rationale where they aren't, answer questions, commit + push, and reply to every thread with what happened. Use when asked to address, respond to, or resolve PR review feedback./agent-docsCreate or converge agent documentation (AGENTS.md hierarchy) for a codebase — bootstrap mode generates docs from scratch, refresh mode detects and fixes drift/audit-buildIndependent, fresh-context critical re-review of tickets that have already landed in a multi-session build. It covers the last N tickets, every ticket since the previous audit, named tickets, or a git range. Each ticket's acceptance criteria are re-checked against the code, tests and evidence, and claims are compared with what is verified. Faked or weakened checks, cross-ticket duplication and sole-owner violations are hunted down. Every finding is verified before it is reported, and fixes are routed through the build's own repair mechanisms. It also has an evaluation mode: a pre-registered, blinded measurement study of an implementer's work, which estimates how much auditing is actually needed, where and why. Use it to keep cheaper implementation models in check with periodic review by a stronger model, and to decide on evidence how often that review should run. Read-only on the build; never fixes, merges or edits landed records./build-memoryOwns the build-memory contract that the multi-session build skills share: the committed layout under docs/build/, docs/tickets/ and docs/adr/, the templates, the validator, and legacy-scratch migration. Use it to initialise the layout in a repo (init), validate it (check), migrate a legacy gitignored scratch dir into the committed tree (migrate), or regenerate the ADR index (adr-index). Other skills cite skills/build-memory/layout.md rather than restating the layout./implement-specSpec-driven, autonomous end-to-end: branch → plan + test matrix → implement (tests alongside) → self-review → gap-analysis vs spec → close gaps → rigorous downstream verification → PR + evidence report/orchestrate-buildDrive a decomposed spec to completion across fresh contexts: SETUP a dedicated worktree, run each ticket end-to-end through implement-spec in a fresh context, update the durable ledger, report progress, pause for intervention at ticket boundaries, and finish with a whole-build capstone verification. The execution half of a multi-session build; pairs with decompose-spec.Generated from the plugin's indexed repository (stevevitali/agent-skills) — no native marketplace selected
npx claudepluginhub p/stevevitali-agent-skillsOther plugins' skills for the same job