agentleFS
holgerleichsenringholgerleichsenring/specification-first-agentic-development/skills/apply-spec/SKILL.md

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.

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
  1. Distinctive:

    Read context files in order:

    line 13
  2. Very specific:

    If there is no phase in active/, ask the user which planned phase to start.

    line 19
  3. Very specific:

    If the active phase has applies_to: set, prefer the matching context's coding-principles.md over others when there's a conflict.

    line 23
  4. Distinctive:

    Read the phase spec completely.

    line 29
  5. Distinctive:

    If anything is unclear, ask the user before proceeding.

    line 36
  6. Very specific:

    Follow the spec's steps array in order.

    line 49
  7. Distinctive:

    Create or modify the files listed

    line 50
  8. Very specific:

    Follow the architecture patterns from the relevant contexts/<name>/context.yaml

    line 51
  9. Distinctive:

    Follow the relevant context's coding principles strictly

    line 52
  10. Distinctive:

    Run the build after completing each step.

    line 58
  11. Very specific:

    One file per phase: All decisions for {id} live in decisions/{id}.yaml as entries in its decisions: array.

    line 76
  12. Very specific:

    Use the /spec-first:log-decision skill if you prefer interactive logging — it handles file creation, appending, and YAML formatting.

    line 95
  13. Very specific:

    Add to state.done with a one-line summary

    line 101
  14. Very specific:

    If the phase touched multiple contexts, update each affected context's context.yaml.

    line 103

≈ “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.

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

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

  1. Read context files in order:
    • Every .{project}/contexts/<name>/context.yaml — glob contexts/*/context.yaml. Each context describes one stack (single-stack projects have just contexts/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>.yaml for the active phase and for any phase listed in requires:. Glob decisions/*.yaml if you need to consult the broader history.
  2. If there is no phase in active/, ask the user which planned phase to start. Move it from planned/ to active/.
  3. Work in the phase's worktree: git worktree list shows it on branch phase/{id}. If there is none, create it as create-phase step 7 does. Its spec must have passed /spec-first:review-spec.
  4. If the active phase has applies_to: set, prefer the matching context's coding-principles.md over others when there's a conflict. applies_to: is free text — interpret it against the context names in contexts/.

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:

  1. Principles — walk the diff against each affected context's coding-principles.md; list every violation with file:line and fix it.
  2. Spec adherence — the diff does what the spec says and nothing it doesn't.
  3. 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.done with 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".

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.