sdd-design
Produces the technical design with architecture decisions, data flow, and a file change plan. Trigger: /sdd-design <change-name>, technical design, change architecture, how to implement.
What this skill does
# sdd-design
> Produces the technical design with architecture decisions, data flow, and a file change plan.
**Triggers**: `/sdd-design <change-name>`, technical design, change architecture, sdd design
---
## Purpose
The design defines **HOW to implement** what the specs say the system MUST do. It is the bridge between requirements and code. It documents technical decisions and their justification.
---
## Process
### Skill Resolution
When the orchestrator launches this sub-agent, it resolves the skill path using:
```
1. .claude/skills/sdd-design/SKILL.md (project-local — highest priority)
2. ~/.claude/skills/sdd-design/SKILL.md (global catalog — fallback)
```
Project-local skills override the global catalog. See `docs/SKILL-RESOLUTION.md` for the full algorithm.
---
### Step 0 — Load project context + Spec context preload
Follow `skills/_shared/sdd-phase-common.md` **Section F** (Project Context Load) and **Section G** (Spec Context Preload). Both are non-blocking.
---
### Step 1 — Read prior artifacts
I must read:
- The proposal artifact:
- `mem_search(query: "sdd/{change-name}/proposal")` → `mem_get_observation(id)`.
- If not found and Engram not reachable: proposal content passed inline from orchestrator.
- The spec artifact:
- `mem_search(query: "sdd/{change-name}/spec")` → `mem_get_observation(id)`.
- If not found and Engram not reachable: spec content passed inline from orchestrator.
- `ai-context/architecture.md` if it exists
- `ai-context/conventions.md` if it exists
Then I read real code:
- Relevant entry points
- Files that will be affected according to the proposal
- Existing patterns to follow (not reinvent)
- Existing tests (they reveal current contracts)
### Step 2 — Design the technical solution
I evaluate the solution considering:
- Patterns already used in the project (prefer consistency)
- Minimal impact on existing code
- Testability
- Reversibility (rollback plan from the proposal)
#### Skills Registry cross-reference
When recommending a skill, library, or technology pattern in the design, I MUST check the project Skills Registry extracted in Step 0 and follow these rules:
- **Registered skill**: reference it by its exact registered name (e.g., `typescript`, `react-19`).
- **Global catalog skill, not registered in project**: mark it as optional with a note, e.g. `[optional — not registered in project; add via /skill-add <name>]`.
- **Skill not in the global catalog**: state it as a new dependency and flag it for review.
This check applies to the Technical Decisions table, the Testing Strategy table, and any inline recommendations in the design narrative. It ensures design output stays aligned with the project's declared toolset.
### Step 3 — Create design.md
I persist the design artifact to engram:
Call `mem_save` with `topic_key: sdd/{change-name}/design`, `type: architecture`, `project: {project}`, content = full design markdown. Do NOT write any file.
If Engram MCP is not reachable: skip persistence. Return design content inline only.
Content format:
```markdown
# Technical Design: [change-name]
Date: [YYYY-MM-DD]
Proposal: engram:sdd/[name]/proposal
## General Approach
[High-level description of the technical solution in 3-5 lines]
## Technical Decisions
| Decision | Choice | Discarded Alternatives | Justification |
| ---------- | ---------------- | ------------------------------ | ----------------- |
| [decision] | [what is chosen] | [alternative A, alternative B] | [why this choice] |
## Data Flow
[ASCII diagram or description of the flow]
Example:
```
Request → Middleware → Controller → Service → Repository → DB
↓
Validator (Zod)
↓
Response DTO
````
## File Change Matrix
| File | Action | What is added/modified |
|------|--------|------------------------|
| `src/modules/auth/auth.service.ts` | Modify | Add `refreshToken()` method |
| `src/modules/auth/auth.controller.ts` | Modify | New endpoint POST /auth/refresh |
| `src/modules/auth/dto/refresh.dto.ts` | Create | DTO for refresh request |
| `src/modules/auth/auth.module.ts` | Modify | Register new provider |
| `tests/auth/refresh-token.spec.ts` | Create | Tests for the new endpoint |
## Interfaces and Contracts
[Type definitions, interfaces, DTOs, schemas to be created]
```typescript
// Example
interface RefreshTokenRequest {
refreshToken: string;
}
interface RefreshTokenResponse {
accessToken: string;
expiresIn: number;
}
````
## Testing Strategy
| Layer | What to test | Tool |
| ----------- | ------------------------- | -------------------- |
| Unit | [service/function] | [jest/vitest/pytest] |
| Integration | [endpoint/module] | [supertest/httpx] |
| E2E | [full flow if applicable] | [playwright/cypress] |
## Migration Plan
[If there are changes to DB, schema, or existing data:]
- Step 1: [migration script]
- Step 2: [gradual rollout if applicable]
- Step 3: [post-cleanup]
[If no migration: "No data migration required."]
## Open Questions
[Aspects that need clarification before implementing]
- [question]: [impact if not resolved]
[If none: "None."]
````
### Step 4 — ADR Detection and Generation
This step is **non-blocking**: any failure produces a warning in the output, never `status: blocked` or `status: failed`.
1. **Scan for significant decisions**: read the Technical Decisions table in the newly created `design.md`. For each row, check whether the text (across all columns) contains any of the following keywords (case-insensitive):
`pattern`, `convention`, `cross-cutting`, `replaces`, `introduces`, `architecture`, `global`, `system-wide`, `breaking`
2. **No match → skip silently**: if no row matches any keyword, do nothing and produce no output for this step.
3. **Match found → generate ADR**:
a. **Prerequisite check**: if `docs/templates/adr-template.md` does not exist OR `docs/adr/README.md` does not exist, log the warning `"ADR infrastructure not found (docs/templates/adr-template.md or docs/adr/README.md missing) — skipping ADR generation"` and stop this step.
b. **Determine next ADR number**: count existing files matching `docs/adr/[0-9][0-9][0-9]-*.md`. The next number is `count + 1`, zero-padded to 3 digits (e.g., `001`, `012`, `100`).
c. **Derive slug**: `<NNN>-<change-name>[-<first-matched-keyword>]`, all lowercase, spaces replaced with hyphens, non-alphanumeric characters (except hyphens) removed, truncated to 50 characters.
d. **Copy template**: copy `docs/templates/adr-template.md` to `docs/adr/<slug>.md`.
e. **Pre-fill content** in the new ADR file:
- Title (H1): derived from the slug (replace hyphens with spaces, title-case)
- Status: `Proposed`
- Context section: content from the **Justification** column of the first matched row
- Decision section: content from the **Choice** column of the first matched row
f. **Update index**: append a new row to the ADR index table in `docs/adr/README.md`:
`| [NNN] | [Title] | Proposed | [YYYY-MM-DD] | [brief one-line context] |`
g. **Artifacts**: add `docs/adr/<slug>.md` to the artifacts list.
---
## Examples of well-documented decisions
### Well documented
```markdown
| Input validation | Zod at controller layer | Class-validator, manual |
The project already uses Zod for DB schemas (Drizzle).
Maintaining consistency avoids two validation systems. |
````
### Poorly documented
```markdown
| Validation | Zod | others | It's better |
```
---
## Useful ASCII diagrams
```
# Authentication flow
Client → POST /auth/login
↓
AuthController
↓
AuthService.validateCredentials()
↓
UserRepository.findByEmail()
↓
bcrypt.compare(password, hash)
↓ (success)
JwtService.sign(payload)
↓
Response { token, refreshToken }
# Module structure
auth/
├── auth.module.ts
├── auth.controllRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.