apply-spec
Skill9 starsChanged 56 days agoMITView on GitHub
Implement the active phase following the 9-step workflow, in the phase's worktree, up to its done criteria. Triggers when the user references an active phase file, says 'implement this phase', 'execute the phase', 'start working on {id}', or has a phase in the active/ directory.
In this repository9 other files it gives its agents.
- bootstrap-projectSkill
- create-phaseSkill
- deliver-specSkill
- execute-phaseSkill
- log-decisionSkill
- review-specSkill
- ship-phaseSkill
- 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 phase in active/, ask the user which planned phase to start.
- Very specific: line 23
If the active phase has applies_to: set, prefer the matching context's coding-principles.md over others when there's a conflict.
- Distinctive: line 29
Read the phase spec completely.
- 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 58
Run the build after completing each step.
- Very specific: line 76
One file per phase: All decisions for {id} live in decisions/{id}.yaml as entries in its decisions: array.
- Very specific: line 95
Use the /spec-first:log-decision skill if you prefer interactive logging — it handles file creation, appending, and YAML formatting.
- Very specific: line 101
Add to state.done with a one-line summary
- Very specific: line 103
If the phase touched multiple contexts, update each affected context's context.yaml.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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 phase following the Specification-First workflow. The spec is the contract — build exactly what it says, nothing more. Work in the phase's worktree (branch phase/{id}, created by create-phase); 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 to know the architecture, stack, and what's been built per sub-tree. - 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 phase spec in
phases/active/. - Relevant past decisions:
decisions/<phase-id>.yamlfor the active phase and for any phase listed inrequires:. Globdecisions/*.yamlif you need to consult the broader history.
- Every
- If there is no phase in
active/, ask the user which planned phase to start. Move it fromplanned/toactive/. - Work in the phase's worktree:
git worktree listshows it on branchphase/{id}. If there is none, create it as create-phase step 7 does. Its spec must have passed/spec-first:review-spec. - If the active phase 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 phase 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 phase touches. For each context the phase 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.
Step 4: Build after each step
Run the build after completing each step. Fix errors immediately — don't accumulate broken state.
Step 5: Verify, then review
After implementation is complete, run the full verification — not just the unit tests, but every deterministic check the project defines — the contexts' verify: stages first, then unit tests, CLI/pipeline dry-runs, and any separate integration/harness executable. Zero failures before moving on. A project may enforce these as a blocking commit gate (e.g. a PreToolUse hook on git commit); treat that as the floor, not the ceiling, so the commit is never the first time they run.
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 phase 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 phase's decision YAML at .{project}/decisions/<phase-id>.yaml.
One file per phase. 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
phase: {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 phase entry in the affected context(s):
- Remove from
state.active - Add to
state.donewith a one-line summary
If the phase touched multiple contexts, update each affected context's context.yaml. The phase ID is shared across contexts; the phase entry can live in whichever context owns it (often the one named in applies_to:).
Step 8: Move phase file
Move the spec from phases/active/ to phases/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 phase.
- 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 phase 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.

