Loading...
Loading...
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.
npx skill4agent add fearovex/claude-config sdd-designProduces the technical design with architecture decisions, data flow, and a file change plan.
/sdd-design <change-name>1. .claude/skills/sdd-design/SKILL.md (project-local — highest priority)
2. ~/.claude/skills/sdd-design/SKILL.md (global catalog — fallback)docs/SKILL-RESOLUTION.mdskills/_shared/sdd-phase-common.mdmem_search(query: "sdd/{change-name}/proposal")mem_get_observation(id)mem_search(query: "sdd/{change-name}/spec")mem_get_observation(id)ai-context/architecture.mdai-context/conventions.mdtypescriptreact-19[optional — not registered in project; add via /skill-add <name>]mem_savetopic_key: sdd/{change-name}/designtype: architectureproject: {project}# 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:
## 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;
}| Layer | What to test | Tool |
|---|---|---|
| Unit | [service/function] | [jest/vitest/pytest] |
| Integration | [endpoint/module] | [supertest/httpx] |
| E2E | [full flow if applicable] | [playwright/cypress] |
### 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. || Validation | Zod | others | It's better |# 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.controller.ts
├── auth.service.ts
├── strategies/
│ ├── jwt.strategy.ts
│ └── local.strategy.ts
└── dto/
├── login.dto.ts
└── refresh.dto.ts{
"status": "ok|warning|blocked",
"summary": "Design for [change-name]: [N] affected files, approach [brief description], risk [level].",
"artifacts": ["engram:sdd/{change-name}/design"],
"next_recommended": ["sdd-tasks (requires spec + design completed)"],
"risks": ["[technical risk if found]"]
}sdd-apply