apply-spec
Skill41 starsChanged 15 days agoMITView on GitHub
Implement the active spec in its worktree, up to its done criteria. Triggers on 'implement this spec', 'execute the spec', 'start working on {id}', or a spec in active/.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- bootstrap-projectSkill
- create-specSkill
- deliver-seriesSkill
- deliver-specSkill
- log-decisionSkill
- review-specSkill
- spec-first-workflowSkill
- update-projectSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Read context files in order:
- Very specific: line 19
If there is no spec in active/, ask the user which planned spec to start.
- Very specific: line 23
If the active spec has applies_to: set, prefer the matching context's coding-principles.md over others when there's a conflict.
- Distinctive: line 29
Read the spec completely. Identify:
- Distinctive: line 36
If anything is unclear, ask the user before proceeding.
- Very specific: line 49
Follow the spec's steps array in order.
- Distinctive: line 50
Create or modify the files listed
- Very specific: line 51
Follow the architecture patterns from the relevant contexts/<name>/context.yaml
- Distinctive: line 52
Follow the relevant context's coding principles strictly
- Distinctive: line 60
Run the build after completing each step.
- Very specific: line 80
One file per spec: All decisions for {id} live in decisions/{id}.yaml as entries in its decisions: array.
- Very specific: line 99
Use the /spec-first:log-decision skill if you prefer interactive logging — it handles file creation, appending, and YAML formatting.
- Very specific: line 105
Add to state.done with a one-line summary
- Very specific: line 107
If the spec touched multiple contexts, update each affected context's context.yaml.
≈ “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
Apply Spec
Implement the currently active spec following the Specification-First workflow. The spec is the contract — build exactly what it says, nothing more. Work in the spec's worktree (branch spec/{id}, created by create-spec); the commit, push and pull request belong to /spec-first:deliver-spec.
Before You Start
- Read context files in order:
- Every
.{project}/contexts/<name>/context.yaml— globcontexts/*/context.yaml. Each context describes one stack (single-stack projects have justcontexts/default/). Read each one down tostate:to know the architecture and stack.state.doneis an index of what's been built, one line per spec: search it for the area the active spec touches, never read it front to back. - Every
.{project}/contexts/<name>/coding-principles.md— these are constraints per stack, not suggestions. Different contexts can have different conventions (C# vs. TypeScript). - The active spec in
specs/active/. - Relevant past decisions:
decisions/<spec-id>.yamlfor the active spec and for any spec listed inrequires:. Globdecisions/*.yamlif you need to consult the broader history.
- Every
- If there is no spec in
active/, ask the user which planned spec to start. Move it fromplanned/toactive/. - Work in the spec's worktree:
git worktree listshows it on branchspec/{id}. If there is none, create it as create-spec step 7 does. Its spec must have passed/spec-first:review-spec. - If the active spec has
applies_to:set, prefer the matching context'scoding-principles.mdover others when there's a conflict.applies_to:is free text — interpret it against the context names incontexts/.
The 9 Steps
Step 1: Understand the spec
Read the spec completely. Identify:
- The goal (what and why)
applies_to:(which stack(s)) — falls back to "all" if absent- Each step and its deliverables (
new,modify,delete) - Test expectations
- Done criteria
If anything is unclear, ask the user before proceeding.
Step 2: Plan the approach
Explore the codebase(s) the spec touches. For each context the spec affects:
- Where new code fits in the existing architecture
- What existing code will be modified
- What patterns are already established (follow them — per that context's coding-principles.md)
Present your plan to the user. Get approval before writing code.
Step 3: Implement step by step
Follow the spec's steps array in order. For each step:
- Create or modify the files listed
- Follow the architecture patterns from the relevant
contexts/<name>/context.yaml - Follow the relevant context's coding principles strictly
Order within each step: contracts/interfaces first, then implementation, then DI wiring, then tests.
Characterise first when the spec consolidates copies of logic or changes what existing code does on some input: before changing anything, write the test that runs every current copy on one input matrix and records today's outcome in a "was" column. Commit nothing that changes a row without its reason in decisions/{id}.yaml.
Step 4: Build after each step
Run the build after completing each step. Fix errors immediately — don't accumulate broken state.
Step 5: Test what you changed, then review
While you iterate, run the build and the tests of what you changed: the affected test classes or files, not the whole suite. Zero failures before moving on.
The full verify: stages run once, at the spec commit, by the plugin's commit gate (or by the project's own gate when a context declares gate: project). Do not run them here as well: a second full run costs time and proves nothing the gate does not. deliver-spec runs them itself only when no gate checked the commit.
Then check the green code is good — a judgment pass, best delegated to a fresh-eyes subagent, because a separate context catches what the author's does not:
- Principles — walk the diff against each affected context's
coding-principles.md; list every violation with file:line and fix it. - Spec adherence — the diff does what the spec says and nothing it doesn't.
- Refactoring — surface what should improve; apply what is in scope, name a follow-up spec for the rest rather than dropping it.
Report the outcome to the user before moving on.
Step 6: Log decisions
For every non-obvious choice made during implementation, append an entry to the spec's decision YAML at .{project}/decisions/<spec-id>.yaml.
One file per spec. All decisions for {id} live in decisions/{id}.yaml as entries in its decisions: array. Create the file on the first decision; append to it on subsequent decisions.
# yaml-language-server: $schema=../decision.schema.json
spec: {id}
decisions:
- category: Architecture # | Tooling | Implementation | TradeOff | Security | Scope
chose: "<one-line>"
over: "<one-line alternative>" # optional
reason: |
Multi-line why.
alternatives: # optional
- "<other option — why rejected>"
- category: Implementation
chose: "..."
...Use the /spec-first:log-decision skill if you prefer interactive logging — it handles file creation, appending, and YAML formatting.
Step 7: Update context.yaml
Move the spec entry in the affected context(s):
- Remove from
state.active - Add to
state.donewith a one-line summary
If the spec touched multiple contexts, update each affected context's context.yaml. The spec ID is shared across contexts; the spec entry can live in whichever context owns it (often the one named in applies_to:).
Step 8: Move spec file
Move the spec from specs/active/ to specs/done/.
Step 9: Verify done criteria
Go through every item in the spec's done: list. Confirm each one is satisfied. If any criterion is not met, address it before handing over.
Then stop: do not commit. Run /spec-first:deliver-spec — it runs the project's verify stages, commits, pushes and opens the pull request.
Rules During Execution
- No scope creep — if you notice something that should be fixed but isn't in the spec, note it for a future spec.
- No premature abstraction — three similar lines are better than a helper nobody asked for.
- No silent decisions — if you choose between alternatives, write a decision YAML.
- Ask when stuck — if the spec is ambiguous or the codebase contradicts the plan, ask the user rather than guessing.
- Respect context boundaries — when the spec touches one context (e.g.
applies_to: server), don't drift into another (client/) "while you're there".
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.

