Detailed reference for generating Software Design Documents through iterative review. Covers the 15-section SDD structure, two-loop critique process with 20 points each, accept/reject decision criteria, repository context grounding, and output conventions.
This skill provides the complete specification and reusable templates for producing Software Design Documents (SDDs) through a structured, iterative self-review process. It defines the exact SDD structure (15 sections), the two-loop review protocol (20 critiques per loop), decision criteria for accepting or rejecting critiques, and the output format. The SDD Writer Agent activates this skill for every SDD generation task.
Activate this skill when:
Do NOT use this skill when:
Before activating, ensure:
docs/design/ (create if missing)Every SDD MUST contain exactly these 15 sections in this order:
FR-001: [MUST] <description>
- Input: <trigger>
- Output: <expected result>
- Acceptance: <verification method>
FR-002: [SHOULD] <description>
- Input: <trigger>
- Output: <expected result>
- Acceptance: <verification method>
| Assumptions (believed true) | Constraints (hard limits) |
|---|---|
| Next.js 16 App Router is the framework | Must use existing Tailwind v4 + shadcn/ui stack |
| Static site (no backend APIs) | No external runtime dependencies |
| ... | ... |
Mermaid diagram template:
```mermaid
graph TD
A[Page Component] --> B[Section Component]
B --> C[Sub-component 1]
B --> D[Sub-component 2]
C --> E[shadcn/ui primitive]
```
Repo patterns to reference:
| Pattern | Location | Convention |
|---|---|---|
| Pages | src/app/<route>/page.tsx | App Router file conventions |
| Components | src/components/<domain>/ | Named exports, PascalCase files |
| UI primitives | src/components/ui/ | shadcn/ui, do not modify |
| Data models | src/data/<name>.ts | TypeScript interfaces + arrays |
| Styling | src/app/globals.css | CSS custom properties, OKLCH |
| Utilities | lib/utils.ts or src/lib/ | cn() for class composition |
| Layout | src/components/layout/ | Header, Footer, Nav |
pnpm audit)rel="noopener noreferrer", target="_blank")pnpm build validation (no build errors)loading.tsx and error.tsx for user feedbackfeature/<short-name> from main| Level | Approach | Tools |
|---|---|---|
| Unit | Component rendering, prop validation | Vitest + React Testing Library |
| Integration | Page-level rendering, data flow | Vitest |
| E2E | Critical user journeys | Playwright (if configured) |
| Accessibility | Automated WCAG checks | axe-core, Lighthouse |
| Visual | Responsive breakpoint verification | Manual + browser DevTools |
| # | Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|---|
| R1 | Example risk | Low/Med/High | Low/Med/High | Specific mitigation |
OQ-001: <question>
- Context: <why this matters>
- Proposed resolution: <suggestion>
- Owner: <who answers -- usually "Raph" or "TBD">
HARD RULE: Never invent facts. If uncertain, add an Open Question.
Two self-review loops transform SDD v1 into SDD v3 (final):
SDD v1 (draft) --> Loop 1 (20 critiques) --> SDD v2 --> Loop 2 (20 critiques) --> SDD v3 (final)
Each critique must include all four fields:
Critique #<N>:
Section: <number>. <section name>
Issue: <specific problem or gap identified>
Risk/Impact: <what could go wrong if not addressed>
Suggestion: <concrete, actionable improvement>
ACCEPT if the critique:
| Criterion | Example |
|---|---|
| Improves clarity | "Section 4 requirement FR-003 is ambiguous about edge cases" |
| Addresses a real gap | "No accessibility requirements for keyboard navigation" |
| Aligns with repo patterns | "Should reference existing cn() utility pattern" |
| Makes requirements testable | "Add specific Lighthouse score targets" |
| Reduces risk | "Missing rollback procedure for database migration" |
| Improves security | "External links missing rel=noopener" |
REJECT if the critique:
| Criterion | Example |
|---|---|
| Out of scope | "Should also design the blog feature" |
| Lacks evidence | "Might need WebSocket support" (no indication needed) |
| Conflicts with requirements | "Use Vue instead of React" |
| Premature optimization | "Add Redis caching layer" |
| Stylistic preference | "Rename Section 7 to Technical Design" |
| Already addressed | "Need a Mermaid diagram" (already present) |
Each loop produces a 20-row decision table:
| # | Section | Issue Summary | Decision | Reason |
|---|---|---|---|---|
| 1 | 4. Functional Requirements | FR-003 missing edge case | ACCEPT | Improves testability |
| 2 | 7. Proposed Solution | Should add Redis cache | REJECT | Premature optimization for static site |
| ... | ... | ... | ... | ... |
| 20 | ... | ... | ... | ... |
After each loop, append to Section 15:
### Loop <N> (SDD v<N> -> v<N+1>)
**Date**: <YYYY-MM-DD>
**Reviewer persona**: Principal Engineer
#### Critiques
<all 20 critique points>
#### Decision Table
<20-row table>
#### Summary
- Accepted: <N>/20
- Rejected: <N>/20
- Sections modified: <list>
#### Accepted Changes Applied
<brief description of each change made>
Phase 1: Infer Intent
|
v
Phase 2: Read Repo Context
|
v
Phase 3: Write SDD v1 (15 sections)
|
v
Phase 4: Loop 1 -- 20 critiques --> accept/reject --> SDD v2
|
v
Phase 5: Loop 2 -- 20 NEW critiques --> accept/reject --> SDD v3
|
v
Phase 6: Save to docs/design/ + Generate Summary
| Context | Where to Find It | Why It Matters |
|---|---|---|
| Project structure | File tree, src/app/, src/components/ | Understand routing and component org |
| Tech stack | package.json, tsconfig.json | Know available tools and versions |
| Styling conventions | globals.css, tailwind.config.ts | Match existing design tokens |
| Data patterns | src/data/ | Reuse existing data model patterns |
| Component patterns | src/components/ui/, src/components/layout/ | Follow established conventions |
| Prior designs | docs/design/, docs/sdd/ | Learn from previous decisions |
| Agent system | .github/agents/, .github/skills/ | Understand delegation model |
| Project context | memory-bank/, README.md | Understand goals and status |
Path: docs/design/<YYYY-MM-DD>-<short-title>.md
| Element | Format | Example |
|---|---|---|
| Date | ISO 8601 | 2026-02-28 |
| Title | kebab-case, 2-4 words | hero-section |
| Full path | docs/design/ prefix | docs/design/2026-02-28-hero-section.md |
If docs/design/ does not exist, create it before saving.
## SDD Generation Summary
| Metric | Value |
|--------|-------|
| Loops completed | 2 |
| Loop 1: Critiques generated | 20 |
| Loop 1: Accepted | <N> |
| Loop 1: Rejected | <N> |
| Loop 2: Critiques generated | 20 |
| Loop 2: Accepted | <N> |
| Loop 2: Rejected | <N> |
| Total critiques | 40 |
| Total accepted | <N> |
| Total rejected | <N> |
| Acceptance rate | <N>% |
### Rejection Themes
| Category | Count | Examples |
|----------|-------|---------|
| Out of scope | <N> | ... |
| Premature optimization | <N> | ... |
| Stylistic preference | <N> | ... |
| Lacks evidence | <N> | ... |
| Already addressed | <N> | ... |
### Output
- **File**: docs/design/<filename>.md
- **Sections**: 15
- **Diagrams**: <N>
- **Open Questions**: <N>
- **Functional Requirements**: <N>
- **Risks Identified**: <N>
docs/design/<YYYY-MM-DD>-<short-title>.md| Skill | Relationship |
|---|---|
project-context | Provides repo structure knowledge for Phase 2 grounding |
code-standards | Informs coding conventions referenced in proposed solutions |
git-workflow | Defines the branch and PR strategy for rollout plans |
nextjs-app-router | Reference for routing patterns in proposed solutions |
tailwind-v4 | Reference for styling patterns in proposed solutions |
shadcn-ui | Reference for component library usage in proposed solutions |
accessibility | Informs non-functional requirements and testing strategy |
seo-metadata | Informs metadata requirements in proposed solutions |
design-system | Provides design token and spacing references |
code-review-checklist | QA Reviewer uses this to validate the implemented SDD |