agentleFS
teltringhamteltringham/sdd-plugin/skills/sdd-spec/SKILL.md

sdd-spec

Skill0 starsChanged 8 months agoMITView on GitHub

Generates a specification (PRD) with traceability IDs and testable acceptance criteria for a feature. Produces context/specs/spec-{slug}.md following SDD methodology. Use when starting a new feature, defining requirements, or creating a PRD.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

25 rules. About 0 are common, 8 are distinctive, and 17 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 17

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check that context/specs/ exists.

    line 18
  2. Very specific:

    If $ARGUMENTS is brief (<20 words) or ambiguous, ask 2-3 targeted clarifying questions:

    line 22
  3. Distinctive:

    Do NOT ask more than 3 questions.

    line 28
  4. Very specific:

    Search context/specs/ for related specs to avoid duplicating work

    line 32
  5. Very specific:

    Read progress.txt (if it exists) for recent session context

    line 33
  6. Very specific:

    If this is brownfield (modifying existing code), delegate to the sdd-researcher agent:

    line 34
  7. Distinctive:

    Do NOT tell the researcher what you are building — this prevents implementation bias

    line 36
  8. Very specific:

    Before generating the spec body, ask the operator to classify the primary external interface this PRD touches.

    line 42
  9. Distinctive:

    Ask one targeted question:

    line 44
  10. Distinctive:

    Grandfather rule: Do NOT backfill this field on existing PRDs that lack it.

    line 57
  11. Very specific:

    Opaque consequence note: If the operator classifies as opaque-external, emit a single advisory line in the skill output after the spec is …

    line 59
  12. Very specific:

    Use the PRD template at ${CLAUDE_PLUGIN_ROOT}/templates/spec/prd.md.

    line 69
  13. Very specific:

    Write the spec's normative sections (Problem statement, Non-goals, Boundaries, Technical approach, Dependencies, requirements, Success …

    line 81
  14. Very specific:

    Prefer test validation (unit/integration tests) over manual

    line 106
  15. Very specific:

    Before save, optionally invoke the sdd-skeptic agent (if user wants extra scrutiny on a high-stakes spec):

    line 126
  16. Very specific:

    If context/specs/spec-overview.md exists, append an entry

    line 135
  17. Very specific:

    Run the spec template's "Self-audit checklist" (the trailer at the bottom of prd.md).

    line 140
  18. Distinctive:

    If the spec has open questions (advisory, non-blocking), flag them: "Resolve open questions before planning if practical"

    line 153
  19. Very specific:

    Every requirement has a SPEC-{slug}-NNN traceability ID

    line 160
  20. Very specific:

    Every requirement has a Serves: field naming the user story it advances (no orphan requirements — orphan requirements block approval)

    line 161
  21. Very specific:

    Every requirement has Given/When/Then acceptance criteria — outcome-shaped (not implementation-altitude)

    line 162
  22. Distinctive:

    Every requirement has a validation method

    line 163
  23. Distinctive:

    No banned vague verbs without measurable thresholds

    line 164
  24. Distinctive:

    No existing files are overwritten without confirmation

    line 167
  25. Very specific:

    If interface_maturity is opaque-external, the skill output includes the one-line advisory that this PRD will route to characterization at …

    line 169

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

SDD Spec

Generate a specification with traceability IDs and testable acceptance criteria.

Arguments

$ARGUMENTS — feature description (e.g., "user authentication with JWT", "rate limiting for API endpoints")

Process

1. Validate SDD structure

Check that context/specs/ exists. If not, suggest running /sdd-init first.

2. Clarify intent (if needed)

If $ARGUMENTS is brief (<20 words) or ambiguous, ask 2-3 targeted clarifying questions:

  • What is the core user problem?
  • What are the key constraints or non-negotiables?
  • Is this greenfield or brownfield (modifying existing code)?
  • Who is the user? (Push for persona depth — name a person or role with situational context, not "a user".)

Do NOT ask more than 3 questions. If the user gave a detailed prompt, skip straight to step 3.

3. Research existing context

  • Search context/specs/ for related specs to avoid duplicating work
  • Read progress.txt (if it exists) for recent session context
  • If this is brownfield (modifying existing code), delegate to the sdd-researcher agent:
    • Provide ONLY research questions derived from the feature description
    • Do NOT tell the researcher what you are building — this prevents implementation bias
    • The researcher emits a structured findings.json (schema at ${CLAUDE_PLUGIN_ROOT}/templates/research/findings.json.schema.json) with separable Decisions / Open Questions / Constraints / Patterns / Prior Art / Sources sections
    • Ingest the findings programmatically: any openQuestions[].blocking: true becomes a [NEEDS CLARIFICATION] marker in the spec; any constraints[] feeds the Boundaries section

4. Classify interface maturity (gate)

Before generating the spec body, ask the operator to classify the primary external interface this PRD touches. This gate is REQUIRED for new PRDs authored after v1.0.0; the classification drives downstream characterization decisions in /sdd-plan (§2.6).

Ask one targeted question:

What is the maturity of the primary external interface this PRD depends on?

  • controlled-internal — fully owned, stable interface (most common case)
  • documented-external — third-party with a stable, well-documented contract
  • opaque-external — third-party or runtime with an unstable or undocumented contract (e.g. ComfyUI WebSocket, Showdown subprocess, vendor SDKs without firm guarantees)

Record the answer in the spec's frontmatter-style metadata block at the top of the file (alongside **Spec ID:**, **Author:**, etc.) as a snake_case field:

interface_maturity: controlled-internal | documented-external | opaque-external

This is the canonical schema location. /sdd-plan (§2.6) reads interface_maturity from this exact field at the top of the spec to decide whether to attach a characterization tag — do NOT move it elsewhere in the document.

Grandfather rule. Do NOT backfill this field on existing PRDs that lack it. The §2.6 sdd-plan side handles tagless legacy PRDs via an operator prompt at plan time; that is out of scope here. This gate enforces the field on NEW PRDs only.

Opaque consequence note. If the operator classifies as opaque-external, emit a single advisory line in the skill output after the spec is saved:

Note: this PRD is classified opaque-external and will route to characterization at /sdd-plan time.

This nudge surfaces the downstream consequence at spec-write time so the operator is not surprised when planning produces characterization stories.

Forward reference. /sdd-plan (§2.6) reads this interface_maturity field at plan start and routes opaque-external work to a characterization story tag with wider budgets (2.5x tokens, 2.0x time) and explicit outputs (probes, transcript corpus, replay harness, parity checks, discovery notes). Operators who classify as opaque-external here can expect characterization stories to appear in the generated plan; see skills/sdd-plan/SKILL.md §2.6 for the routing rules.

5. Generate the spec

Use the PRD template at ${CLAUDE_PLUGIN_ROOT}/templates/spec/prd.md. Fill in all sections including the new ones:

  • Spec ID: SPEC-{slug} where slug is a short kebab-case identifier (e.g., SPEC-auth, SPEC-rate-limit)
  • Problem statement: One crisp sentence
  • Non-goals: Be specific about what you are NOT building
  • User stories (human-experience): Connextra/Cohn format with persona depth. Reject "as a user, I want X". Require named/contextual personas — Maya-context-switching-mid-flow, Sam-debugging-at-1am, a new contributor on day one. Each story surfaces a distinct human context. The lived experience of a specific persona surfaces edge cases prose specs miss.
  • Boundaries (Always / Ask first / Never): Hard constraints the implementer treats as non-negotiable. Always = invariants; Ask first = decisions that need human input; Never = forbidden moves.
  • Technical approach: Architecture, components, data flow — grounded in researcher findings if brownfield
  • Dependencies: Services, libraries, APIs needed

5b. Writing style — STE-100 controlled language

Write the spec's normative sections (Problem statement, Non-goals, Boundaries, Technical approach, Dependencies, requirements, Success criteria) in STE-100 controlled language per ${CLAUDE_PLUGIN_ROOT}/rules/ste100-writing.md (an ASD-STE100 adaptation): active voice with a named actor, one instruction per sentence, one term per concept, 20-word instructions / 25-word descriptions, 6-sentence paragraphs.

Exempt sections: Desired outcomes, JTBD, and Personas & user stories keep their situational voice — Article 13's human-outcome spine is NOT flattened into controlled language. Code identifiers, commands, and quoted output stay verbatim. When STE style conflicts with a required technical term, precision wins.

6. Write requirements with traceability

This is the most critical section. Each requirement MUST have:

  • Traceability ID: SPEC-{slug}-001, SPEC-{slug}-002, etc. Sequential, never reused.
  • Serves: field naming the user story this requirement advances. Orphan requirements (no Serves: link) block approval — every requirement must trace up to a user story.
  • Given/When/Then acceptance criteria — outcome-shaped (see §2.9 asymmetry below)
  • Validation method: One of test | build | lint | manual | browser

§2.9 asymmetry: acceptance criteria must be outcome-shaped. Criteria must describe the user-visible outcome, NOT the implementation mechanism. The asymmetry is the entire point: an outcome-shaped criterion cannot be designed to fit the code, so a passing criterion is evidence about the user-visible system, not about whatever implementation happens to live behind it today.

  • Good (outcome-shaped): "login completes within 200ms", "deletion is recoverable for 24 hours", "the validator never advances on a same-family wiring audit"
  • Bad (implementation-altitude — reject and request a rewrite): "LoginController returns HTTP 200", "the auth service sets a cookie", "the database row is updated"

When a criterion is at implementation-altitude, flag it explicitly: "This criterion is implementation-altitude ('LoginController returns HTTP 200'). Rewrite it as the user-visible outcome this implementation is supposed to produce (e.g., 'login completes within 200ms with no visible error')." Do not accept implementation-altitude criteria — they produce tests that verify the code's own implementation choices, not user outcomes.

