spec-first-workflow
Skill41 starsChanged 15 days agoMITView on GitHub
Specification-First Agentic Development methodology guide. Triggers when a project has a .yourproject/ structure (contexts/, specs/, decisions/) or the user mentions spec-first.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- apply-specSkill
- bootstrap-projectSkill
- create-specSkill
- deliver-seriesSkill
- deliver-specSkill
- log-decisionSkill
- review-specSkill
- update-projectSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
Before starting any work, read these files in order:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Specification-First Agentic Development
You are working in a project that follows the Specification-First Agentic Development methodology. This means documentation is a first-class development artifact — every feature starts as a specification, every decision gets logged, and you read context files in a defined order before writing code.
Core Loop
Discuss → Write Spec → worktree + commit → review-spec → active/ → build → done/ → deliver-spec (commit through the gate, PR)Directory Layout (v2.5)
.yourproject/
contexts/<name>/
context.yaml # per-stack: stack, arch, quality, state, workdir
coding-principles.md # per-stack: language rules (AI reads every session)
decisions/
<spec-id>-<slug>.yaml # one decision per file; spec ID prefix groups them
<run-id>-<slug>.yaml # run-attached decisions
memory/
MEMORY.md # experiential-memory index (one line per memory)
<name>.md # one typed Markdown fact per file
specs/
planned/ active/ done/
{id}-feature-slug.yaml # plus same-stem companions ({id}-feature-slug.md, …)
series/
{base}.yaml # optional, written by tools: one manifest per seriesSingle-stack projects have one context: contexts/default/. Monorepos add siblings — contexts/server/, contexts/client/, contexts/docs/ — each with its own workdir: pointing at that stack's sub-tree of the repo.
series/{base}.yaml is written by a tool (agent-smith, for one) that cuts a series {base}a, {base}b, … from a ticket or a conversation: it names the source and lists the series' spec ids in order. The specs themselves stay in specs/. A series written by hand needs no manifest — its shared base already shows the kinship.
Context Read Order
Before starting any work, read these files in order:
- Every
.yourproject/contexts/<name>/context.yaml(globcontexts/*/context.yaml) — read it down tostate:for architecture, stack and integrations PER stack.state.doneis an index, one line per finished spec with a pointer to it: search it for the area you touch, never read it front to back. - Every
.yourproject/contexts/<name>/coding-principles.md— code quality rules per stack (ALWAYS follow). Different contexts can have different conventions. .yourproject/specs/active/— the current spec. Note itsapplies_to:field — it tells you which context's principles dominate when conflicts arise.- Relevant
.yourproject/decisions/<spec-id>-*.yamlfiles — past decisions for the active spec and itsrequires:chain. Glob broader if you need historical context. .yourproject/memory/MEMORY.md— the experiential-memory index, one line per recorded fact. Recall detail frommemory/<name>.mdon demand when an index line touches your task.
Replace .yourproject/ with the actual project directory name (e.g., .agentsmith/, .myapp/).
Decisions vs memory — the boundary: a decision records a CHOICE made at a point in time (chose/over/reason — it lives in decisions/, written via /spec-first:log-decision); a memory records a transferable FACT or RULE that future work consults (it lives in memory/: feedback = ratified operator preference, project = goal/constraint/state not derivable from code or git, reference = external pointer). log-decision never writes memory/, and memory writes never land in decisions/ — distil a decision's durable lesson into a memory entry when one exists, never copy the decision itself.
Available Skills
This plugin provides specialized skills for each part of the workflow:
| Skill | When to use |
/spec-first:bootstrap-project | Setting up the methodology in a new or existing project |
/spec-first:create-spec | Planning a new feature, refactor, or task; commits the spec on a spec branch in its own worktree |
/spec-first:review-spec | Checking a spec's evidence and getting a fresh reviewer's verdict before any code |
/spec-first:apply-spec | Implementing the active spec, up to its done criteria |
/spec-first:deliver-spec | Committing through the gate, reading its verdict, pushing and opening the pull request |
/spec-first:deliver-series | Taking a whole series from review to one pull request: grouped builders, one integration branch, merged-tree verify, CI |
/spec-first:log-decision | Recording an architectural or design decision |
/spec-first:update-project | Syncing methodology files with a newer plugin version (and migrating v1 → v2) |
The 12-Step Implementation Workflow
For every spec, follow this order:
- Write spec first — create
specs/planned/{id}-slug.yamlwith goal,applies_to:, steps, done criteria. No code until the spec exists. The id is minted from the clock — today's UTC date plus four random hex digits, e.g.2026-08-24-8a3f— never from a count of what already exists, so it can be minted offline and in parallel. Counter ids (p0042) from older projects stay valid forever and are never renamed. - A worktree per spec — commit the spec and its planned entry on branch
spec/{id}in a new worktree cut from the default branch (create-spec does this). All work on the spec happens there. - Review the spec —
/spec-first:review-spec: the evidence script resolves every cited file and line, then a fresh reviewer answers BUILD, BUILD WITH CUTS or REFUSE. No code before BUILD, or BUILD WITH CUTS with the cuts applied. - Move to active — move the spec file from
planned/toactive/. - Plan first — explore the codebase(s) the spec touches (filtered by
applies_to:), design the approach, get human approval before coding. - Implement step by step — contracts/models first, then implementation, then wiring, then tests. Follow the relevant context's coding-principles.
- Build after each step — fix errors immediately, don't accumulate them.
- Test what you changed: the build and the affected tests while iterating, zero failures before moving on. The full
verify:stages run once, at the spec commit, by the commit gate. - Log decisions — one YAML per spec at
decisions/<spec-id>.yaml, every non-obvious choice an entry in itsdecisions:list. - Update state — move spec from
activetodonein the relevant context'scontext.yaml. - Move spec file — move from
active/todone/. - Deliver:
/spec-first:deliver-speccommits once asfeat: {short description} ({id}), reads the gate's verdict, pushes and opens the pull request.
The Commit Gate
The plugin ships a PreToolUse hook on Bash. On a git commit whose message carries ({id}) it runs every context's verify: stages from the repository root, blocks the commit on the first red stage, and writes one line to spec-first-gate.log in the git common directory. A project with its own commit gate puts gate: project at the top level of one context.yaml; the plugin's gate then steps aside, so exactly one gate checks each commit. A project with no verify: stages passes with a notice saying so.
Key Rules
- English only — all code, comments, docs, exceptions, logs, commit messages, decisions.
- No over-engineering — only build what the spec requires, nothing more.
- Tests — every new public method gets at least one test.
- Follow the relevant context's coding-principles.md — these are constraints, not suggestions.
- Specification is the contract — the spec defines what gets built. No scope creep.
- Respect context boundaries — a spec with
applies_to: serverdoesn't drift intoclient/.
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
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.

