/spec-builder:spec-builderfrom spec-builder
Generates structured requirements contracts under docs/specs/ from raw input (ideas, notes, transcripts, PRDs, codebases). Produces stable FR IDs, Given/When/Then acceptance criteria, assumptions, open issues, a confirmation sheet, and a JSON index for agents. Never invents requirements.
Ships in spec-builder. 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.
Produces the requirements contract: linked, numbered sections under docs/specs/, traceable from
user story to feasibility row, with no invented requirement in them.
The sections are real files. scripts/scaffold.py installs them from assets/specs/ with their
headings, tables, Mermaid scaffolds and inline authoring notes. Your job is the content and the
judgment - elicitation, the FR list, priorities, security posture, feasibility. Never hand-write a
template's shape.
Not every project gets every section. The core is always installed: README, 01-overview,
03-glossary, 05-functional-requirements, 07-non-functional-requirements,
11-assumptions-constraints, 13-revision-history. The rest are selected by what the material
contains; an empty section erodes trust in the filled ones. Section numbers never shift. A repo
whose product is not code gets the light contract instead: README, 05, 11 and 13, each item an
FR-nn with Done when criteria.
Never invent a requirement. Anything a stakeholder did not state and the source does not clearly
imply goes to section 11 as an assumption (AS-nn) or open issue (OI-nn) and is flagged in the
final summary. Why, and the tell that you are about to do it:
reference/elicitation.md.
1. Read the sources (when the user brought files). scripts/route_sources.py <files-folders-urls> -o plan.json picks a reader per source; scripts/ingest.py executes the plan. Show the plan first -
one line per source (file -> reader, or UNREADABLE -> why and the fix) - then read; report nothing
else until the final summary. An unreadable source becomes an OI-nn in section 11 naming the
file and the fix, never a silent gap. Readers, overrides and limits:
reference/source-routing.md.
2. Elicit - reference/elicitation.md. Infer structure, ask for
decisions: priorities, permission scope, NFR targets, volumes and security posture are always
asked. One AskUserQuestion call per batch; skip anything the user or the sources already answered.
3. Confirm the FR list and the sections - one gate, before writing anything else. Show the FR
list with proposed MoSCoW priorities, the roles, and the open issues so far. Full contract only:
recommend each optional section when the material shows it is real (stakeholder map -> 02, process
handoffs -> 04, roles with scopes -> 06, owned persistent data -> 08, external systems -> 09,
screens -> 10, buildability risk -> 12, a design system -> 14) with elicitation's setup batch. Then
write <target>/docs/specs/.sections.json: every optional section in selected or excluded
exactly once, each with a one-line reason. The scaffolder refuses to run without it, on an empty
reason, or when it contradicts vars.json. Everything downstream derives from this gate.
4. Scaffold.
python scripts/scaffold.py --target <repo> --vars vars.json --dry-run # review first
python scripts/scaffold.py --target <repo> --vars vars.json
{
"vars": {"PROJECT_NAME": "...", "PROJECT_SLUG": "...",
"PROJECT_PURPOSE": "one line, the user's language", "DOC_OWNER": "..."},
"flags": ["ai", "ui", "db", "flows", "access", "integration", "feasibility"]
}
purpose_code, purpose_research,
purpose_strategy, purpose_docs. A non-code purpose without purpose_code scaffolds the light
contract, needs no .sections.json, and refuses section flags. None means the full set.stakeholders, flows, access, db (08), integration, ui (10),
feasibility, design (14).ai switches on the AI/human boundary in 05, the untrusted-content NFRs in 07
and model feasibility in 12; ui and db also gate blocks inside other sections. Set only what is
true.The scaffolder never overwrites a file: ADDED, KEPT (identical) or CONFLICT. CONFLICT is
the reconciliation queue - resolve each by hand, never delete what the user wrote. An unresolved
{{VAR}} fails the run.
Module form, when the product has real module boundaries or the user asks for one module's spec
("the spec for billing" -> code BLG): --module BLG:billing --module CAT:catalog. Every ID that
module defines carries its code (FR-BLG-01); bare IDs inside a module folder are forbidden. Layout
and ID rules: reference/writing-rules.md.
5. Fill, section by section, following the inline <!-- --> notes and
reference/writing-rules.md (read it first; it has the folder split
rule). Once 05 is confirmed, independent sections (02, 04, 09, 10) may go to agents dispatched in
ONE message; check their IDs and links against 05 before accepting. 05, 07 and 12 stay in the main
session - they carry the judgment and are the three most often thinned out:
{#fr-nn}, with input/output, business rules (BR-nn with
a source) and acceptance criteria including a negative case; then UC-xx, US-xx and the
traceability matrix.reference/ba-standards.md.6. Verify and confirm. python .claude/scripts/spec-check.py --write (add --lang ja for a
Japanese reader) regenerates docs/specs/confirmation.md (the page the PO answers yes / no /
change) and docs/specs/index.json (what agents read first), then checks IDs, criteria, open
issues and staleness. Fix every FAIL, then the quality gate below. Hand the sheet over with the open
issues. When it comes back, re-run --write (replies are kept), fold each change in through
/spec-ingest, and set Status: Confirmed on each yes with one revision row.
Then, if the harness scripts are installed, python .claude/scripts/docs-graph.py --check lists
orphan IDs - name each as unstarted work or a dead reference.
7. Hand off. Offer to invoke harness-bootstrap through the Skill tool with FR_LIST (05's FR
IDs, verbatim, in order) and GLOSSARY_SEED (03's terms); state the handoff in words without the
tool. The spec is its input contract: 05 clusters into the dev roster, 08 sets db, 10 sets ui, 07
sets ai and deny strictness, 12 seeds the Phase 1 backlog (ba-standards.md Part 3). If the full
docs workspace exists, seed once 03 and 05 are filled: one docs/requirements/PRD-FR-NN-<slug>.md
stub per FR linking back to 05's anchor, docs/context/glossary.md from 03,
docs/context/business-rules.md from 05's BR tables. Seed, do not duplicate - the spec stays
the source of truth.
/spec-ingest <source> folds new input into existing sections: statement-by-statement diff,
conflicts surfaced never overwritten, IDs appended never renumbered, one revision row. Follow it
even when the command file is not installed./spec-retract <source|ID|claim> traces what a bad source touched, converts unsupported
statements to OI-nn, marks withdrawn IDs in place, and blocks affected tasks.excluded to selected in .sections.json with the reason
that changed, set its flag, and re-run scaffold.py.A confirmed FR then enters the agentic loop with its criteria as the oracle; most changes need no
spec work at all. The step table and the proportion rule:
reference/agentic-loop.md. The standards this synthesizes (ISO/IEC/IEEE
29148, ISO/IEC 25010, BABOK, OWASP ASVS and LLM Top 10) and their limits: ba-standards.md.
spec-check.py exits 0 first. Then what it cannot decide:
docs/specs/ against
.sections.json); any AS-/OI-/CO- ID implies section 11 defines it.TBD (grep \|\s*\| and TBD) unless the cell reads
<unknown - OI-nn>; section 07's security subsections are all filled.DS-nn row in 14; every role
in 06 exists in 03 and every entity in 06 in 08.OI-nn.-.CHANGELOG.md (opens in a new tab)README.ja.md (opens in a new tab)README.md (opens in a new tab)assets/commands/spec-ingest.md (opens in a new tab)assets/commands/spec-retract.md (opens in a new tab)assets/light/05-functional-requirements.md (opens in a new tab)assets/light/README.md (opens in a new tab)assets/manifest-light.json (opens in a new tab)assets/manifest.json (opens in a new tab)assets/scripts/spec-check.py (opens in a new tab)assets/specs/01-overview.md (opens in a new tab)assets/specs/02-stakeholders.md (opens in a new tab)assets/specs/03-glossary.md (opens in a new tab)assets/specs/04-business-flows.md (opens in a new tab)assets/specs/05-functional-requirements.md (opens in a new tab)assets/specs/06-access-control.md (opens in a new tab)assets/specs/07-non-functional-requirements.md (opens in a new tab)assets/specs/08-data-model.md (opens in a new tab)assets/specs/09-integration-interface.md (opens in a new tab)assets/specs/10-ui-ux-wireframes.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nguyenhx2/agent-harness-bootstrap --plugin spec-builderOther plugins' skills for the same job