Banned vague verbs. Reject the spec if requirements use these words without a measurable threshold: support, handle, robust, fast, secure, scalable, reliable, intuitive, seamless. Replace with measurable conditions (latency in ms, throughput in rps, specific failure modes prevented). This rule applies alongside the outcome-altitude rule — both must hold: no vague verbs AND outcome-shaped altitude.

Rules for good requirements:

  • Each requirement describes ONE behavior. If you write "and", split it.
  • Acceptance criteria must be falsifiable — an agent must be able to check pass/fail
  • Prefer test validation (unit/integration tests) over manual
  • Include edge cases as separate requirements, not footnotes
  • Aim for 3-10 requirements per spec. If you have more than 15, the spec is too broad — split it.
  • Spec budget: ≤300 lines. LeanSpec / Anthropic context-engineering: longer specs lose agent attention.

7. [NEEDS CLARIFICATION] discipline (middle ground)

  • A marker inside any ### SPEC-{slug}-NNN requirement section is BLOCKING: refuse to finalize the spec until resolved. Either ask the user, or move the question to "Open questions" and remove the dependent requirement.
  • A marker in non-requirement sections (Open questions list, "Future work" notes) is advisory: spec can finalize, but /sdd-plan will surface them again.

8. Sibling-repo heads-up

After drafting the spec, scan its file references (Technical approach, Dependencies, requirements). If any reference paths with a leading sibling-repo prefix — i.e., a top-level segment that is NOT a workspace directory like context/, spec/, scripts/, templates/ (examples that ARE sibling-repo prefixes: web-app/src/..., api-service/scripts/..., mobile-app/app/...) — emit a one-line reminder in the skill output:

Heads up: this spec references paths in <repo-name>/. When you run /sdd-plan against this spec, the generated PRD should set repoRoot to the absolute path of that repo. See context/decisions/sdd-reporoot-convention-2026-04-22.md.

The spec itself does NOT carry repoRoot — that field lives on the PRD. This step exists only to nudge the user so the prompt isn't skipped during /sdd-plan.

9. Optional adversarial review

Before save, optionally invoke the sdd-skeptic agent (if user wants extra scrutiny on a high-stakes spec):

  • Skeptic looks for: ambiguous shoulds, missing NFRs, contradictions between requirements, personas that lack situational depth, banned vague verbs slipped through.
  • Output: list of concrete weaknesses; spec author decides which to address before save.

This is opt-in — say "Run skeptic review on this spec? (y/n)". Default no.

10. Save and index

  • Save to context/specs/spec-{slug}.md
  • If context/specs/spec-overview.md exists, append an entry
  • Append to progress.txt: [{timestamp}] Created spec: context/specs/spec-{slug}.md — {title}

11. Self-audit

Run the spec template's "Self-audit checklist" (the trailer at the bottom of prd.md). Every box must check before reporting success. The implementer agent re-runs this checklist before claiming PASS on the final story.

Article 13 gates (must pass before reporting success):

  • outcomes/personas precede technical approach — Desired outcomes / JTBD and Personas & user stories both appear before Problem statement and Technical approach. If Technical approach leads, block Approved and request a reorder.
  • every requirement traces to a user story — Each SPEC-{slug}-NNN block carries a Serves: field naming the user story it advances. Any requirement with no Serves: link is an orphan requirement and blocks Approved. Flag each orphan explicitly: "Orphan requirement SPEC-{slug}-NNN: add a Serves: line naming the user story this requirement advances."

Both gates are deterministic: if either fails, the spec cannot be marked Approved. Do not emit an Approved status while either gate is open. These gates are also re-enforced by sdd_validate_prd at plan time (per Article 13).

12. Suggest next steps

  • "Run /sdd-plan to decompose this spec into implementable tasks"
  • "Run /sdd-spec [another feature] to spec the next feature"
  • If the spec has open questions (advisory, non-blocking), flag them: "Resolve open questions before planning if practical"

Output contract

  • context/specs/spec-{slug}.md exists with all template sections filled (Desired outcomes, Personas & user stories, Boundaries, self-audit included)
  • The spec's frontmatter-style metadata block contains an interface_maturity field with one of controlled-internal | documented-external | opaque-external (new PRDs only; existing PRDs without the field are grandfathered)
  • The spec leads with Desired outcomes / JTBD and Personas & user stories before Problem statement and Technical approach
  • Every requirement has a SPEC-{slug}-NNN traceability ID
  • Every requirement has a Serves: field naming the user story it advances (no orphan requirements — orphan requirements block approval)
  • Every requirement has Given/When/Then acceptance criteria — outcome-shaped (not implementation-altitude)
  • Every requirement has a validation method
  • No banned vague verbs without measurable thresholds
  • Normative sections follow the STE-100 writing rules (rules/ste100-writing.md); persona/outcome sections keep their situational voice
  • No [NEEDS CLARIFICATION] markers inside requirement blocks
  • No existing files are overwritten without confirmation
  • progress.txt is updated
  • If interface_maturity is opaque-external, the skill output includes the one-line advisory that this PRD will route to characterization at /sdd-plan time

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.