Skip to content

refactor(aidd-pm): rewrite the spec skill in the generator's format and check the spec it writes - #1338

Merged
blafourcade merged 15 commits into
nextfrom
refactor/spec-skill-format
Nov 25, 2026
Merged

blafourcade merged 15 commits into
nextfrom
refactor/spec-skill-format

Conversation

@blafourcade

@blafourcade blafourcade commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🎯 What & why

aidd-pm:04-spec is rewritten in the skill generator's format, and the spec it writes is checked against its contract: its shape by a script, its content by one reference.

🛠️ How it works

  • SKILL.md: a diagram and three transversal rules. Two modes, named in the description: create (build) and update (refine).
  • Build writes the spec first, then ends with at most three open gaps as questions. Too vague to draft: one question, no write.
  • Refine applies each finding in its section, leaves the others, and answers by filling assets/refine-answer.md: the path, a diff of the changed lines, any other section that breaks the content reference, unchanged.
  • Inputs: build takes a need, wherever it is written (message or file); refine takes a spec and the changes to apply. No case per source: spec-content.md says what each section holds. A ticket is fetched by the caller, as the SDLC does.
  • references/spec-content.md: one table, what each section holds and never holds. Replaces tbd-marker.md and spec-validator.yml, which nothing read.
  • A spec carries status: draft or status: locked. Refine writes nothing on a locked spec; only its approver sets that status.
  • scripts/contract.json checks shape only, never content:
Rule Refuses
SPEC-01 a required section missing or out of order, a status other than draft or locked, a comment or slot left
SPEC-02 a locked spec that still holds an Open Questions section
SPEC-03 an Open Questions line not written - TBD: <question>
  • Open Questions is dropped once nothing is open, instead of a None marker a model wrote as - None.
  • Whether Done-when names a test command, or a spec names an implementation, stays a judgment in the reference: a list of commands is never complete, so no script checks it.

🧪 How to verify

  • node --test scripts/__tests__/check/spec-contract.test.js: 8 pass. Each rule's test failed before its code and fails again when the check is disabled.
  • node scripts/check/run.cjs and validate-skill.cjs plugins/aidd-pm/skills/04-spec exit 0.
  • Real hosts, isolated runs, on the final skill:
Case Claude Code haiku OpenCode deepseek-v4.1-flash-free
Create from a request passes, 2 gaps asked, a failed case in Done-when passes, 3 gaps asked
Update with answers answers placed, Open Questions dropped same, flags the npm test Done-when it left
Update a locked spec no write no write
  • aidd-orchestrator:01-sdlc on haiku, "Let users delete a todo" in an empty repo: frame, spec, plan, implement, assert, review, challenge, four commits. It stopped only at the pull request, the repo having no remote. The spec held no test command in Done-when, and the choices made without an answer went to Context.

⚠️ Heads-up

🔗 Linked issue

Part of #1164

🤖 Generated with Claude Code

https://claude.ai/code/session_01XeK3mDBqVCeeSgD36xKnAf

blafourcade and others added 3 commits November 24, 2026 19:25
…nd check the spec it writes

The router keeps only its diagram and transversal rules, each action step is one
sentence, and build and refine run validate-spec.cjs on the spec they write.
SPEC-01 holds spec.md to its template; the aidd-pm turn-end hook applies it too.
The weighted spec-validator.yml, read by no file, is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RY5w5YEbGF6DpKkbU9uyJS
… respects

A spec now carries status: draft or locked in its front matter, and SPEC-01
refuses any other value. Refine reads it first and writes nothing on a locked
spec; only the person who approves a spec locks it. Build maps a PRD's headings
to the spec's sections and takes a hard constraint only from its Dependencies.
The vague "few acceptance criteria" rule is dropped, and the argument hint names
the findings refine needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RY5w5YEbGF6DpKkbU9uyJS
…ailure case

A locked spec must have no open question left, checked by SPEC-02. Build
asks at most three questions on the gaps that change the target most,
and goes on with the gaps when no user can answer. Every hard constraint
is proven by a Done-when condition, Done-when covers a refused or failed
case, and a request holding several outcomes keeps one and lists the
others as Non-goals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RY5w5YEbGF6DpKkbU9uyJS
blafourcade and others added 12 commits November 25, 2026 07:07
…ne content reference

The description names both modes, build writes the spec first and asks its open
questions after, and the per-section judgment moves to references/spec-content.md,
replacing the TBD marker reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A model wrote the empty marker as a bullet, `- None`, which a locked spec then
failed on. Omitting the section leaves nothing to spell. A refine now answers
with each changed line as a diff and names any other section that breaks the
content reference, without changing it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A refine trial added a bare question to Open Questions and the contract let it
through, since the template checks headings, not lines. SPEC-03 holds every line
of that section to `- TBD: <question>`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An SDLC trial on a small model wrote `node --test` passes as a Done-when
condition. SPEC-04 refuses a test runner or a tests-pass phrase there: the plan
and the assert step own how a condition is checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeK3mDBqVCeeSgD36xKnAf
A list of test runners can never be complete. The contract checks only a spec's
shape; whether Done-when names a command stays a judgment in spec-content.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeK3mDBqVCeeSgD36xKnAf
…answer template

Build no longer maps a PRD's headings: spec-content.md says what each section
holds, whatever the source calls it. Refine fills assets/refine-answer.md, a diff
of the changed lines. The gap definition moves into the Open Questions row, and
the locked-spec sentence goes, since SPEC-02 checks it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeK3mDBqVCeeSgD36xKnAf
… one

The skill no longer tells a request from a document, or review findings from
answers: build reads the need wherever it is written, and refine applies the
changes it is given.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeK3mDBqVCeeSgD36xKnAf
Build asks only when no outcome can be named, and writes to the first folder
that exists in an ordered list. Refine stops before writing when no change
applies, and its answer template carries the open questions the transversal
rule asks for. The template's title slot holds one name, and a non-goal is
decided, while an undecided item is a gap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeK3mDBqVCeeSgD36xKnAf
Both trial models refused to rewrite a locked spec, then offered to flip its
status on confirmation. The rule now forbids changing that status or offering
to.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeK3mDBqVCeeSgD36xKnAf
@blafourcade
blafourcade marked this pull request as ready for review November 25, 2026 15:03
@blafourcade
blafourcade requested a review from a team as a code owner November 25, 2026 15:03
@blafourcade
blafourcade merged commit ede9c4c into next Nov 25, 2026
38 checks passed
@blafourcade
blafourcade deleted the refactor/spec-skill-format branch November 25, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant