Spec Creator
Create implementation-grade SPEC.md files through structured brainstorming, then drafting, then
self-review. The output is a single monolithic Markdown specification that an AI coding agent can
implement without asking clarifying questions.
Quality Bar
The target quality level is a portable implementation contract — the kind of document a
principal engineer writes so any competent engineer (or AI agent) in any language can build a
conforming implementation. Read references/quality-bar.md for the full quality rubric before
starting any spec.
Key quality markers (internalize these, don't just check them off):
- Every entity field has a type, default value (if applicable), and validation rule
- Every error has a named category and explicit recovery behavior
- Every state transition has explicit triggers and outcomes
- Every boundary says what is in scope AND what is out of scope
- Reference algorithms are provided in language-agnostic pseudocode for complex logic
- Configuration has a cheat-sheet section for quick agent consumption
- The test/validation matrix maps back to spec sections
- Forward compatibility is addressed (e.g., "unknown keys should be ignored")
- The spec is self-contained: an agent reading only this file can implement the system
Workflow
The spec creation process has 4 phases. Follow them in order.
Phase 1: Intake and Calibration
When the user provides their input (anything from a one-liner to a detailed brain-dump):
Parse what's already been said. Extract every concrete decision, constraint, technology
choice, boundary, entity, and opinion from the user's input.
Classify input depth:
- Sparse (1-3 sentences, just an idea): The user needs heavy discovery. Start with
foundational questions about problem, users, scope.
- Medium (a paragraph or two with some decisions made): The user has direction. Focus on
filling architectural and domain-model gaps.
- Rich (detailed brain-dump with technology choices, entity sketches, constraints): The user
has thought deeply. Focus on edge cases, failure modes, and contract boundaries.
Acknowledge what you understood. Before asking questions, write a short summary (3-5
sentences) of what you extracted from their input. This lets the user correct misunderstandings
early. Frame it as: "Here's what I'm taking as given from what you've described: [summary]. Now
let me ask about the gaps."
Phase 2: Brainstorming Rounds
Ask questions one round at a time. Each round should have 3-6 questions, grouped by a coherent
theme. Do NOT dump all questions at once. Wait for the user's answers before proceeding.
Continue rounds until all 10 knowledge domains are sufficiently covered for the task's complexity.
Not every domain applies to every task — use judgment. But never skip a domain without consciously
deciding it's irrelevant.
Read references/brainstorm-domains.md for the full questioning framework. Here is the summary:
The 10 Knowledge Domains:
- Problem & Scope — What problem? Who benefits? What's the boundary?
- Architecture & Components — What are the pieces? How do they connect?
- Domain Model — What are the core entities, their fields, relationships?
- Configuration & Inputs — What's configurable? Defaults? Validation?
- State & Lifecycle — What states exist? What triggers transitions?
- Integration Contracts — External systems, protocols, API shapes?
- Failure & Recovery — What breaks? How does the system recover?
- Security & Safety — Trust boundaries? Invariants? Secrets?
- Observability — Logs, metrics, debugging? What does an operator need?
- Testing & Validation — How do you prove correctness?
Questioning strategy by input depth:
- Sparse input: Start with Domain 1 (Problem & Scope) and Domain 2 (Architecture). These
unlock everything else. Expect 5-8 rounds total.
- Medium input: Start with whichever domain has the biggest gaps. Expect 3-5 rounds.
- Rich input: Jump straight to edge cases — Domains 7 (Failure), 8 (Security), and 10
(Testing) are usually the least-specified even in detailed brain-dumps. Expect 2-4 rounds.
Rules for good brainstorming questions:
- Ask about decisions, not preferences. "What happens when the webhook delivery fails after 3
retries?" not "How do you feel about retry strategies?"
- Offer concrete options when the decision space is bounded. "Should failed jobs be retried with
exponential backoff (recommended), fixed delay, or not retried?" — this accelerates the user.
- Flag when you're making an assumption. "I'm assuming WebSocket for real-time updates — push back
if you prefer SSE or polling."
- Ask about what should NOT happen. Non-goals and anti-patterns are as valuable as goals.
- Ask about the consumer agent's needs. "Will the implementing agent need to handle graceful
shutdown, or is hard-kill acceptable?"
When to stop brainstorming:
Stop when you can mentally draft every section header AND fill in the first paragraph of each
section without guessing. If you find yourself thinking "I'd have to make something up for the
failure recovery section," you need another round.
Phase 3: Drafting the SPEC.md
Read references/section-templates.md for the canonical section structure and what belongs in each
section. Then draft the full spec.
Section Structure (adapt to the task — not every section applies to every system):
1. Problem Statement
2. Goals and Non-Goals
3. System Overview (components, layers, external deps)
4. Core Domain Model (entities, fields, types, normalization)
5. [Domain-Specific Contract] (e.g., Workflow Spec, API Spec, Protocol Spec)
6. Configuration Specification (schema, defaults, resolution, dynamic reload)
7. State Machine / Lifecycle (states, transitions, triggers)
8. Core Algorithms (scheduling, routing, processing — pseudocode)
9. [Integration Contracts] (per external system)
10. [Subsystem Contracts] (per major internal subsystem)
11. Prompt/Context Assembly (if AI-related)
12. Logging, Status, and Observability
13. Failure Model and Recovery Strategy
14. Security and Operational Safety
15. Reference Algorithms (language-agnostic pseudocode)
16. Test and Validation Matrix
17. Implementation Checklist (Definition of Done)
Drafting rules — these are critical for agent-consumable specs:
Every field needs a type. Not "the timeout setting" but
"turn_timeout_ms (integer) — Default: 3600000 (1 hour)".
Every default needs a value. If something is optional, say what happens when it's absent.
Never "defaults to a reasonable value" — always "defaults to 30000".
Every error needs a name and a recovery. Not "handle errors gracefully" but
"workspace_creation_failed — Fail the current run attempt. Orchestrator will retry with
exponential backoff."
Every boundary needs both sides. "Symphony IS a scheduler/runner. Symphony is NOT a ticket
writer." Agents take unstated scope as license to expand.
Use pseudocode for complex logic. Any algorithm with branching, loops, or sequencing gets a
pseudocode block. Use function name(params): style, not any specific language.
Include a config cheat sheet. A flat list of every config key, its type, and its default.
Agents parse this faster than hunting through nested sections.
Include "Important boundary" and "Important nuance" callouts. These prevent the most common
misimplementation. Place them inline where the misunderstanding would occur.
State validation profiles in the test matrix. "Core Conformance" (must-pass), "Extension
Conformance" (if-you-ship-it-test-it), "Integration Profile" (needs real credentials).
End with a Definition of Done checklist. This is the literal implementation punch-list.
Group by conformance profile.
Write for the agent, not for a human skimming. Be explicit, repetitive where it aids
clarity, and never ambiguous. Agents don't infer intent — they follow contracts. Intentional
redundancy (like a config cheat sheet that restates what's in the config section) is a feature,
not a bug.
Output format:
- Default: single monolithic
SPEC.md file
- If the draft exceeds ~2000 lines, offer to split into logical files:
SPEC.md (core spec)
DOMAIN_MODEL.md (entities, fields, normalization)
TEST_MATRIX.md (validation matrix + implementation checklist)
- Create the file(s) in
/home/claude/ during drafting, then copy to /mnt/user-data/outputs/
when presenting.
Phase 4: Self-Review
Before presenting the spec to the user, run a self-review against the quality bar. Read
references/self-review-checklist.md for the full checklist.
Self-review process:
Walk through every section and ask: "Could an AI coding agent implement this section without
asking me a single clarifying question?" If no, fix it.
Check for these common spec failures:
- Vague defaults: Any "reasonable", "appropriate", "as needed" → replace with concrete value
- Missing error handling: Any operation without a failure path → add one
- Implicit state transitions: Any state change without an explicit trigger → add the trigger
- Unbounded behavior: Any loop, retry, or timeout without a cap → add the cap
- Unclear boundaries: Any component without explicit in-scope/out-of-scope → add them
- Missing types: Any field without a type annotation → add the type
- Hand-wavy sections: Any section that says "implementation-defined" without documenting what
the implementation must decide → enumerate the decisions
Produce a Review Summary (shown to user alongside the spec):
- Number of sections
- Total line count
- Gaps found and fixed during self-review
- Any remaining
[TBD] markers with explanation of what's needed
- Confidence assessment: "Ready for implementation" / "Needs user input on N items"
If the spec exceeds ~2000 lines, proactively offer to split it.
Iteration
After presenting the spec, the user may request changes. When iterating:
- Apply changes surgically — don't regenerate the entire spec for a localized fix
- If the user's feedback reveals a gap in your understanding, you may need another brainstorming
round before editing
- Re-run the self-review checklist on modified sections
- Track iteration count and present a changelog summary
Anti-Patterns to Avoid
- The PRD trap: Don't write user stories, acceptance criteria, or business justification. This
is an implementation contract, not a product requirements doc.
- The HLD trap: Don't stop at boxes-and-arrows. Every component needs its internal contract.
- The design doc trap: Don't include alternatives-considered or decision rationale (unless the
user explicitly wants ADRs). The spec is the decision.
- The tutorial trap: Don't explain concepts. Assume the reader (an AI agent) knows programming,
distributed systems, and common patterns. Explain domain-specific decisions.
- The over-prescription trap: Don't specify implementation language, framework, or library
unless the user explicitly chose them. Keep the spec portable.
- The under-specification trap: Don't say "handle errors appropriately" or "use standard
practices." Every behavior must be explicit enough to implement without judgment calls.
1---2name: spec-creator3description: Create production-grade SPEC.md files — portable implementation contracts that any AI coding agent can build from without follow-up questions. Use this skill whenever the user wants to write a spec, specification, technical spec, implementation contract, SPEC.md, or service specification for any software task. Also trigger when the user says "spec out", "write a spec for", "create a spec", "define the contract for", or describes a system they want built and needs a thorough specification before implementation. This skill works for backend services, full-stack apps, CLI tools, SDKs, developer tools, and any domain. It produces specs at the level of a principal-engineer-authored portable implementation contract — not a PRD, not an HLD, but the artifact that sits between architecture and code.4---56# Spec Creator78Create implementation-grade SPEC.md files through structured brainstorming, then drafting, then9self-review. The output is a single monolithic Markdown specification that an AI coding agent can10implement without asking clarifying questions.1112## Quality Bar1314The target quality level is a **portable implementation contract** — the kind of document a15principal engineer writes so any competent engineer (or AI agent) in any language can build a16conforming implementation. Read `references/quality-bar.md` for the full quality rubric before17starting any spec.1819Key quality markers (internalize these, don't just check them off):2021- Every entity field has a type, default value (if applicable), and validation rule22- Every error has a named category and explicit recovery behavior23- Every state transition has explicit triggers and outcomes24- Every boundary says what is in scope AND what is out of scope25- Reference algorithms are provided in language-agnostic pseudocode for complex logic26- Configuration has a cheat-sheet section for quick agent consumption27- The test/validation matrix maps back to spec sections28- Forward compatibility is addressed (e.g., "unknown keys should be ignored")29- The spec is self-contained: an agent reading only this file can implement the system3031## Workflow3233The spec creation process has 4 phases. Follow them in order.3435### Phase 1: Intake and Calibration3637When the user provides their input (anything from a one-liner to a detailed brain-dump):38391. **Parse what's already been said.** Extract every concrete decision, constraint, technology40 choice, boundary, entity, and opinion from the user's input.41422. **Classify input depth:**43 - **Sparse** (1-3 sentences, just an idea): The user needs heavy discovery. Start with44 foundational questions about problem, users, scope.45 - **Medium** (a paragraph or two with some decisions made): The user has direction. Focus on46 filling architectural and domain-model gaps.47 - **Rich** (detailed brain-dump with technology choices, entity sketches, constraints): The user48 has thought deeply. Focus on edge cases, failure modes, and contract boundaries.49503. **Acknowledge what you understood.** Before asking questions, write a short summary (3-551 sentences) of what you extracted from their input. This lets the user correct misunderstandings52 early. Frame it as: "Here's what I'm taking as given from what you've described: [summary]. Now53 let me ask about the gaps."5455### Phase 2: Brainstorming Rounds5657Ask questions **one round at a time**. Each round should have 3-6 questions, grouped by a coherent58theme. Do NOT dump all questions at once. Wait for the user's answers before proceeding.5960Continue rounds until all 10 knowledge domains are sufficiently covered for the task's complexity.61Not every domain applies to every task — use judgment. But never skip a domain without consciously62deciding it's irrelevant.6364Read `references/brainstorm-domains.md` for the full questioning framework. Here is the summary:6566**The 10 Knowledge Domains:**67681. **Problem & Scope** — What problem? Who benefits? What's the boundary?692. **Architecture & Components** — What are the pieces? How do they connect?703. **Domain Model** — What are the core entities, their fields, relationships?714. **Configuration & Inputs** — What's configurable? Defaults? Validation?725. **State & Lifecycle** — What states exist? What triggers transitions?736. **Integration Contracts** — External systems, protocols, API shapes?747. **Failure & Recovery** — What breaks? How does the system recover?758. **Security & Safety** — Trust boundaries? Invariants? Secrets?769. **Observability** — Logs, metrics, debugging? What does an operator need?7710. **Testing & Validation** — How do you prove correctness?7879**Questioning strategy by input depth:**8081- **Sparse input:** Start with Domain 1 (Problem & Scope) and Domain 2 (Architecture). These82 unlock everything else. Expect 5-8 rounds total.83- **Medium input:** Start with whichever domain has the biggest gaps. Expect 3-5 rounds.84- **Rich input:** Jump straight to edge cases — Domains 7 (Failure), 8 (Security), and 1085 (Testing) are usually the least-specified even in detailed brain-dumps. Expect 2-4 rounds.8687**Rules for good brainstorming questions:**8889- Ask about decisions, not preferences. "What happens when the webhook delivery fails after 390 retries?" not "How do you feel about retry strategies?"91- Offer concrete options when the decision space is bounded. "Should failed jobs be retried with92 exponential backoff (recommended), fixed delay, or not retried?" — this accelerates the user.93- Flag when you're making an assumption. "I'm assuming WebSocket for real-time updates — push back94 if you prefer SSE or polling."95- Ask about what should NOT happen. Non-goals and anti-patterns are as valuable as goals.96- Ask about the consumer agent's needs. "Will the implementing agent need to handle graceful97 shutdown, or is hard-kill acceptable?"9899**When to stop brainstorming:**100101Stop when you can mentally draft every section header AND fill in the first paragraph of each102section without guessing. If you find yourself thinking "I'd have to make something up for the103failure recovery section," you need another round.104105### Phase 3: Drafting the SPEC.md106107Read `references/section-templates.md` for the canonical section structure and what belongs in each108section. Then draft the full spec.109110**Section Structure (adapt to the task — not every section applies to every system):**111112```1131. Problem Statement1142. Goals and Non-Goals1153. System Overview (components, layers, external deps)1164. Core Domain Model (entities, fields, types, normalization)1175. [Domain-Specific Contract] (e.g., Workflow Spec, API Spec, Protocol Spec)1186. Configuration Specification (schema, defaults, resolution, dynamic reload)1197. State Machine / Lifecycle (states, transitions, triggers)1208. Core Algorithms (scheduling, routing, processing — pseudocode)1219. [Integration Contracts] (per external system)12210. [Subsystem Contracts] (per major internal subsystem)12311. Prompt/Context Assembly (if AI-related)12412. Logging, Status, and Observability12513. Failure Model and Recovery Strategy12614. Security and Operational Safety12715. Reference Algorithms (language-agnostic pseudocode)12816. Test and Validation Matrix12917. Implementation Checklist (Definition of Done)130```131132**Drafting rules — these are critical for agent-consumable specs:**1331341. **Every field needs a type.** Not "the timeout setting" but135 "`turn_timeout_ms` (integer) — Default: `3600000` (1 hour)".1361372. **Every default needs a value.** If something is optional, say what happens when it's absent.138 Never "defaults to a reasonable value" — always "defaults to `30000`".1391403. **Every error needs a name and a recovery.** Not "handle errors gracefully" but141 "`workspace_creation_failed` — Fail the current run attempt. Orchestrator will retry with142 exponential backoff."1431444. **Every boundary needs both sides.** "Symphony IS a scheduler/runner. Symphony is NOT a ticket145 writer." Agents take unstated scope as license to expand.1461475. **Use pseudocode for complex logic.** Any algorithm with branching, loops, or sequencing gets a148 pseudocode block. Use `function name(params):` style, not any specific language.1491506. **Include a config cheat sheet.** A flat list of every config key, its type, and its default.151 Agents parse this faster than hunting through nested sections.1521537. **Include "Important boundary" and "Important nuance" callouts.** These prevent the most common154 misimplementation. Place them inline where the misunderstanding would occur.1551568. **State validation profiles in the test matrix.** "Core Conformance" (must-pass), "Extension157 Conformance" (if-you-ship-it-test-it), "Integration Profile" (needs real credentials).1581599. **End with a Definition of Done checklist.** This is the literal implementation punch-list.160 Group by conformance profile.16116210. **Write for the agent, not for a human skimming.** Be explicit, repetitive where it aids163 clarity, and never ambiguous. Agents don't infer intent — they follow contracts. Intentional164 redundancy (like a config cheat sheet that restates what's in the config section) is a feature,165 not a bug.166167**Output format:**168169- Default: single monolithic `SPEC.md` file170- If the draft exceeds ~2000 lines, offer to split into logical files:171 - `SPEC.md` (core spec)172 - `DOMAIN_MODEL.md` (entities, fields, normalization)173 - `TEST_MATRIX.md` (validation matrix + implementation checklist)174- Create the file(s) in `/home/claude/` during drafting, then copy to `/mnt/user-data/outputs/`175 when presenting.176177### Phase 4: Self-Review178179Before presenting the spec to the user, run a self-review against the quality bar. Read180`references/self-review-checklist.md` for the full checklist.181182**Self-review process:**1831841. Walk through every section and ask: "Could an AI coding agent implement this section without185 asking me a single clarifying question?" If no, fix it.1861872. Check for these common spec failures:188 - **Vague defaults:** Any "reasonable", "appropriate", "as needed" → replace with concrete value189 - **Missing error handling:** Any operation without a failure path → add one190 - **Implicit state transitions:** Any state change without an explicit trigger → add the trigger191 - **Unbounded behavior:** Any loop, retry, or timeout without a cap → add the cap192 - **Unclear boundaries:** Any component without explicit in-scope/out-of-scope → add them193 - **Missing types:** Any field without a type annotation → add the type194 - **Hand-wavy sections:** Any section that says "implementation-defined" without documenting what195 the implementation must decide → enumerate the decisions1961973. Produce a **Review Summary** (shown to user alongside the spec):198 - Number of sections199 - Total line count200 - Gaps found and fixed during self-review201 - Any remaining `[TBD]` markers with explanation of what's needed202 - Confidence assessment: "Ready for implementation" / "Needs user input on N items"2032044. If the spec exceeds ~2000 lines, proactively offer to split it.205206## Iteration207208After presenting the spec, the user may request changes. When iterating:209210- Apply changes surgically — don't regenerate the entire spec for a localized fix211- If the user's feedback reveals a gap in your understanding, you may need another brainstorming212 round before editing213- Re-run the self-review checklist on modified sections214- Track iteration count and present a changelog summary215216## Anti-Patterns to Avoid217218- **The PRD trap:** Don't write user stories, acceptance criteria, or business justification. This219 is an implementation contract, not a product requirements doc.220- **The HLD trap:** Don't stop at boxes-and-arrows. Every component needs its internal contract.221- **The design doc trap:** Don't include alternatives-considered or decision rationale (unless the222 user explicitly wants ADRs). The spec is the decision.223- **The tutorial trap:** Don't explain concepts. Assume the reader (an AI agent) knows programming,224 distributed systems, and common patterns. Explain domain-specific decisions.225- **The over-prescription trap:** Don't specify implementation language, framework, or library226 unless the user explicitly chose them. Keep the spec portable.227- **The under-specification trap:** Don't say "handle errors appropriately" or "use standard228 practices." Every behavior must be explicit enough to implement without judgment calls.