agentleFS
b310-digitalb310-digital/speculatius/skills/spec-write/SKILL.md

spec-write

Skill3 starsChanged 9 days agoMITView on GitHub

Write or update a living capability spec in docs/specs/ through a short interview, with EARS requirements and Given/When/Then scenarios that carry stable IDs. Two optional steps frame the spec. At the start it explores a rough idea, with --explore or when the capability is unclear, by fanning out subagents and merging their findings into options. At the end it writes the change plan and has it reviewed in a fresh context, with --plan or after asking the user. Use before any change to observable behavior, before starting implementation of a change, when the user asks for a plan, implementation plan or plan review, when the user asks to spec, specify or describe a feature or capability, add or change a requirement or scenario, document existing behavior, or when a spec is over budget and needs splitting. Also use when the user has a vague idea, an unclear problem or several possible directions, asks to explore, brainstorm, think through or compare approaches, or asks whether something is worth building.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. HHU3637kr/skills★ 150same name
    2. telefrek/vallorcine★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository6 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Never run spec-init yourself.

    line 30
  2. Very specific:

    Never create AGENTS.md, the glossary or docs/architecture.md.

    line 35
  3. Distinctive:

    Read the glossary if there is one, the target spec if it exists, and neighbouring specs to avoid overlap.

    line 39
  4. Distinctive:

    Run the interview below.

    line 41
  5. Distinctive:

    Ask only what is needed to write the spec, without wearing the user out.

    line 45
  6. Very specific:

    Stop: when nothing blocks writing, when the user says enough, or after 8 questions.

    line 50
  7. Distinctive:

    No interview: when the request is already clear.

    line 51
  8. Distinctive:

    Do not ask about implementation (data structures, endpoints, UI layout).

    line 52
  9. Distinctive:

    When the user asks to spec something that already exists, read the code and its tests instead of interviewing.

    line 56
  10. Very specific:

    Write only behavior the code shows.

    line 58
  11. Very specific:

    Use template.md in this folder.

    line 63
  12. Very specific:

    User's view only: No data structures, languages, file names, endpoints or UI clicks.

    line 73
  13. Distinctive:

    Every requirement has at least one scenario.

    line 84
  14. Very specific:

    Run the checker if Node is available: node <spec-check skill>/scripts/check.mjs <repo-root>, as described in spec-check.

    line 94

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

spec-write

A spec is a non-technical description of one capability: why it exists, what it must do, and examples that prove it. It describes the system as it is on main.

Two optional steps frame the spec, each in its own file in this folder: the exploration at the start (explore.md) and the change plan at the end (plan.md). Read each file only when its step runs.

Explore first?

Decide this before anything else, and before creating any folder. Explore first in either of these cases:

  1. The user passes --explore, even when the request names a clear capability.
  2. The capability is unclear: the user is choosing between directions, cannot name the capability, or asks whether the idea is worth building. Tell the user in one line why you explore first.

To explore, read explore.md in this folder and follow it. It ends by returning here, by continuing with plan.md, or by naming another skill. In every other case, skip explore.md and continue below.

Plan only?

Skip the spec and go straight to plan.md in this folder in either of these cases:

  1. The change has no observable behavior change, such as a refactor.
  2. The spec for the change is already written, and the user asks for the plan or for a plan review.

Missing setup

Never run spec-init yourself; the user decides. Create only what this spec needs:

  • docs/specs/ if the folder is missing.
  • docs/specs/.spec-config.yaml if it is missing, with one last_scenario_id entry per area. If specs already exist, set each area to its highest ID in docs/specs/.

Never create AGENTS.md, the glossary or docs/architecture.md. If one is missing, tell the user in one line that spec-init creates it, and continue.

Before writing

  1. Read the glossary if there is one, the target spec if it exists, and neighbouring specs to avoid overlap.
  2. Take the next scenario ID per area from docs/specs/.spec-config.yaml: last_scenario_id plus one. Write the new number back in the same change. Never reuse an ID and never lower last_scenario_id, even when a scenario is removed. A new area prefix (e.g. BILL) is agreed with the user and added to the file.
  3. Run the interview below.

Interview

