agentleFS
devonbweaverdevonbweaver/Spec-Loop/SKILL.md

spec

Skill1 starsChanged 4 months agoMITView on GitHub

Use BEFORE building any non-trivial feature, app, or change. Runs a one-question-at-a-time interview to lock the goal, requirements, constraints, and a concrete checkable definition of done, then writes a contract to specs/<name>.md and drives the self-fixing loop: build → INDEPENDENT adversarial audit → fix → re-audit → verify → gated ship. This is the planning half of the quality loop.

173 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use backprop, ios-clean and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • JuliusBrusseeSkill

    backprop

    Bug → spec protocol. When a bug is found or a test fails, trace the cause, decide whether a new §V invariant would catch recurrence, append to §B. This is the one non-obvious thing SDD does that plan-then-execute doesn't. Triggers on test failure, bug report, post-mortem, or explicit user ask.

    Also in 4 projects that use this

  • Saqlain-811Skill

    ios-clean

    Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. (gstack)

    Also in 5 projects that use this

  • Saqlain-811Skill

    ios-fix

    Autonomous iOS bug fixer. (gstack)

    Also in 5 projects that use this

  • bastosSkill

    ios-design-review

    Review iOS app UI/UX design quality using Apple's design principles and the Liquid Glass-era design language from WWDC25/26. Use when asked for a design review, UX critique, visual design assessment, or evaluation of an app's interface quality, design intent, alignment with the new Apple design system, or usability. Triggers: "design review", "UX review", "visual design critique", "review the UI", "does this design work", "evaluate this interface", "design feedback", "Liquid Glass review".

    Also in 5 projects that use this

  • ShreyRaviSkill

    plan-tune

    Self-tuning question sensitivity + developer psychographic for gstack (v1: observational). Review which AskUserQuestion prompts fire across gstack skills, set per-question preferences (never-ask / always-ask / ask-only-for-one-way), inspect the dual-track profile (what you declared vs what your behavior suggests), and enable/disable question tuning. Conversational interface — no CLI syntax required.

    Also in 7 projects that use this

  • timurgaleevSkill

    document-generate

    Generate missing docs for a feature, module or project as tutorials, how-tos, reference and explanation.

    Also in 6 projects that use this

  • +2 more from Saqlain-811

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 149 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never dump a list of questions.

    line 34
  2. Very specific:

    Before the first question, probe the real code (Grep/Glob/Read the relevant files) so your questions are sharp and specific to *this* …

    line 37
  3. Distinctive:

    If the user is vague ("make it good"), translate to concrete checks and read them back for a yes/no.

    line 52
  4. Distinctive:

    Use this exact skeleton:

    line 64
  5. Distinctive:

    After writing the file, show the user the NEEDS + the catastrophic-L + the Guardrails and ask for explicit approval ("Approve this …

    line 128
  6. Distinctive:

    Run this shape. It is the whole point.

    line 136
  7. Very specific:

    Use a runtime-bug lens (races, null refs, leaks, error gaps), a security lens (auth/secrets/injection), or a deep-reasoning lens — match …

    line 151
  8. Distinctive:

    Never say done on faith. Run the actual proof from the spec's Win sequence — build passes, tests pass, the demoable thing demonstrably …

    line 169

“Common” is measured: kept by at least 6 in 10 of the 149 edited versions of this file we could read. “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 — The Contract-First, Self-Fixing Build Loop

You are running a contract-first build loop. Its whole edge over a normal "spec → build → self-review" loop is one thing: the review is independent and adversarial, not self-review. A build's own review shares the builder's blind spots and says "ship, zero findings." A separate context told to BREAK it finds the real bugs. The spec you write here is the contract that adversary checks the build against — so write it to be attacked, not admired.

Hard rule: do NOT write any implementation code during /spec. /spec produces a contract and gets it approved. Building happens only after, in the loop, against the locked contract.


Phase 0 — Interview to clarity (one question at a time)

Goal: understand the build well enough to write a definition of done someone else could check without asking you anything. Ask ONE focused question, wait for the answer, then ask the next. Never dump a list of questions. Never start building. Stop interviewing the moment you can write every section below without a single "TBD" — not before, not long after.

Before the first question, probe the real code (Grep/Glob/Read the relevant files) so your questions are sharp and specific to this codebase, not generic. A question you can answer yourself by reading the repo is a question you don't ask.

Drive the interview until you have hard answers on:

  1. The objective — the single outcome this exists to produce. One sentence.
  2. The must-have requirements — what it MUST do. Push until each is testable.
  3. The constraints — what it must NOT do, what it must not break, budgets (latency, cost, tokens), security/privacy boundaries, the things that are expensive to get wrong.
  4. The edge cases — the inputs and states that break naive implementations (empty, huge, concurrent, duplicate, malformed, partial-failure, retry, the second time it runs).
  5. Done — the exact observable proof. "When I do X, I see Y." If you can't phrase done as something demoable, you don't understand it yet — keep asking.

If the user is vague ("make it good"), translate to concrete checks and read them back for a yes/no. Ambiguity that survives the interview becomes a bug the adversary finds later — kill it now.


Phase 1 — Write the contract to specs/<name>.md

Pick a kebab-case <name> from the objective. Write the spec in a clear planning framework, in definitive voice — zero hedging. No "should," "could," "like," "maybe," "probably." Every requirement line is a MUST. If you're tempted to hedge, you have an open question — go back to Phase 0 and close it.

Use this exact skeleton:

# Spec: <Name>

**Status:** DRAFT (awaiting approval) · **Author:** <interviewer> · **Date:** <YYYY-MM-DD>

## Objective
<One sentence. The single outcome this produces.>

## NEEDS (definition of done — hard requirements)
The build is done when ALL of these are true. Each is a MUST, stated as what IS / what MUST BE.
- [ ] N1. <requirement — testable, no hedging>
- [ ] N2. <requirement>
- [ ] N3. <requirement>
<every must-have from the interview becomes a numbered, checkable NEED>

## Constraints (what it must NOT do / not break)
- C1. <constraint — boundary, budget, must-not-break>
- C2. <constraint>

## Milestones (ordered, dependency-correct)
Sequence so the thing that lets the user TEST THE LOOP themselves lands as early as possible.
For each: what gets built (exact files/seams), the Win (demoable proof), the L (what wrong looks like).

### M1 — <name>
- **Build:** <exact files/seams touched>
- **Win:** <the concrete, demoable proof this milestone works>
- **L:** <what failure looks like here, concretely>

### M2 — <name>
- **Build:** ...
- **Win:** ...
- **L:** ...

## Win (overall)
The single demoable end-state, as the exact observable sequence:
1. <do X> → 2. <see Y> → 3. <see Z>. That sequence passing = shipped.

## What an L looks like (overall) — lead with the catastrophic one
- **CATASTROPHIC:** <the failure that must never happen — data loss, money moved wrong,
  customer sent something unapproved, secret leaked, runaway cost>. Named concretely.
- <next-worst failure mode>
- <next>

## Guardrails (always-on, easy to forget, expensive to break)
- G1. <e.g. never send a customer an unapproved price; the kill switch; the human-is-the-gate;
  gated behind a flag default-OFF; access-locked to service-role only; no secret in client code>
- G2. ...

## Adversary's attack surface (how the independent reviewer will try to BREAK this)
This is the checklist the adversarial audit runs against — written by the spec, so the review
has teeth. List the concrete attacks a fresh, hostile context would try:
- A1. <e.g. run it twice — does it double-charge / double-insert? (idempotency)>
- A2. <e.g. two of these fire concurrently — race on the same row?>
- A3. <e.g. the classifier/LLM returns null/garbage — does it loop forever / spend forever?>
- A4. <e.g. empty input, 10k input, malformed input, partial failure mid-write>
- A5. <e.g. the auth check — can it be reached unauthenticated / via an earlier branch?>
- A6. <map at least one attack to each CATASTROPHIC L above>

## Out of scope (explicitly NOT building now)
- <thing> — <why deferred>

After writing the file, show the user the NEEDS + the catastrophic-L + the Guardrails and ask for explicit approval ("Approve this contract, or tell me what's wrong"). Do not enter the loop until they approve. The spec is the boss — if it's wrong, everything downstream is wrong.


Phase 2 — The self-fixing loop (only after approval)

Run this shape. It is the whole point.

build → INDEPENDENT adversarial audit → fix → (if structural) re-audit changed surface → verify → gated ship

2a. Build

Build exactly what the contract says — the spec is the boss, no scope creep. When done, write a one-line "covered" note against each NEED (N1…Nn): which file/commit satisfies it. A NEED you can't point at is a NEED you didn't build.

2b. Independent adversarial audit (the differentiator — never skip)

Spawn a separate agent with fresh context, no build bias, and hand it the spec's Adversary's attack surface as its checklist. Tell it: your job is to BREAK this, ground every finding in lines you actually read, default to refuting your own findings — only survivors get reported.

  • Use a runtime-bug lens (races, null refs, leaks, error gaps), a security lens (auth/secrets/injection), or a deep-reasoning lens — match the lens to the catastrophic L. (In Claude Code, the Task tool can spawn subagents such as bug-auditor, security-auditor, or oracle; a fresh general-purpose agent works too.)
  • For high-stakes surfaces, spawn 2–3 in parallel with different lenses (correctness / security / does-it-reproduce) in one message.
  • You may also self-triage your own build first as a warm-up — but that is NOT a substitute for the independent pass. Self-review is not an audit.

2c. Fix

Fix every surviving finding. Re-state which NEED or attack each fix closes.

2d. Re-audit if the fix was structural

A fix to deep/structural code can create a new bug of the same class. Re-audit the changed surface. Stop when findings converge to noise/polish — the 12→4→1 convergence is the signal to stop; chasing 1→0 forever is its own anti-pattern (cap the loop at a real margin).

2e. Verify before "done"

Never say done on faith. Run the actual proof from the spec's Win sequence — build passes, tests pass, the demoable thing demonstrably works. Paste the evidence. If a step was skipped, say so.

2f. Gated ship

Ship behind the contract's Guardrails. Never deploy unconfident, never flip a prod flag or deploy without the user's explicit in-the-moment go. State exactly what will change and wait for the yes.


Your project conventions (customize this section)

Fold your project's durable, easy-to-forget reflexes into the relevant Guardrails/NEEDS automatically. Replace the examples below with your own:

  • Commits / attribution — your author line and co-author convention; which branch = prod.
  • Migrations / data — how schema changes are applied; tables holding secrets/PII are access-locked (e.g. RLS, service-role only).
  • New behavior ships behind a flag, default OFF — until deliberately enabled.
  • Secrets — never enter a key/token into a field, never commit one, never put PII in URLs.
  • After a real build lands, record it wherever your project keeps its log/notes.

Anti-patterns this skill exists to prevent

  • Starting to build during the interview. (Don't.)
  • Hedging language in the contract. Every NEED is a MUST.
  • "Review" done by the builder's own context returning "ship, zero findings." That's not an audit.
  • A definition of done you can't demo. If you can't show it passing, it isn't done.
  • Chasing findings to zero forever. Stop at convergence/real margin.
  • Silent scope creep past the contract. The spec is the boss.

When to use a lighter touch

Single-file edits, 1–2 line fixes, docs, config: skip the full ceremony. Write a 3-line mini-spec (objective · the one NEED · the one way it could break), make the change, do a quick self-check. Reserve the full interview + independent audit for multi-file work, new features, anything touching money/data/auth/customer-facing output.

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.