Spec

From rjmurillo/ai-agents · View interactive version

Spec is an AI agent skill from the GitHub repository rjmurillo/ai-agents. Turn a problem into testable requirements with acceptance criteria, through a first-principles gate, a memory-first prior-art gate, and a PRD schema. Use when you say `spec this out`, `what should we build`, or `define the requirements`, and run it before plan. Do NOT use to sequence work into miles

How to use this skill

Skill file

Spec

<!-- vendor-portability: contributor-scoped citation. The retrospective at

.project-toolkit/retrospective/2026-05-05-pr-1887-iteration-paradox.md is the evidence for

why the Step 0 gate exists and lives upstream in the rjmurillo/ai-agents

repo; it is cited, not resolved at runtime (ADR-083). -->

Define what to build: a problem turned into requirements each of which can be

judged pass or fail, gated twice before any of it is written.

Migrated from the spec command under ADR-064, which makes skills the single

user-invocable surface. The command file is gone, so its path is named here in

plain text rather than as a citation to something a reader could open.

Triggers

spec this out, what should we build, define the requirements,

turn this into acceptance criteria

Arguments

Spec: the problem statement from the conversation (under Copilot CLI the skill tool takes no argument vector, so state it in your message)

If $ARGUMENTS is empty, ask the user what problem to solve. Do not proceed

without a problem statement.

Process

Step 0: First Principles Gate (blocking, runs before Step 1)

Before any clarification work, answer six forcing questions. The gate exists because every retro citing wasted spec work in the last six months traces to a question this gate forces upfront. The strongest single citation is .project-toolkit/retrospective/2026-05-05-pr-1887-iteration-paradox.md Phase 6, where the retro itself names the question this gate asks ("is the framework worth building at all if its design space misses the dominant failure modes?") and explicitly defers it as out of scope. That deferral landed after 69 commits.

The six questions, asked in order:

| Label | Question |

|-------|----------|

| Q1 Demand Reality | Who has explicitly requested this? Name three or more individuals, teams, or systems by name, or name at least one specific present-tense requester and pair it with a specific Q3 and an evidenced Q5. (Question is about requesters; production signals go to Q5.) |

| Q2 Status Quo | What is the exact workaround users do today, step by step? |

| Q3 Desperate Specificity | Name the single most blocked person or system right now. What exactly are they blocked on? |

| Q4 Narrowest Wedge | What is the smallest possible deliverable that unblocks Q3, measured in hours of implementation? |

| Q5 Observation | What direct production signal proves the gap exists? Cite a metric, log entry, error count, ticket, retro line, or trend. (Question is about signals; requesters go to Q1.) |

| Q6 Future-fit | If the system grows 10x, does this feature still make sense, or does it become a liability? |

