Transforms ADRs into precise implementation contracts, covering data types, signatures, and constraints.
Install
mkdir -p .claude/skills/write-spec && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12040" && unzip -o skill.zip -d .claude/skills/write-spec && rm skill.zipInstalls to .claude/skills/write-spec
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Write a formal specification from accepted ADRs and idea docs. Interviews about contract boundaries, sketches bounded concerns, and produces a spec with no hand-waving. Use when: transitioning from accepted ADRs to implementation specs, formalizing API surfaces, wire protocols, or data formats. Must have at least one accepted ADR as input.Key capabilities
- →Gather input from accepted ADRs and idea documents
- →Interview the user to resolve ambiguities in contract boundaries
- →Sketch bounded concerns to determine spec scope
- →Write a formal specification using a project template
- →Perform a rigor check on the drafted specification
How it works
The skill reads ADRs, interviews the user to clarify contract details, structures the specification into bounded concerns, and then writes the spec using a template, followed by a rigor check.
Inputs & outputs
When to use write-spec
- →Draft implementation specs from ADRs
- →Define API contract boundaries
- →Formalize data structures from decisions
About this skill
Write Spec
Turn accepted ADRs into formal implementation contracts. A spec defines the exact interface, behavior, and constraints that code must satisfy.
Skip for: decisions that don't need formal contracts (tooling config, doc conventions), or when the ADR itself is specific enough to implement from directly.
Process
1. Gather Input
Read the accepted ADR(s) that led to this spec. Read the idea docs they reference. Identify what the spec must formalize — the ADR decided what, the spec defines how exactly.
2. Interview About the Contract Boundary
Walk through each branch of the contract, resolving ambiguity:
- Types: What are the exact data structures? Field names, types, optionality, invariants.
- Functions/Messages: What are the signatures? Parameters, return types, error types.
- Error Cases: What can go wrong? How is each error reported? What does the caller do?
- Edge Cases: Empty input, maximum sizes, concurrent access, version mismatches.
- Constraints: Performance budgets, memory limits, security requirements.
- Ordering: Are operations sequential, concurrent, or unordered? What happens during races?
For each question, provide a recommended answer. If the answer requires exploration (reading existing code, checking a dependency's API), do the exploration.
3. Sketch Bounded Concerns
Identify if this spec should be one document or split into multiple specs. One spec per bounded concern:
- One API surface (plugin API, config API, agent control API)
- One wire protocol (daemon↔client IPC, remote access WebSocket)
- One data format (session serialization, scroll buffer archive format)
Look for opportunities to extract deep modules — interfaces that encapsulate complexity behind a simple, testable boundary that rarely changes.
4. Write the Spec
Use the project's spec template (docs/specs/0000-template.md). Every section must be concrete:
Overview: One paragraph — what this spec defines and why.
Contract: The formal definition. No hand-waving. Every type is defined. Every function has a signature. Every message has a format. If referencing an IDL file (.proto, .wit), the IDL is the source of truth and the spec explains behavior and constraints the IDL can't express.
Behavior: Expected behavior for normal and error cases. Edge cases called out explicitly. State transitions documented if applicable.
Constraints: Performance budgets, memory limits, security requirements, backward compatibility guarantees.
References: Link to the ADR(s) that led here and the idea doc(s) for broader context.
5. Rigor Check
Before presenting the spec:
- Every type is fully defined (no
TBD,details later,to be determined) - Every function/message has input types, output types, and error types
- Every error case has a defined behavior (what happens, what the caller sees)
- Edge cases are called out (empty, maximum, concurrent, disconnected)
- Constraints are measurable (not "fast" but "< X ms" or "competitive with Y")
- All ADR decisions are reflected in the spec
- Cross-references link to real docs
- If an IDL file is referenced, its path is specified
6. Checks
mise run fmt— formatmise run lint— lint/de-slopifyon all prose- Verify frontmatter is complete (spec number, title, status: draft, date, ADR references, tags)
- Check all cross-references resolve
7. Update Index
- Add the new spec to the index table in
docs/specs/README.md. - Update cross-references in related ADR and idea docs if needed.
8. Commit Gate
Present the spec summary and wait for explicit "commit" before committing.
Common Mistakes
| Mistake | Fix |
|---|---|
| Spec restates the ADR's rationale | Spec defines the contract; ADR explains why. Don't duplicate. |
| "TBD" or "details later" in any section | Resolve it now or split into a separate spec with a dependency note. |
| Types defined only by example | Write the full type definition. Examples supplement, not replace. |
| Error cases listed without behavior | For each error: what does the system do? What does the caller see? |
| Performance constraints as absolutes | Use "competitive with X" or "measured by benchmark Y" per ADR-0002. |
| Spec too broad (covers multiple concerns) | Split into focused specs. One API surface, one protocol, one format. |
Output
A spec file at docs/specs/NNNN-short-title.md following the project template. If the spec references an IDL, the IDL file path is specified (the file itself may not exist yet — the spec is the contract, the IDL is generated during implementation).
When not to use it
- →For decisions that do not need formal contracts
- →When the ADR itself is specific enough to implement from directly
Limitations
- →Requires at least one accepted ADR as input
- →Does not generate IDL files, only specifies their path if referenced
- →Requires explicit user confirmation before committing the spec
How it compares
This skill formalizes implementation contracts by systematically gathering input, resolving ambiguities through user interviews, and structuring the output according to a template, which is more structured than manually drafting a spec from
Compared to similar skills
write-spec side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| write-spec (this skill) | 0 | 4mo | No flags | Intermediate |
| project-planner | 32 | 9mo | Review | Intermediate |
| spec-kit-workflow | 11 | 8mo | No flags | Intermediate |
| specification-architect | 13 | 9mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by oakoss
View all by oakoss →You might also like
project-planner
adrianpuiu
Comprehensive project planning and documentation generator for software projects. Creates structured requirements documents, system design documents, and task breakdown plans with implementation tracking. Use when starting a new project, defining specifications, creating technical designs, or breaking down complex systems into implementable tasks. Supports user story format, acceptance criteria, component design, API specifications, and hierarchical task decomposition with requirement traceability.
spec-kit-workflow
jmanhype
Guides specification-driven development workflow. Automatically invoked when discussing new features, specifications, technical planning, or implementation tasks. Ensures proper workflow phases (specify → clarify → plan → checklist → tasks → analyze → implement).
specification-architect
adrianpuiu
A rigorous, traceability-first system that generates five interconnected architectural documents (blueprint.md, requirements.md, design.md, tasks.md, and validation.md) with complete requirements-to-implementation traceability. Use this skill when users need to architect systems, create technical specifications, or develop structured project documentation with guaranteed traceability.
architecture
davila7
Architectural decision-making framework. Requirements analysis, trade-off evaluation, ADR documentation. Use when making architecture decisions or analyzing system design.
context-driven-development
wshobson
Use this skill when working with Conductor's context-driven development methodology, managing project context artifacts, or understanding the relationship between product.md, tech-stack.md, and workflow.md files.
planning-agent
parcadei
Planning agent that creates implementation plans and handoffs from conversation context