design-doc
Automates design document creation by linking PRDs to technical specs.
Install
mkdir -p .claude/skills/design-doc && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12619" && unzip -o skill.zip -d .claude/skills/design-doc && rm skill.zipInstalls to .claude/skills/design-doc
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.
Generate a detailed design document via `tx doc add design`. Covers architecture, interfaces, data model, invariants, failure modes, verification, and testing strategy. References plan via file path instead of embedding. Plan lives in ~/.codex/plans/<name>.md. Reads companion PRD automatically to map EARS requirements to invariants. Output lands in specs/design/<name>.md.Key capabilities
- →Generate a detailed design document
- →Map PRD requirements to invariants and verification entries
- →Scaffold design documents using `tx doc add design`
- →Gather context from architectural and code files
- →Self-audit the generated design document against minimum thresholds
- →Update the plan file with design details
How it works
The skill scaffolds a design document, gathers context from various project files, fills in sections based on a plan and PRD, and then self-audits and updates the plan file.
Inputs & outputs
When to use design-doc
- →Documenting new features
- →Creating design specs for components
- →Mapping requirements to invariants
About this skill
Generate Design Document
Create a comprehensive technical design document using the tx doc primitive. Design docs specify HOW the system implements requirements, with traceable invariants and a concrete testing strategy.
Design Doc + PRD are companions. A PRD defines WHAT and WHY. A design doc defines HOW. If a PRD exists for this feature, the design doc reads it automatically and maps every must-priority EARS requirement to an invariant + verification entry.
Workflow State Machine
START
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 0: PLAN GATE │
│ │
│ Is there an active plan in this conversation? │
│ │
│ ├─ YES → Save plan to `~/.codex/plans/<name>.md` if not │
│ │ already saved. Set `plan: ~/.codex/plans/<name>.md` │
│ │ in frontmatter. │
│ │ → Continue to Step 0.5 │
│ │ │
│ └─ NO → Tell the user to run /plan first. │
│ If enough detail provided, generate plan, │
│ save to `~/.codex/plans/<name>.md`. │
│ → Continue to Step 0.5 │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 0.5: CHECK FOR COMPANION PRD │
│ │
│ Run: tx doc list --kind prd │
│ │
│ ├─ PRD exists for this feature? │
│ │ → tx doc show <prd-name> --md │
│ │ → Extract ALL EARS requirements │
│ │ → Each `must` EARS req MUST get an invariant │
│ │ and a verification entry in this design doc │
│ │ → Set `implements: <prd-name>` in frontmatter │
│ │ → Continue to Step 1 │
│ │ │
│ └─ No companion PRD? │
│ → Continue to Step 1 (design doc stands alone) │
│ → Suggest creating PRD after: /prd <name> │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 1: SCAFFOLD via tx │
│ │
│ tx doc add design <name> --title "<title>" │
│ ├─ SUCCESS → Continue to Step 2 │
│ └─ FAIL (exists) → Edit existing doc │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 2: DEEP CONTEXT GATHERING │
│ │
│ Read: ARCHITECTURE.md, QUALITY.md, CLAUDE.md, │
│ domain code, schema.ts, effect-schemas, │
│ API routes, workflows, activities, │
│ existing designs (tx doc list --kind design) │
│ → Continue to Step 3 │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 3: FILL DOCUMENT │
│ │
│ Write `# Plan` first (reference to plan file from │
│ Step 0). │
│ Then fill all sections from plan + PRD + codebase. │
│ │
│ MINIMUM THRESHOLDS: │
│ - Invariants: ≥ 5 │
│ - Failure modes: ≥ 3 │
│ - Verification entries: ≥ 5 │
│ - Integration test files: ≥ 2 (HARD REQUIREMENT) │
│ - Unit test files: ≥ 1 (recommended, not hard) │
│ - Sequence diagrams: ≥ 2 (happy + error) │
│ - Design decisions: ≥ 1 │
│ │
│ Integration tests are the primary verification │
│ mechanism. Unit tests complement but do not replace │
│ integration tests. │
│ │
│ RULE: No section may be left as a template/stub. │
│ │
│ COMPREHENSIVENESS: The design doc must cover EVERY │
│ item from the plan. Every implementation step, │
│ constraint, risk, and decision in the plan must │
│ appear in the design doc with full technical detail. │
│ The design doc is the single source of truth for HOW │
│ the feature is built — it should be detailed enough │
│ that an engineer can implement from it alone. │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 4: SELF-AUDIT │
│ │
│ Check: │
│ ├─ Every plan item captured in a section? │
│ ├─ Every PRD `must` EARS req has an invariant? │
│ ├─ Every invariant has a verification entry? │
│ ├─ Minimums met? │
│ ├─ No stubs/placeholders? │
│ ├─ All diagrams complete? │
│ └─ Plan file exists at frontmatter path and is │
│ consistent with doc sections? │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 5: VALIDATE │
│ │
│ tx spec lint │
│ ├─ PASS → Continue to Step 6 │
│ └─ WARN/FAIL → Fix, re-validate │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 5.5: SYNC PLAN FILE │
│ │
│ Read the plan file from frontmatter `plan:` path. │
│ Compare with what the doc now contains. │
│ UPDATE the plan file to incorporate: │
│ - Architecture decisions, component inventory │
│ - Interface contracts, data model details │
│ - Invariants, failure modes, error handling │
│ - Implementation sequence, testing strategy │
│ The plan file must reflect the FULL current state │
│ of the feature — not just the initial draft. │
│ This is a MANDATORY step, not optional. │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 6: DISCOVER + LINK + REPORT │
│ │
│ tx spec discover --doc <name> │
│ tx doc link <prd> <design> (if PRD exists) │
│ tx doc show <name> │
│ tx spec gaps --doc <name> │
│ Print summary │
└─────────────────────────────────────────────────────┘
│
▼
DONE
Step 0 — Plan Gate
The plan is the primary input. Check for plan content in the conversation:
- The plan is saved as a standalone file at
~/.codex/plans/<name>.md(relative to repo root). - If a plan already exists in the conversation, write it to that file.
- If a plan file already exists at that path, read it instead.
- If no plan and vague request, ask user to run
/planfirst.
The doc's frontmatter gets plan: ~/.codex/plans/<name>.md and the # Plan section contains a reference link + brief summary, not the full verbatim content.
Step 0.5 — Check for Companion PRD
tx doc list --kind prd
If a PRD exists for this feature:
- Read it:
tx doc show <prd-name> --md - Extract every EARS requirement
- Every
must-priority EARS requirement MUST become:- An invariant in
invariants:YAML block - A verification entry in
verification:YAML block
- An invariant in
- Set
implements: <prd-name>in frontmatter
If no PRD exists, the design doc stands alone. Suggest creating one after.
Step 1 — Scaffold via tx
tx doc add design $ARGUMENTS --title "<Human-Readable Title>"
Creates specs/design/<name>.md. If exists, edit instead.
Step 2 — Deep Context Gathering
Read these files:
docs/ARCHITECTURE.md— architecture + DDD structuredocs/QUALITY.md— all invariants, governance rulesCLAUDE.md— stack, conventions- Companion PRD (from Step 0.5)
- Domain code:
packages/core/src/domains/ - Database schema:
packages/infra/db/src/schema.ts - Effect schemas:
packages/infra/db/src/effect-schemas/ - API routes:
apps/api/src/ - Workflows:
apps/worker/src/workflows.ts - Activities:
apps/worker/src/activities.ts - Existing designs:
tx doc list --kind design
Step 3 — Fill the Document
Required Frontmatter (already generated by tx)
---
kind: spec
spec_type: design
name: <name>
title: "<title>"
status: draft
version: 1
owners:
- <team-or-person>
summary: Technical approach for <title>
domain: <product-area>
tags:
- design
depends_on: []
supersedes: []
implements: <prd-name-or-null>
last_reviewed_at: <YYYY-MM-DD>
plan: ~/.codex/plans/<name>.md
---
Update owners, summary, domain, tags, depends_on, implements.
Body Structure — ALL sections MUST have real content
# Plan comes first (as a reference to the plan file). Then all technical sections. No section may be a stub.
**If a companion PRD exists, every must EARS requirement maps to an invarian
Content truncated.
When not to use it
- →When a design document is not required
- →When a PRD does not exist and the design document needs to stand alone without requirement mapping
- →When the project does not use the `tx doc` primitive
Limitations
- →Requires an active plan in the conversation or generation of a new plan
- →Mandates specific minimum thresholds for invariants, failure modes, and test files
- →Relies on the `tx doc` primitive for document management
How it compares
This skill automates the creation of a structured design document, ensuring traceability to requirements and adherence to quality thresholds, unlike a manual document creation process.
Compared to similar skills
design-doc side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| design-doc (this skill) | 0 | 2mo | Review | Advanced |
| 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 jamesaphoenix
View all by jamesaphoenix →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