Write the answers as a structured block (the ## Step 0 First Principles block) with six ### Q1..Q6 subheads, each containing the author's verbatim answer. The block flows downstream as input: Step 1 (Clarify) reads it as problem context, Step 2 (requirements-interview) carries it into the PRD it produces, Step 3 (Tier classification) re-validates Q4 at Tier 5, Step 6 (spec-generator) formalizes the PRD into durable artifacts with this block as the first section, and Step 9 (critic pre-mortem) checks that Q1/Q3/Q4 did not drift. Do not paraphrase; downstream steps depend on the verbatim answers.

The pass criteria, hedge phrase validation table, script-resolution rules, kill criteria, and archival policy are in the spec-generator skill's references/spec-step0-gates.md.

Reframing check (only while the architecture is open)

Runs with Q2. Treat today's workflow as evidence of the goal and its constraints, not as a template for the solution. Ask what becomes possible if the agent works through a purpose-built interface, instrument, representation, or coordination protocol instead of repeating human UI or process steps.

End the Q2 answer with one sentence recording the outcome: Reframing: skipped (<reason>), Reframing: automation only, or Reframing: capability invention, check: <falsifiable signal>.

Step 0.5: Memory-First Gate

Bound the search. If three tool calls have not surfaced anything useful, stop searching and switch to first-principles reasoning. Document what you tried (which tool, what query, what came back) so the user can extend the search if the answer matters more than your time budget suggests.

Use the prior-art gate to search memory. Record sources and coverage gaps in

the PriorArtBlock.

Runs after Step 0 and before Step 1. It searches prior art before any new spec

work, halts when the blast-radius count meets the mode threshold (2 in human

mode, 3 in auto mode) or a risky change type has no prior record or citation,

and runs the Check 9 series over the result.

The gate in full, including its halt criteria, halt block format, metrics tally

and every check, is in references/step-0-5-memory-gate.md. Read it before

running the gate: the halt conditions are the point, and a summary of them is

not the gate.

Evaluation Axes

  1. Problem clarity - Is the right problem being solved? Could a reframing yield 10x impact?
  2. Requirement testability - Can each requirement be verified pass/fail?
  3. Completeness - No gaps between problem statement and acceptance criteria?
  4. Traceability - REQ to DESIGN to TASK linkage established?
  5. Feasibility - Buildable within constraints? Existing code to leverage?

Principles

Output

No em dashes or en dashes in anything this skill writes.

Use commas, periods, colons, parentheses, hyphens, or restructure.

Structured requirements document. Mirror the PRD schema produced in step 2; do not collapse to acceptance criteria alone.

Handoff

Writes: requirements-spec, design-spec, task-spec. Next: /plan.

Writing Style, Completeness Scores, Confusion Protocol

Read references/writing-style-and-confusion-protocol.md before the first

question to the user in a run (Claude Code: AskUserQuestion). It carries the jargon-glossing and outcome-framing

rules, the Completeness: X/10 scoring rule, and the Confusion Protocol with

its unattended-run fallback. They lived in the always-on voice rule until a later change moved them here; the body stays under the 200-line spec ceiling

by keeping them in a reference, as Step 0.5 already does.

Scripts

Two helpers ship inside this skill so an installed plugin can run the gates

without a toolkit checkout. Resolve them from this skill's own directory, not

from a repository path.

Both live in this skill's own scripts/ directory, named here without a

leading path so nobody reads them as the upstream tree they were copied from.

| Script | Purpose | Exit codes |

|--------|---------|------------|

| redact_secrets.py | Redacts secrets from Step 0 and Step 0.5 tally text before any durable write. BLOCKING: a failure means do not write. | 0 success (redactions may have been applied), 2 usage or read error; --help for usage |

| metrics_writer.py | The single safe append point for the metrics tally files. Refuses a symlinked target (CWE-59) and opens with O_NOFOLLOW where the platform supports it. Takes --path PATH plus the line as --line=LINE or --stdin, never as a positional argument, so a line such as -h is data and not a flag. | 0 appended, 1 refused (symlink, path outside the working directory, I/O error), 2 usage error; --help for usage |

spec-entity-aliases.json ships in this skill's data/ directory beside them:

the alias table Step 0.5 uses to normalize topic names. All three are byte-identical copies of their canonical

sources, pinned by tests/skills/test_spec_bundle_parity.py, so a toolkit run

and an installed-plugin run cannot disagree.

Verification

Anti-Patterns

| Avoid | Why | Instead |

|-------|-----|---------|

| Skipping Step 0 because the problem seems obvious | Every retro citing wasted spec work in the last six months traces to a question this gate forces upfront | Answer the six questions, even quickly |

| Treating Step 0.5 as a formality | Its job is to halt on a blast-radius overrun or a risky change with no prior record or citation, and a skim cannot halt | Read the halt criteria in the reference and apply them |

| Acceptance criteria that restate the user story | A criterion nobody can fail is not a criterion | Write each one so a reader can say pass or fail from evidence |

| Speculative requirements | YAGNI: a requirement for a need nobody has yet becomes waste plus a constraint | Specify what is needed now, and record the rest under Deferred |

| Collapsing the output to acceptance criteria alone | Downstream plan and build read the ontology, data model and failure modes, not just the criteria | Mirror the full PRD schema |

Extension Points

checkbox, so the axis is both stated and checked.

a project that searches prior art differently edits that file, not the process.

section there is what makes downstream skills able to rely on it.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.