Generate a comprehensive feature specification following the SDD 11-section methodology, with integrated technical coaching that teaches spec-writing best practices in context. Use when the user says "specify", "create spec", "write spec", "define feature", "especificar", or runs /sdd:specify. This skill produces specs that are detailed enough for an LLM to implement directly: context, goals, user stories, functional and non-functional requirements, technical design, data models, API contract...
Scanned 5/27/2026
Install via CLI
openskills install rubenzarroca/sdd-plugin---
name: sdd-specify
description: >
Generate a comprehensive feature specification following the SDD 11-section methodology,
with integrated technical coaching that teaches spec-writing best practices in context.
Use when the user says "specify", "create spec", "write spec", "define feature",
"especificar", or runs /sdd:specify. This skill produces specs that are detailed enough
for an LLM to implement directly: context, goals, user stories, functional and non-functional
requirements, technical design, data models, API contracts, edge cases, and open questions.
Always check for a PRD in specs/prd.md first to inherit product-level context.
The spec is the source of truth — code is a derived artifact.
When the user writes something vague, ambiguous, or technically weak, Claude does NOT
just accept it — it coaches the user in real-time with concrete suggestions grounded in
their actual feature, teaching technical literacy through practice, not theory.
disable-model-invocation: true
argument-hint: "[feature-name]"
user-invokable: true
---
# SDD Specify — Feature Specification Generator (11-Section Methodology)
A feature spec is the bridge between product vision (PRD) and implementation. It defines everything an LLM or developer needs to build a feature correctly on the first pass: what it does, how it behaves, what data it touches, how components communicate, and what happens when things go wrong.
## Integrated Coaching Philosophy
This skill has a dual purpose: it generates specs AND teaches the user to write better specs over time. The coaching follows constructivist pedagogy — learning happens in the moment of need, within the real task, not in a separate module.
### How Coaching Works
Claude monitors everything the user provides during the specify workflow. When it detects a weakness, it applies **scaffolding**: a brief, contextual intervention that teaches a concept by applying it to the user's actual problem. The user learns without knowing they're being taught.
**Scaffolding triggers and responses:**
| What Claude detects | What Claude does |
|---|---|
| Vague requirement ("must be fast", "should handle many users", "needs to be secure") | Offers a concrete, quantified alternative using the user's own data. Example: "With 500 leads/week, a P95 response time of 500ms would keep the commercial team flowing. Want me to set that as the threshold?" |
| Missing edge case (no error handling mentioned for external dependencies) | Asks a scenario question. Example: "What should happen if BigQuery is down when a lead score is requested? Options: serve stale score with a warning, queue for retry, or return a default score." |
| Untestable acceptance criterion ("the UI should feel intuitive") | Reframes as testable. Example: "'Feel intuitive' is hard to test. Could we say 'a new user completes the main flow in under 3 clicks without documentation'? That's verifiable." |
| No non-goals defined | Prompts with a concrete example. Example: "What should this feature NOT do? For instance, should the scoring engine also handle lead nurturing, or is that out of scope?" |
| Data model gaps (referencing data without defining where it lives) | Makes the implicit explicit. Example: "You mentioned 'budget declared by the lead.' Where does this live? Is it a field in the CRM, a form input, or derived from behavior? This matters for the data model." |
| Ambiguous relationship between entities | Asks for cardinality. Example: "Can a lead belong to multiple promotions simultaneously, or is it always one promotion per lead? This changes the data model significantly." |
| Missing API contract details | Asks about the contract. Example: "You've described what the scoring endpoint does, but what should it return? A score number? A tier? The full breakdown? Defining the response shape now prevents refactoring later." |
| Security or compliance blind spot | Flags the gap. Example: "This feature processes phone numbers and emails. Does it need to comply with GDPR? If so, we need a consent field and a data retention policy in the spec." |
| Hardcoded values that should be configurable | Suggests configurability. Example: "You said the hot threshold is 75. What if that changes next quarter? If we make it configurable via a settings table, the team can adjust without a deploy." |
| Over-engineering (adding complexity not justified by requirements) | Pulls back. Example: "You're describing a real-time ML pipeline, but with 500 leads/week a simpler weighted scoring formula would work. We can always upgrade to ML later if the volume justifies it. Want to start simpler?" |
| User struggles with technically dense sections (data models, API contracts) — gives vague answers, says "I don't know", or defers entirely | Shift from "ask the user to provide" to "propose and choose" **using AskUserQuestionTool**. Instead of a conversational wall of text, present 2-3 concrete options as selectable choices — label with the option name, description with a one-sentence trade-off, and markdown preview with the technical details. Example: instead of asking "What should the response shape be?", present options like "Simple (score only)" / "Detailed (score + breakdown)" / "Flexible (configurable fields)" with preview showing the JSON shape for each. The user picks one; if none fit, they select "Other". If the user still can't choose, make the decision and note it in Open Questions for later review. |
### Scaffolding Rules
1. **Contextual, never abstract.** Never say "you should quantify your NFRs." Instead, offer the quantified version using their data. The user learns the concept by seeing it applied, not by hearing the theory.
2. **One intervention at a time.** If the user writes a paragraph with three weak points, address the most impactful one first. Come back to the others naturally as the spec develops.
3. **Suggest, don't impose.** Every coaching intervention ends with a question or option, never a mandate. DO: "With your volume, 500ms P95 might work. What do you think?" DON'T: "That's too vague. Here's what it should be: 500ms P95."
4. **Fade as competence grows.** Read `.sdd/state.json` field `coaching_profile` at the start of each session. It tracks two counters per scaffolding category (`quantified_nfrs`, `edge_cases`, `testable_criteria`, `non_goals`, `data_models`, `api_contracts`, `security`, `configurability`, `problem_vs_solution`, `measurable_outcomes`, `user_specificity`):
- `scaffolded`: times Claude had to intervene in this category.
- `unscaffolded`: times the user demonstrated competence without prompting.
When `unscaffolded` count for a category reaches 1, reduce coaching intensity — the user has shown they can do this. When it reaches 2+, stop coaching entirely. Repeating advice the user has internalized makes the system feel generic and heavy, not helpful.
After each specify session, update `coaching_profile` with the session's counts. **Cap `unscaffolded` increments at one per category per session** — a single well-written spec should not max out the fade for every category at once.
5. **Make the adaptation visible.** When the user writes something well, build on it: "That's a clean requirement. For the P99 case, do you want a different threshold or same?" When skipping coaching because the user has demonstrated competence, briefly acknowledge it: "Your edge cases are solid here — moving on." The user should feel the system adapting to them specifically, not running a generic checklist. Never say "great job!" — just move faster through areas they've mastered.
6. **Business language first, technical terms as bridges.** Introduce technical terms only when they're needed and always alongside their practical meaning. "Latencia en percentil 95 (P95)" means nothing without "es decir, que 95 de cada 100 peticiones responden en menos de ese tiempo."
7. **Use the user's project, not generic examples.** Every technical concept gets explained through the user's own business context. Reference the project description from `/sdd:init`, use their exact vocabulary (if they say "promotions" not "campaigns", say "promotions"), and when they've worked on previous features, reference those: "You handled this well in the [previous feature] spec." The system should feel like it knows this user and this project — not like a template applied to everyone.
---
## Pre-flight Checks
Before starting a spec, Claude MUST:
1. **Check for PRD:** Read `.sdd/state.json` and check `prd.status`. If `"approved"`, read `specs/prd.md` for content and load it as context. If `prd.status` is `"none"` or `"draft"`, warn the user: "No approved PRD found. I can write this spec standalone, but it won't inherit product-level context. Want to create a PRD first with /sdd:prd?"
2. **Check for constitution:** Read `constitution.md` if it exists. The spec must respect constitution principles (allowed deps, patterns, testing standards).
3. **Check state:** Read `.sdd/state.json`. If this feature already has a spec in progress, resume from where it left off rather than starting from scratch.
4. **Check for personal learnings:** Read `{your auto memory directory}/sdd-learnings.md` if it exists. This file contains your personal retro insights — kept outside the repo so each team member has their own. Past insights — especially those tagged **spec** — should inform the discovery questions and spec generation. For example, if a past learning says "always define error messages in the spec", proactively cover that area during Step 1. Do NOT fail if the file doesn't exist.
## Workflow
### Step 1: Feature Discovery
Ask focused questions to understand the feature. Ask ONE AT A TIME. Wait for confirmation before proceeding. Apply coaching scaffolding as answers come in.
**Always ask:**
1. "What is the name of this feature and what problem does it solve?"
- *Coaching trigger: If the answer describes a solution instead of a problem, redirect.* Example: "You're describing what you want to build, which is great, but let's start with the problem. What's happening today that's painful?"
2. "Who is the primary user of this feature?" (Cross-reference with PRD personas if available)
- *Coaching trigger: If the answer is too broad ("everyone", "the team"), narrow it.* Example: "Who specifically feels the most pain? The commercial rep who misses hot leads, or the team lead who can't see performance? Their needs might shape this differently."
3. "Walk me through the happy path: what does the user do, step by step, and what happens?"
- *Coaching trigger: If the path is too high-level, probe for specifics.* Example: "You said 'the system calculates a score.' Let's unpack that: what data goes in, what comes out, and where does the user see the result?"
**Then, based on answers, ask up to 3 targeted follow-up questions.** Focus on:
- Data: "What information does this feature need to work? Where does it come from?"
- Integrations: "Does this feature need to talk to any external system?"
- Constraints: "Are there any hard constraints I should know about? (performance, compliance, budget)"
**Maximum 7 questions total.** If you need more context, note it as open questions in the spec rather than interrogating the user.
### Step 2: Generate the Spec
Create the spec at `specs/[feature-name]/spec.md`. Follow this exact structure. Apply coaching scaffolding as you generate — if you're making assumptions or filling gaps, flag them explicitly and ask the user to confirm.
```markdown
# [Feature Name] — Specification
**Version:** 1.0
**Date:** [YYYY-MM-DD]
**Status:** Draft | Specified | Clarified
**PRD Reference:** specs/prd.md (Module: [module name]) | None
**Constitution:** [Confirmed compliant | No constitution found]
---
## 1. Metadata
| Field | Value |
|-------|-------|
| Feature | [name] |
| Author | [name] |
| Version | 1.0 |
| Status | Draft |
| Created | [YYYY-MM-DD] |
| Last updated | [YYYY-MM-DD] |
## 2. Context
[2-3 paragraphs. Describe the problem this feature solves, why it matters, and what
the current situation is. If a PRD exists, reference it and explain how this feature
fits within the broader product. This section should make someone who has never heard
of this feature understand its purpose in under 60 seconds.]
## 3. Goals & Non-Goals
### Goals
[3-5 outcomes this feature must achieve. Written as measurable results, not as tasks.
Each goal should be verifiable — if you can't write a test or metric for it, rewrite it.]
1. [Goal as measurable outcome]
2. [Goal as measurable outcome]
### Non-Goals
[What this feature explicitly does NOT do. Each non-goal should explain WHY it's excluded
to prevent future scope creep. This section is mandatory — a spec without non-goals is incomplete.]
1. [Non-goal] — Why: [reason]
2. [Non-goal] — Why: [reason]
## 4. User Stories
[Define the actors and their flows. Keep it practical — formal Given/When/Then if the
team uses BDD, narrative if not. The important thing is that each story is testable.]
### Actor: [Role]
**Story:** [What they do and what they expect to happen]
**Acceptance criteria:**
- Given [precondition], when [action], then [expected result]
- Given [precondition], when [action], then [expected result]
### Actor: [Role]
[Same structure]
## 5. Functional Requirements
[The "what it does" in detail. Each requirement must be specific enough to write a test for.
Use IDs (FR-001, FR-002...) so they can be referenced in tasks and validation.]
- **FR-001:** [Specific, testable requirement]
- **FR-002:** [Specific, testable requirement]
- **FR-003:** [Specific, testable requirement]
## 6. Non-Functional Requirements
[Performance, security, scalability, observability, accessibility. The constraints that
define "how well" the feature must work. Use IDs (NFR-001, NFR-002...).]
- **NFR-001:** [Quantified constraint, e.g., "P95 response time < 200ms"]
- **NFR-002:** [Quantified constraint]
- **NFR-003:** [Quantified constraint]
## 7. Technical Design
[Stack, architecture patterns, and decisions already made. Reference the constitution
if it constrains choices. Explain the WHY behind each decision — this prevents the LLM
from second-guessing choices during implementation.]
### Stack
[List technologies and justify each choice briefly]
### Architecture
[How components are organized. Include a simple diagram if helpful (ASCII or mermaid)]
### Decisions & Rationale
[Key technical decisions with their reasoning. Format as lightweight ADRs:]
**Decision:** [What was decided]
**Context:** [Why this decision was needed]
**Rationale:** [Why this option was chosen over alternatives]
**Consequences:** [What this means for implementation]
## 8. Data Models
[Entities, fields, types, relationships. Be explicit — this is the section with the
highest ROI for code generation quality. If the LLM has a precise data model,
the generated code is consistent from the first attempt.]
### Entity: [name]
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | uuid | yes | Primary key |
| [field] | [type] | [yes/no] | [description] |
### Relationships
[How entities relate to each other. One-to-many, many-to-many, etc.]
## 9. API Contracts
[Endpoints, methods, payloads, response codes. This is the contract between components.
If two features need to communicate, both specs should reference the same contract.]
### `[METHOD] /[endpoint]`
**Purpose:** [What this endpoint does]
**Request:**
```json
{
"field": "type — description"
}
```
**Response (200):**
```json
{
"field": "type — description"
}
```
**Error codes:**
| Code | Meaning |
|------|---------|
| 400 | [When this happens] |
| 404 | [When this happens] |
| 500 | [When this happens] |
## 10. Edge Cases & Error Handling
[The section that separates amateur specs from professional ones. List the scenarios that
are rare but real: dirty data, race conditions, external service failures, boundary values.
Each edge case must have an explicit expected behavior — never leave it to the LLM to decide.]
| ID | Scenario | Expected Behavior |
|----|----------|-------------------|
| EC-001 | [What goes wrong] | [What the system should do] |
| EC-002 | [What goes wrong] | [What the system should do] |
## 11. Open Questions
[Things not yet decided. Each question has an owner and a deadline. This section is a
signal to the LLM: "don't improvise here, ask instead." Questions resolved during
clarify should be moved to the relevant section with their answer.]
- [ ] [Question] — Owner: [name] — By: [date]
- [ ] [Question] — Owner: [name] — By: [date]
## Clarifications
<!-- Added by /sdd:clarify. Do not edit manually. -->
```
### Step 3: Post-Generation Coaching Review
After generating the spec, Claude performs a self-audit and presents the spec **section by section** as a guided walkthrough rather than a single document dump. Use these fixed groupings:
- **Group 1** (present together): Metadata, Context, Goals & Non-Goals
- **Group 2** (present together): User Stories, Functional Requirements
- **Group 3** (present alone, pause for confirmation): Non-Functional Requirements
- **Group 4** (present alone, pause for confirmation): Technical Design
- **Group 5** (present alone, pause for confirmation): Data Models
- **Group 6** (present alone, pause for confirmation): API Contracts
- **Group 7** (present together): Edge Cases, Open Questions
The goal is co-authorship: the user should feel they shaped the spec, not that they received a finished artifact they can only accept or reject.
For each section, check:
| Section | Coaching check |
|---|---|
| Context | Does it explain the problem in business terms? Would a non-technical stakeholder understand? |
| Goals | Are all goals measurable? Flag any that aren't with a coaching suggestion. |
| Non-Goals | Are there at least 2? If missing, generate candidates and ask the user to confirm. |
| User Stories | Are acceptance criteria testable? Flag vague ones. |
| Functional Reqs | Does each have an ID? Is each specific enough to write a test? |
| Non-Functional Reqs | Is each quantified? Flag any without numbers: "This NFR says 'must be scalable.' What does that mean for your case? 10K leads? 100K? Let's put a number on it." |
| Technical Design | Does it respect the constitution? Are decisions justified with rationale? |
| Data Models | Are all referenced entities defined? Are relationships explicit? |
| API Contracts | Are request/response shapes defined? Are error codes listed? |
| Edge Cases | Are there at least 3? If not, suggest likely ones based on the feature. |
| Open Questions | Are blocking questions flagged? Do they have owners? |
Present the spec to the user with coaching notes inline. Example:
> "I've generated the spec. A few things I'd like you to look at:
>
> In NFR-002, you mentioned 'must handle high traffic' — with your current volume of 500 leads/week, I've estimated P95 < 500ms as a reasonable threshold. Does that work?
>
> I only found 2 edge cases. What happens if a lead submits the form twice in quick succession? And what if the promotion they selected gets deactivated between form submission and scoring? These are common in proptech flows."
### Step 4: State Update & Handoff
After the user confirms the spec:
1. Update `.sdd/state.json`:
- Set `active_feature` to `"[feature-name]"`.
- Validate the transition: check `allowed_transitions` in state.json to confirm that the current state (or `"drafting"` for new features) allows transitioning to `"specified"`. If the transition is not listed, warn the user and do not proceed.
- Create the feature entry under `features`:
```json
{
"features": {
"[feature-name]": {
"state": "specified",
"spec_path": "specs/[feature-name]/spec.md",
"prd_reference": "specs/prd.md",
"transitions": [
{
"from": "drafting",
"to": "specified",
"at": "{ISO 8601 timestamp}",
"command": "sdd-specify"
}
]
}
}
}
```
- If the feature already exists in `features` (re-specifying), replace its entry entirely with the above.
2. Tell the user: "Spec created at `specs/[feature-name]/spec.md`." Then check `completed_features` from state.json:
- If `0`: Recommend clarify: "I recommend running `/sdd:clarify` next — even experienced spec writers miss gaps on first drafts, and catching them now prevents bugs during implementation."
- If `1+`: Present both options neutrally: "Next: `/sdd:clarify [feature-name]` to find gaps, or `/sdd:plan [feature-name]` if you're confident the spec is complete."
3. Do NOT auto-advance. Wait for the user's explicit instruction.
## Calibration Rules
1. **Depth matches complexity.** A webhook spec might leave sections 8-9 minimal. A scoring engine needs all 11 sections fully populated. Claude should calibrate depth to the feature's complexity and risk.
2. **PRD context is inherited, not repeated.** If the PRD explains the problem, the spec's Context section should reference it and add feature-specific context, not copy-paste from the PRD.
3. **Testable or it doesn't count.** Every functional requirement must be specific enough to write a test. "The system should be fast" is not a requirement. "P95 latency < 200ms under 100 concurrent requests" is. When the user writes something untestable, coach them toward a testable version using their own data.
4. **Edge cases are mandatory.** A spec with fewer than 3 edge cases is almost certainly missing something. Push the user to think about dirty data, failures, and race conditions. If they struggle, suggest likely scenarios based on the feature domain.
5. **Constitution compliance is non-negotiable.** If the constitution says "no ORMs", the technical design section cannot include an ORM. If there's a conflict between what the user wants and the constitution, flag it explicitly and ask the user to resolve it.
6. **One question at a time during discovery.** Never batch questions. Wait for the answer before asking the next.
7. **Non-goals are mandatory.** A spec without non-goals is incomplete. If the user doesn't volunteer them, ask: "What should this feature explicitly NOT do?"
8. **Coaching fades with competence.** If the user consistently provides quantified NFRs, stop coaching on quantification. If they always include edge cases, stop prompting for them. The scaffolding is responsive, not a checklist.
9. **Propose, don't extract, when the user is stuck.** For technically dense sections (Data Models, API Contracts, Technical Design), if the user cannot provide the information, Claude should propose concrete options grounded in the user's business context rather than asking open-ended technical questions. The user's role shifts from "author" to "reviewer" for these sections — Claude drafts, the user approves or adjusts.
## Relationship to Other SDD Commands
- **Upstream:** `/sdd:prd` produces the PRD that provides context to this spec
- **Downstream:** `/sdd:clarify` analyzes this spec for gaps; `/sdd:plan` generates the technical plan from this spec
- **Validation:** `/sdd:validate` checks implementation against the requirements defined here (FR-xxx, NFR-xxx)
- **Cross-reference:** Requirement IDs (FR-001, NFR-001, EC-001) are referenced by `/sdd:tasks` and `/sdd:validate`
$ARGUMENTS
No comments yet. Be the first to comment!