spec-author
Author a governed SDLC lifecycle artifact — a PRD, RFC, ADR, or User Story (US) — from design output (docs/domain, docs/api, docs/data) into the consumer repo's doc dirs with correct front-matter, then self-validate with `npx govkit verify`. Use whenever the user wants to write/draft/create a PRD, RFC, ADR, or user story, turn a domain model or API/data design into a lifecycle doc, "spec this out", record an architecture decision, or open a governed doc that has to pass govkit. The user picks which artifact type. Trigger even when the user names only the artifact ("write the ADR", "draft a US for this") as long as the output is a governed PRD/RFC/ADR/US doc.
- License 许可
- MIT
- 所属仓库
- baodq97/govkit
- 最近更新
- 2026-09-07
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- spec-author
- description
- Author a governed SDLC lifecycle artifact — a PRD, RFC, ADR, or User Story (US) — from design output (docs/domain, docs/api, docs/data) into the consumer repo's doc dirs with correct front-matter, then self-validate with `npx govkit verify`. Use whenever the user wants to write/draft/create a PRD, RFC, ADR, or user story, turn a domain model or API/data design into a lifecycle doc, "spec this out", record an architecture decision, or open a governed doc that has to pass govkit. The user picks which artifact type. Trigger even when the user names only the artifact ("write the ADR", "draft a US for this") as long as the output is a governed PRD/RFC/ADR/US doc.
- allowed-tools
- Read, Grep, Glob, Bash, Edit, Write, AskUserQuestion
02 资源文件 1
- 参考文档references/artifact-frontmatter.md5.3 KB
03 SKILL.md 正文
Spec Author
Hard rules
- Discover the schema; never hardcode doc dirs or required keys. Read
govkit.ymlevery run. owner: TBDon every new artifact. Propose the human owner in the PR body — never self-assign.- Start status only. PRD
draft, RFCdraft, ADRproposed, USopen(pergovkit.yml). Never write an advanced status; propose advancement in the PR body for the doc owner to flip. - INDEX row must contain the id and the status verbatim — keep it in sync or verify fails.
- Capture only what the design source states. Flag gaps; never invent requirements, decisions, or acceptance criteria. Match neighbour-doc structure in the target dir.
npx govkit verifyis the source of truth — author and call it, never reimplement or bypass it. Fix the artifact until verify is clean.- Never self-approve, self-merge, or act as code owner.
Turn design output — a domain model (docs/domain), an API design (docs/api), a data
design (docs/data) — into a governed lifecycle artifact: a PRD, RFC, ADR, or User Story
(US). This is the keystone that converts design into the doc chain PRD → RFC → ADR → US → Code. You author the artifact and call npx govkit verify to self-validate; you
never reimplement the gate.
The user picks the artifact type. If they haven't, ask with the AskUserQuestion tool — one
structured option per type (PRD, RFC, ADR, US), each labeled with what it captures (the
## Picking the type table below), so the pick is a deliberate structured choice, not a
free-prose ask. If the user already named the artifact ("write the ADR", "draft a US for this"),
take that and proceed without a redundant prompt — don't re-ask. The type drives the doc dir, the
required front-matter, and the start status.
The non-negotiable rules (bake these into every artifact)
owner: TBD, always. Agents never self-assign an owner. Propose the owner in the PR body.- Start status, never advanced. Open at the type's start status (PRD
draft, RFCdraft, ADRproposed, USopen— confirm against the consumer'sgovkit.yml). Never writeaccepted/approved/done/active. To advance, propose the next status in the PR body for the human doc owner to flip. - Update the matching
INDEX.mdrow. A doc with no INDEX row, or a row whose status text is stale, is a verify violation — not a nit. - Discover, don't hardcode. Doc dirs and required front-matter keys come from the
consumer's
govkit.yml, read at run time. Do not assumedocs/adretc. are fixed. - Never self-approve, self-merge, or act as code owner. Your job ends at "ready for review".
Reference (read before emitting)
references/artifact-frontmatter.md— the exact front-matter shape, the per-type start-status table, the id-numbering rule, the INDEX row format, and precisely whatgovkit verifychecks (front-matter completeness + INDEX line-match). Read it so you pass on the first run instead of fixing flagged violations after.
Process
1. Discover the schema from govkit.yml
Find the consumer repo root (the dir holding govkit.yml) and read it. Pull, for the chosen
type: its dir, its full required-key set (docs.base.required ∪ docs.types.<type>.required,
deduped), and its startStatus. These — not any built-in list — define the contract. If there
is no govkit.yml, the repo isn't govkit-governed: tell the user and stop (don't invent a schema).
cat govkit.yml # docs.base.required, docs.types.<type>.{dir,required,startStatus}, docs.ignore
Note per-type differences: a US may require an extra key (e.g. priority) that PRD/RFC/ADR
don't. Take the list from the file every time.
2. Confirm the type and gather source material
Confirm which artifact the user wants: if the type is still unknown, make the pick with the
AskUserQuestion tool (one option per type — PRD / RFC / ADR / US — each labeled from the
## Picking the type table); if the user already named it, proceed without a re-ask. Read the
design output it derives from — the relevant
docs/domain, docs/api, or docs/data files (and any upstream artifact: a US cites its
RFC/ADR; an ADR cites its RFC; an RFC cites its PRD). Capture only what those sources state —
do not invent requirements, decisions, or acceptance criteria the design never describes.
3. Pick the id
Scan the type's dir (filenames and INDEX rows) for the next free number. Use the
conventional prefix (PRD-, RFC-, ADR-, US-) and mimic the dir's existing zero-padding
(US-007 vs US-0007). Don't collide with an existing id.
4. Write the artifact
Create <dir>/<TYPE-NNNN>-<slug>.md. Open with a --- block carrying every required key,
each non-empty:
id,title,date(today) — straightforward.status:= the discovered startStatus (never advanced).owner: TBD— always.- any extra required key the schema lists (e.g.
priority: P1for a US).
Then write the body in the shape the type's neighbours use — mimic an existing PRD/RFC/ADR/US in the dir for section structure. Keep it grounded in the design source from step 2.
5. Update INDEX.md
In the same dir, add (or update) one row for the new doc. Match the existing table's columns
exactly. The row must literally contain the doc's id and its status — that's how verify
checks sync. If the dir has no INDEX.md, create it (header row + this doc's row); a dir with
governed docs but no INDEX is itself a violation.
6. Self-validate with govkit, then fix
Run the deterministic gate from the consumer root and act on whatever it reports:
npx govkit verify # or: npx govkit verify --json for machine output
- OK → done; proceed to step 7.
- FAIL → read each violation and fix the artifact, not the gate:
missing or empty required front-matter key: X→ addX(stillowner: TBD, start status).… has no row in INDEX.md→ add the row (step 5).… INDEX row status is stale→ make the INDEX row's status text match the doc'sstatus.missing INDEX.md …→ create it. Re-runnpx govkit verifyuntil it passes. Never editgovkit.ymlor the CLI to make it pass.
7. Hand off
Surface what you wrote (path, id, start status) and the PR-body proposals the human owner
must apply: the proposed owner: (replacing TBD), and — if the artifact is ready to
advance — the proposed next status:. Link the upstream artifact(s) by id. Stop at "ready for
review"; do not flip status, assign an owner, approve, or merge.
Picking the type (quick guide)
| Artifact | Captures | Start status | Note |
|---|---|---|---|
| PRD | the why/what — product requirements, scope, success metrics | draft |
precedes the RFC for revenue/legal/compliance work |
| RFC | a proposed design/approach for a new feature or public-API change | draft |
accepted before code on feature/public-API changes |
| ADR | an arch/vendor/runtime decision with context, trade-offs, consequences | proposed |
accepted on consensus — a human act |
| US | one user story / backlog item with acceptance criteria | open |
often needs an extra priority key — check the schema |
If the change class needs an artifact the user didn't ask for (e.g. an ADR before code for an arch decision), say so and let the user decide — don't silently skip a gate.
Gotchas
Recurring authoring escapes, seeded from LEARNING-LOOP.md:
- Author at the schema's START status, owner
TBD. Never open a doc ataccepted/done— a doc born past its start status passesverify/evalclean (the gate is stateless), so nothing catches it. The write-time hook only nudges; the human flips later, in a separate commit. - The INDEX row must match the front-matter. Add the row with the SAME
status/owner/dateas the doc; a mismatch is front-matter↔INDEX drift thatverifyblocks on. - A
parent:must resolve. A US/domain doc pointing at a non-existent RFC fails the reference check — write the parent id exactly, and don't mark a childdoneunder a parent RFC that is not yetaccepted. allowed-toolsis an EXCLUSIVE allowlist. If this skill declaresallowed-tools, it must list EVERY tool it uses — a tool left off is silently unavailable, and no gate catches it (AskUserQuestionwas once omitted here, making the type-pick prompt inert).
04 同仓库更多 Skills
trigger-shaped
Use when the user says "plan a sprint retro"; drafts retro/notes.md for the team.
terse-unguarded
Step 2 — writes docs/x/output.json quietly.
guarded
Summarizes ledger totals into reports/monthly.csv.
open
Draft a spec. Use when asked to "draft a spec" or "write the RFC".
guarded
Deploy the thing.
working-discipline
Thinking-checkpoint discipline for substantive implementation, debugging, or autonomous work — 21 trigger-gated items (trigger → mandatory question → evidence to produce) that cut agent error and human escalation. Use before an autonomous or long-running run, when asked to "work carefully", "double-check", "làm cẩn thận", "reduce errors", "be more autonomous", or after looping twice on the same failing fix. NOT a procedure — checkpoints fire on their triggers and demand evidence, with an N/A escape valve so a strong model pays near-zero overhead.