Ask only what is needed to write the spec, without wearing the user out.

  • Look before asking. Answer what you can from code, existing specs, the glossary and the conversation, including an exploration summary (.speculatius/*-exploration-*.md) if there is one for this idea. Never ask what the repo already tells you; state it as an assumption instead.
  • Ask the biggest gap first: purpose, non-goals, triggers and failure behavior, concrete scenario values, terms.
  • One question per turn, at most three if they are tightly related. Offer a recommended answer or 2–4 options, so the user can reply with one word.
  • Stop when nothing blocks writing, when the user says enough, or after 8 questions. Anything still open goes under ## Open questions; it must be resolved before implementation, not now.
  • No interview when the request is already clear. Say so and write the spec.
  • Do not ask about implementation (data structures, endpoints, UI layout). That belongs in the plan.

Existing behavior

When the user asks to spec something that already exists, read the code and its tests instead of interviewing. One capability at a time.

  • Write only behavior the code shows. Anything you are unsure of goes under ## Open questions.
  • Where an existing test already proves a scenario, propose adding the @<ID> tag to it. List scenarios without a test; do not write tests yet.

Format

Use template.md in this folder. Exact anchors:

  • ## Purpose, ## Non-goals, ## Requirements, optional ## Open questions
  • ### Requirement: <name>: requirement names are identifiers, rename only deliberately
  • #### Scenario: <AREA>-<NNN> <name>
  • Steps as bullets with bold keywords: - **GIVEN**, - **WHEN**, - **THEN**, - **AND**
  • File name: kebab-case capability name, no numbers, no dates: docs/specs/billing-retries.md

Content rules

  • User's view only. No data structures, languages, file names, endpoints or UI clicks. Those go to architecture.md, a decision record, or test code.
  • Purpose first in 2–4 sentences. Non-goals are mandatory.
  • Requirements: one or two sentences, SHALL or MUST, never should/may. One EARS pattern each:
    • Ubiquitous: The <system> SHALL <response>.
    • Event: WHEN <trigger>, the <system> SHALL <response>.
    • State: WHILE <state>, the <system> SHALL <response>.
    • Optional feature: WHERE <feature is included>, the <system> SHALL <response>.
    • Unwanted: IF <unwanted event>, THEN the <system> SHALL <response>.
    • <system> is a glossary term. More than three preconditions: split. Constraints that are not conditional behavior go to architecture.md or a decision record.
  • Scenarios: declarative domain language, glossary terms only, ≤3 GIVEN, exactly 1 WHEN, ≤2 THEN (AND counts toward the step it follows). Concrete values. A scenario that only restates its requirement is deleted.
  • Curate: 5–12 scenarios that define the capability. Edge cases and regressions live in tests without IDs.
  • Every requirement has at least one scenario; no scenario without a requirement.

Updating

  • Edit in place, never create -v2 copies. Removed scenarios disappear; their IDs stay retired.
  • Over ~150 lines or 12 scenarios means more than one capability: turn x.md into x/index.md (family purpose and links, no requirements) plus one file per sub-capability. Each sub-file is a complete spec with its own Purpose, Non-goals and Requirements. Keep scenario IDs unchanged when moving.
  • New domain term? Add it to the glossary in the same change: one line, plain words. Without a glossary, list the new terms for the user instead. The glossary contains term definitions only, never code, IDs or rules. One word per concept; ask the user for the meaning instead of inventing it.

After writing

  1. Run the checker if Node is available: node <spec-check skill>/scripts/check.mjs <repo-root>, as described in spec-check.
  2. Show the user the delta as ADDED / MODIFIED / REMOVED / RENAMED requirements and scenario IDs.
  3. State plainly that a human must approve every scenario before tests are written. Do not write the linked tests in the same step unless the user approved the scenarios.
  4. Continue with the plan, as the last action:
    • The user passed --plan: read plan.md in this folder and follow it in the same call, without asking.
    • Otherwise: ask the user whether to continue with the plan now. On yes, read plan.md and follow it in the same call. On no, tell the user that spec-write --plan writes the plan later, and stop.
    • Skip this step when ## Open questions is non-empty, and say which questions block the plan.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.