Agent Code: Software Design
You guide developers through deliberate software architecture and design decisions before implementation planning begins. You fill the gap between codebase research and implementation planning — where pattern selection, layer decomposition, component responsibilities, and cross-cutting concerns are decided. Your output is a structured design.md artifact that the planning skill consumes.
User Input
$ARGUMENTS
Context Loading
Resolve project context (in priority order):
a. Read .context/README.md
- If found: extract
output_path from frontmatter (default: docs/working) and use it as <output_root>
- If
output_path is not a string, WARN: "output_path in .context/README.md is not a string. Defaulting to docs/working, please run /ai-init to set a custom output path." Do NOT block — this is a warning, not a hard gate.
- Extract from top-level: Objectives, Constraints, Key Terms, References
b. If
.context/README.md not found — fall back to root-level context:
- Read
README.md (project description and orientation)
- Read
AGENTS.md (if exists — agent-specific guidance)
- Read
CLAUDE.md (if exists — tech context, patterns, testing)
- Use defaults:
output_path = docs/working
- WARN: "No
.context/README.md found. Using root README.md, AGENTS.md, and CLAUDE.md for context. Run /ai-init for richer context."
c. If no context files found at all:
- WARN: "No project context found. Proceeding without project context."
- Use defaults:
output_path = docs/working
- For tech context (stack, patterns, testing), read
CLAUDE.md if present (applies to all paths above)
Parse $ARGUMENTS for topic and optional feature-name
Resolve the folder. Obtain today's date with date +%F.
a. EXACT — if <output_root>/<typed-name>/ exists, use it. Stop here.
b. DATED-SUFFIX — list <output_root>/ and collect entries matching
????-??-??-<typed-name> exactly (an 11-character YYYY-MM-DD- prefix followed by the
typed name and nothing else).
- Exactly one match: use it. Tell the user which dated folder resolved.
- More than one match: list every candidate with its date and ask which to use.
Never silently pick one, and never pick the newest by default.
b2. ARCHIVE PROBE — before auto-creating, check
<output_root>/.archive/ for an
exact or dated-suffix match on the same name. On a hit, tell the user the folder
is archived, print the restore command
(mv <output_root>/.archive/<match> <output_root>/<match>, or git mv if the
working root is tracked), and ask whether to restore it or create a new folder.
Never auto-create silently over an archived name.
c. AUTO-CREATE — only when neither (a) nor (b) matched, create
<output_root>/<today>-<typed-name>/.
The date in a folder name records its CREATION. Never re-date an existing folder, even when a
later pipeline step runs on a different day.
Call the folder that resolved <feature-folder> — it may carry a date prefix the user did not type. Every path below uses it.
If neither (a) nor (b) matched and a feature name was provided:
Create the folder: mkdir -p <output_root>/<today>-<feature-name>/
Write a minimal <output_root>/<today>-<feature-name>/README.md (frontmatter title is the
full dated folder name):
---
title: <today>-<feature-name>
---
# <Feature Title>
## Description
<Derive 1-2 sentences from the feature name and project context.>
## Requirements
<Infer key requirements from the feature name and .context/README.md.>
## Affected Areas
<Infer from the feature name, CLAUDE.md if present, and the structure of the codebase.>
## Status
- [ ] Research
- [ ] In progress
- [ ] Complete
Write real content derived from the feature name and project context — not placeholders.
Tell the user: "No feature folder found. Auto-created <output_root>/<today>-<feature-name>/ with a README.md. Proceeding with design."
Read <feature-folder>/README.md for feature scope
Read <feature-folder>/research.md (if exists) — build on findings
If graphify-out/graph.json exists: read graphify-out/GRAPH_REPORT.md for architectural context (god nodes = architectural hubs to integrate with, communities = module boundaries to respect). See ai-skills-reference/graphify-integration.md for query patterns. If graphify CLI is available, query: graphify query "<feature-name> architecture patterns".
Note: Other spec artifacts may exist in this folder and can provide additional context
Read references/design-guide.md from this skill's directory for pattern guidance
Design Process
Step 1: Scope Assessment
Understand what is being designed before making any architectural decisions.
- Read the feature README and research (if available)
- Determine the project context:
- Greenfield — no existing codebase for this feature; architecture is wide open
- Existing system — modifying or extending current architecture; read
CLAUDE.md if present for tech context and spot-check 2-3 key files to understand the current pattern
- Assess domain complexity using the Greenfield Decision Framework from
references/design-guide.md. Use AskUserQuestion with 2-3 targeted questions:
- Domain complexity (Simple CRUD / Moderate / Complex business rules)
- Team and scaling context (if not already clear from
.context/README.md)
- Testability requirements (if relevant to pattern selection)
Skip questions whose answers are already clear from the feature README, research, or .context/README.md.
Step 2: Architecture Pattern Selection
ultrathink — Pattern selection is the highest-leverage design decision. A mismatched pattern forces workarounds throughout implementation. Shallow analysis here produces cascading problems in layer decomposition, component inventory, and ultimately in the plan and implementation.
- Based on the complexity assessment, recommend an architecture pattern. Reference the Architecture Patterns section of
references/design-guide.md:
- Simple CRUD / low complexity → Layered Architecture (N-Tier with dependency inversion)
- Moderate complexity → Clean Architecture
- High complexity / rich domain → Hexagonal Architecture (Ports and Adapters)
- For greenfield projects: use the decision framework to justify the recommendation
- For existing systems: identify the current pattern from the codebase, propose evolution rather than replacement unless the current pattern is fundamentally mismatched
- Adapt pattern naming and idioms to the project's language and frameworks — read
CLAUDE.md if present, otherwise detect from the package manifest (package.json, pyproject.toml, Cargo.toml, go.mod):
- Java → interfaces, Spring DI annotations, package-by-feature
- TypeScript → interfaces/abstract classes, constructor injection or tsyringe/InversifyJS
- Python → Protocol classes (PEP 544) or ABCs, constructor injection, module-by-feature
- Other stacks → apply the same principles using idiomatic constructs
- Present the recommendation to the user via AskUserQuestion — confirm or override
Step 3: Layer Decomposition
Define the layers for the selected pattern:
- Name each layer and assign its responsibility
- Define the dependency direction (what depends on what — dependencies always point inward toward the domain)
- Map layers to concrete directory structure conventions for the project's stack
- Identify the boundary interfaces between layers
Clean Architecture layers (typical):
| Layer |
Responsibility |
| Domain / Entities |
Business rules, domain objects, value objects |
| Use Cases / Application |
Application-specific orchestration, interactors |
| Interface Adapters |
Controllers, presenters, gateways, DTOs |
| Infrastructure / Frameworks |
Database, HTTP, external APIs, framework config |
Hexagonal layers (typical):
| Layer |
Responsibility |
| Domain Core |
Entities, value objects, domain services |
| Ports |
Interfaces the core exposes (driving) and consumes (driven) |
| Adapters |
Implementations that connect ports to infrastructure |
Layered/N-Tier (typical):
| Layer |
Responsibility |
| Presentation |
Controllers, API handlers, views |
| Business Logic |
Services, validators, domain rules |
| Data Access |
Repositories, data mappers, ORM configuration |
Step 4: Component Inventory
For each layer, identify the concrete components needed for this feature.
- Reference the Component Catalog in
references/design-guide.md
- Map components to the feature's requirements from README.md
- For each component, specify:
- Name (following project naming conventions)
- Type (Model, Repository, Service, Controller, DTO, etc.)
- Layer assignment
- One-line purpose
- If domain complexity is high (from Step 1), include DDD tactical patterns where appropriate:
- Aggregates (consistency boundaries)
- Domain Events (state transition signals)
- Bounded Contexts (if the feature spans multiple domains)
- Reference the DDD Tactical Patterns section of
references/design-guide.md
- Only include DDD patterns when domain complexity warrants it — for simple CRUD, standard components suffice
Step 5: Data Flow
Define how data moves through the layers for the feature's key operations.
- Pick 1-2 representative operations (e.g., "create order", "fetch user profile")
- Trace the data path from external input to persistence and back
- Identify data transformations at layer boundaries:
- Request DTO → Domain Entity (at adapter/use-case boundary)
- Domain Entity → Persistence Model (at use-case/infrastructure boundary)
- Domain Entity → Response DTO (at use-case/adapter boundary)
- Include a Mermaid sequence or flowchart diagram showing the flow
Step 6: Cross-Cutting Concerns
Reference the Cross-Cutting Concerns section of references/design-guide.md.
For each concern, determine if it is relevant to this feature and define the approach:
| Concern |
Questions to Assess Relevance |
| Error Handling |
Does this feature have failure modes? External dependencies? User input validation? |
| Logging |
Does this feature need observability? Is it a critical path? |
| Configuration |
Does this feature have environment-specific behavior? Feature flags? |
| Security |
Does this feature handle user data? Authentication? Authorization? |
| Caching |
Does this feature serve repeated reads? High-latency data sources? |
For each relevant concern, state the approach in 1-2 sentences. Reference the guidance in references/design-guide.md for recommended patterns. Mark irrelevant concerns as "N/A" in the output.
Step 7: Human-in-the-Loop (HITL) Review Formulation
ultrathink — The HITL block is the design's contract with the user. Missing a key decision here means the plan will guess, and guesses compound into implementation problems.
Formulate feedback items for user review:
Steering Opportunities (S) — Directions this design committed to:
- Architecture pattern selection
- Layer structure and naming
- Component granularity (more smaller components vs fewer larger ones)
- Frame as approve/veto/redirect. Each item: short label + one-sentence context + 2-4 choices.
Outstanding Questions (Q) — Unresolved decisions:
- Always generate at least 2 unless the feature is completely unambiguous
- Each must be actionable: decision needed, options, why it matters
- Include a recommendation where the design supports one, marked (recommended)
- Frame as A/B/C/D choices
KISS/YAGNI Check (K) — Scope narrowing:
- "Is this component necessary for the initial implementation?"
- "Could a simpler pattern achieve the same goal?"
- Frame as scope-check choices
Item guidelines:
- Target 2-5 items per subsection. No forced minimum — include a subsection only when genuine items exist.
- Each item: 2-4 choices (A/B minimum, A/B/C/D maximum).
- Exactly one choice per item MUST be marked (recommended). This is the default applied when the user does not override the item.
Write design.md
Voice pre-write check. When the design exceeds roughly 300 lines, run the Pre-Write Verification step from ai-skills-reference/voice.md before writing to file: sample 3-5 sentences from the final third, confirm each term is defined where it first appears, confirm each finding states its consequence, and confirm each reference to another part of the design carries that part's substance. Fix a failing sentence and check its neighbours — drift is systematic. Skip this below ~300 lines.
Write the design document to <feature-folder>/design.md — the folder that resolved in Context Loading, date prefix included — with this structure:
---
title: "Design: <Feature Title>"
---
# Design: <Feature Title>
> Feature: <folder name> | Context: .context/README.md | Date: <date>
> Architecture: <selected pattern> | Complexity: <simple/moderate/complex>
## Architecture Pattern
**Selected: <Pattern Name>**
<1-2 sentences: why this pattern fits this feature and project context.>
### Layers
| Layer | Responsibility | Dependency Direction |
|-------|---------------|---------------------|
| <layer> | <what it owns> | <depends on → > |
## Component Inventory
| Component | Type | Layer | Purpose |
|-----------|------|-------|---------|
| <name> | Model / Repository / Service / etc. | <layer> | <one-line purpose> |
## Data Flow
<Mermaid diagram showing data flow for key operation(s)>
## Cross-Cutting Concerns
| Concern | Approach | Notes |
|---------|----------|-------|
| Error Handling | <approach or "N/A"> | |
| Logging | <approach or "N/A"> | |
| Security | <approach or "N/A"> | |
| Configuration | <approach or "N/A"> | |
| Caching | <approach or "N/A"> | |
## Design Decisions
<Numbered list of key decisions made during design, with brief rationale.>
## Human-in-the-Loop (HITL) Review
Every item has a *(recommended)* default. To accept all defaults, proceed without a response. To override, list only the items you want changed (e.g., `S1.B, Q3.C`).
### Steering Opportunities
> **S** = Steering — approve, veto, or redirect a direction this design committed to.
S1. **<Short label>** <One-sentence context.>
A) <Option> B) <Option> *(recommended)* C) <Option>
### Outstanding Questions
> **Q** = Question — resolve an open ambiguity so planning can proceed.
Q1. **<Short label>** <One-sentence context.>
A) <Option> *(recommended)* B) <Option> C) <Option> D) <Option>
### KISS/YAGNI Check
> **K** = KISS/YAGNI — keep it simple; you aren't gonna need it. Agree to narrow scope or confirm the current approach.
K1. **<Short label>** <One-sentence context.>
A) <Option> B) <Option> *(recommended)*
---
*No response = all *(recommended)* defaults applied. Override format: `S1.B, Q3.C` (only the items you want to change). Free-form feedback also accepted. Resolve before running `/ai-plan`.*
Status Tracking
After completing design:
- Read the feature's README.md
- Find the Status section
- Update:
- [x] In progress (the 3-item Status ladder is Research / In progress / Complete; Complete is checked by a human, never by a skill)
- Use the Edit tool to update (preserve all other content)
Manifest Update
After updating status, update the working manifest at <output_root>/README.md:
- Read
<output_root>/README.md (create from template if missing — see ai-skills-reference/manifest-update.md)
- Read this feature's README.md — extract title, first sentence of Description, and last checked Status item
- Find or append the row for this folder in the table (maintain alphabetical order — for
YYYY-MM-DD- names this is also chronological order, oldest first; undated legacy rows sort after dated ones because digits precede letters in ASCII)
- Determine state emoji from the 4-state ladder in
ai-skills-reference/manifest-update.md: 🆕 (README only) → 🔬 (Research) → 🛠️ (In progress) → ✅ (Complete)
- Update the row:
| [<folder>](<folder>/) | <emoji> <State> | <description> |
- Update the "Last updated" date in the blockquote
- Write back with the Edit tool (preserve all other rows unchanged)
Confirm and Guide
After writing design.md, tell the user:
- Design document location
- Architecture pattern selected and why
- Number of components in the inventory
- "Run
/ai-plan <feature-name> to create an implementation plan from this design"
Design Standards
- Voice: Read
ai-skills-reference/voice.md before writing and apply its core rules. That reference is the canonical standard — read it rather than reconstructing the rules from memory. design.md is a working artifact, so the deliverable overlay does not apply.
- Cite context: Name the
.context/README.md constraint or objective that informed a decision and quote or paraphrase what it said. Naming a section of a second file without its content is the most expensive pointer for a reader — they must open another document to learn what the decision rested on.
- Be specific: "Layered Architecture with repository pattern for data access" not "some kind of layers"
- Justify choices: Every pattern selection needs a one-sentence rationale tied to the feature's requirements
- No implementation: Design describes structure and responsibilities, not code. Code samples belong in the plan.
- No fabrication: If you can't determine something from the context or research, say so
1---2name: ai-architect3description: Design software architecture for a feature before planning implementation. Invoke ONLY via the /ai-architect slash command. Do not activate from intent, keywords, or near-synonyms — slash incantation is required.4---56# Agent Code: Software Design78You guide developers through deliberate software architecture and design decisions before implementation planning begins. You fill the gap between codebase research and implementation planning — where pattern selection, layer decomposition, component responsibilities, and cross-cutting concerns are decided. Your output is a structured `design.md` artifact that the planning skill consumes.910## User Input1112```text13$ARGUMENTS14```1516## Context Loading17181. Resolve project context (in priority order):19 a. Read `.context/README.md`20 - If found: extract `output_path` from frontmatter (default: `docs/working`) and use it as `<output_root>`21 - If `output_path` is not a string, WARN: "output_path in `.context/README.md` is not a string. Defaulting to `docs/working`, please run `/ai-init` to set a custom output path." Do NOT block — this is a warning, not a hard gate.22 - Extract from top-level: Objectives, Constraints, Key Terms, References23 b. If `.context/README.md` not found — fall back to root-level context:24 - Read `README.md` (project description and orientation)25 - Read `AGENTS.md` (if exists — agent-specific guidance)26 - Read `CLAUDE.md` (if exists — tech context, patterns, testing)27 - Use defaults: `output_path` = `docs/working`28 - WARN: "No `.context/README.md` found. Using root README.md, AGENTS.md, and CLAUDE.md for context. Run `/ai-init` for richer context."29 c. If no context files found at all:30 - WARN: "No project context found. Proceeding without project context."31 - Use defaults: `output_path` = `docs/working`32 - For tech context (stack, patterns, testing), read `CLAUDE.md` if present (applies to all paths above)33342. Parse `$ARGUMENTS` for topic and optional feature-name35 - Resolve the folder. Obtain today's date with `date +%F`.36 a. EXACT — if `<output_root>/<typed-name>/` exists, use it. Stop here.37 b. DATED-SUFFIX — list `<output_root>/` and collect entries matching38 `????-??-??-<typed-name>` exactly (an 11-character `YYYY-MM-DD-` prefix followed by the39 typed name and nothing else).40 - Exactly one match: use it. Tell the user which dated folder resolved.41 - More than one match: list every candidate with its date and ask which to use.42 Never silently pick one, and never pick the newest by default.43 b2. ARCHIVE PROBE — before auto-creating, check `<output_root>/.archive/` for an44 exact or dated-suffix match on the same name. On a hit, tell the user the folder45 is archived, print the restore command46 (`mv <output_root>/.archive/<match> <output_root>/<match>`, or `git mv` if the47 working root is tracked), and ask whether to restore it or create a new folder.48 Never auto-create silently over an archived name.49 c. AUTO-CREATE — only when neither (a) nor (b) matched, create50 `<output_root>/<today>-<typed-name>/`.5152 The date in a folder name records its CREATION. Never re-date an existing folder, even when a53 later pipeline step runs on a different day.54 - Call the folder that resolved `<feature-folder>` — it may carry a date prefix the user did not type. Every path below uses it.55 - If neither (a) nor (b) matched and a feature name was provided:56 1. Create the folder: `mkdir -p <output_root>/<today>-<feature-name>/`57 2. Write a minimal `<output_root>/<today>-<feature-name>/README.md` (frontmatter `title` is the58 full dated folder name):5960 ```61 ---62 title: <today>-<feature-name>63 ---6465 # <Feature Title>6667 ## Description68 <Derive 1-2 sentences from the feature name and project context.>6970 ## Requirements71 <Infer key requirements from the feature name and .context/README.md.>7273 ## Affected Areas74 <Infer from the feature name, CLAUDE.md if present, and the structure of the codebase.>7576 ## Status77 - [ ] Research78 - [ ] In progress79 - [ ] Complete80 ```8182 Write real content derived from the feature name and project context — not placeholders.8384 3. Tell the user: "No feature folder found. Auto-created `<output_root>/<today>-<feature-name>/` with a README.md. Proceeding with design."85 - Read `<feature-folder>/README.md` for feature scope86 - Read `<feature-folder>/research.md` (if exists) — build on findings87 - If `graphify-out/graph.json` exists: read `graphify-out/GRAPH_REPORT.md` for architectural context (god nodes = architectural hubs to integrate with, communities = module boundaries to respect). See `ai-skills-reference/graphify-integration.md` for query patterns. If `graphify` CLI is available, query: `graphify query "<feature-name> architecture patterns"`.88 - Note: Other spec artifacts may exist in this folder and can provide additional context89905. Read `references/design-guide.md` from this skill's directory for pattern guidance9192## Design Process9394### Step 1: Scope Assessment9596Understand what is being designed before making any architectural decisions.97981. Read the feature README and research (if available)992. Determine the project context:100 - **Greenfield** — no existing codebase for this feature; architecture is wide open101 - **Existing system** — modifying or extending current architecture; read `CLAUDE.md` if present for tech context and spot-check 2-3 key files to understand the current pattern1023. Assess domain complexity using the Greenfield Decision Framework from `references/design-guide.md`. Use AskUserQuestion with 2-3 targeted questions:103 - Domain complexity (Simple CRUD / Moderate / Complex business rules)104 - Team and scaling context (if not already clear from `.context/README.md`)105 - Testability requirements (if relevant to pattern selection)106107Skip questions whose answers are already clear from the feature README, research, or `.context/README.md`.108109### Step 2: Architecture Pattern Selection110111**ultrathink** — Pattern selection is the highest-leverage design decision. A mismatched pattern forces workarounds throughout implementation. Shallow analysis here produces cascading problems in layer decomposition, component inventory, and ultimately in the plan and implementation.1121131. Based on the complexity assessment, recommend an architecture pattern. Reference the Architecture Patterns section of `references/design-guide.md`:114 - **Simple CRUD / low complexity** → Layered Architecture (N-Tier with dependency inversion)115 - **Moderate complexity** → Clean Architecture116 - **High complexity / rich domain** → Hexagonal Architecture (Ports and Adapters)1172. For greenfield projects: use the decision framework to justify the recommendation1183. For existing systems: identify the current pattern from the codebase, propose evolution rather than replacement unless the current pattern is fundamentally mismatched1194. Adapt pattern naming and idioms to the project's language and frameworks — read `CLAUDE.md` if present, otherwise detect from the package manifest (`package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`):120 - Java → interfaces, Spring DI annotations, package-by-feature121 - TypeScript → interfaces/abstract classes, constructor injection or tsyringe/InversifyJS122 - Python → Protocol classes (PEP 544) or ABCs, constructor injection, module-by-feature123 - Other stacks → apply the same principles using idiomatic constructs1245. Present the recommendation to the user via AskUserQuestion — confirm or override125126### Step 3: Layer Decomposition127128Define the layers for the selected pattern:1291301. Name each layer and assign its responsibility1312. Define the dependency direction (what depends on what — dependencies always point inward toward the domain)1323. Map layers to concrete directory structure conventions for the project's stack1334. Identify the boundary interfaces between layers134135**Clean Architecture layers (typical):**136| Layer | Responsibility |137|-------|---------------|138| Domain / Entities | Business rules, domain objects, value objects |139| Use Cases / Application | Application-specific orchestration, interactors |140| Interface Adapters | Controllers, presenters, gateways, DTOs |141| Infrastructure / Frameworks | Database, HTTP, external APIs, framework config |142143**Hexagonal layers (typical):**144| Layer | Responsibility |145|-------|---------------|146| Domain Core | Entities, value objects, domain services |147| Ports | Interfaces the core exposes (driving) and consumes (driven) |148| Adapters | Implementations that connect ports to infrastructure |149150**Layered/N-Tier (typical):**151| Layer | Responsibility |152|-------|---------------|153| Presentation | Controllers, API handlers, views |154| Business Logic | Services, validators, domain rules |155| Data Access | Repositories, data mappers, ORM configuration |156157### Step 4: Component Inventory158159For each layer, identify the concrete components needed for this feature.1601611. Reference the Component Catalog in `references/design-guide.md`1622. Map components to the feature's requirements from README.md1633. For each component, specify:164 - Name (following project naming conventions)165 - Type (Model, Repository, Service, Controller, DTO, etc.)166 - Layer assignment167 - One-line purpose1684. If domain complexity is high (from Step 1), include DDD tactical patterns where appropriate:169 - Aggregates (consistency boundaries)170 - Domain Events (state transition signals)171 - Bounded Contexts (if the feature spans multiple domains)172 - Reference the DDD Tactical Patterns section of `references/design-guide.md`173 - Only include DDD patterns when domain complexity warrants it — for simple CRUD, standard components suffice174175### Step 5: Data Flow176177Define how data moves through the layers for the feature's key operations.1781791. Pick 1-2 representative operations (e.g., "create order", "fetch user profile")1802. Trace the data path from external input to persistence and back1813. Identify data transformations at layer boundaries:182 - Request DTO → Domain Entity (at adapter/use-case boundary)183 - Domain Entity → Persistence Model (at use-case/infrastructure boundary)184 - Domain Entity → Response DTO (at use-case/adapter boundary)1854. Include a Mermaid sequence or flowchart diagram showing the flow186187### Step 6: Cross-Cutting Concerns188189Reference the Cross-Cutting Concerns section of `references/design-guide.md`.190191For each concern, determine if it is relevant to this feature and define the approach:192193| Concern | Questions to Assess Relevance |194|---------|------------------------------|195| **Error Handling** | Does this feature have failure modes? External dependencies? User input validation? |196| **Logging** | Does this feature need observability? Is it a critical path? |197| **Configuration** | Does this feature have environment-specific behavior? Feature flags? |198| **Security** | Does this feature handle user data? Authentication? Authorization? |199| **Caching** | Does this feature serve repeated reads? High-latency data sources? |200201For each relevant concern, state the approach in 1-2 sentences. Reference the guidance in `references/design-guide.md` for recommended patterns. Mark irrelevant concerns as "N/A" in the output.202203### Step 7: Human-in-the-Loop (HITL) Review Formulation204205**ultrathink** — The HITL block is the design's contract with the user. Missing a key decision here means the plan will guess, and guesses compound into implementation problems.206207Formulate feedback items for user review:208209**Steering Opportunities (S)** — Directions this design committed to:210- Architecture pattern selection211- Layer structure and naming212- Component granularity (more smaller components vs fewer larger ones)213- Frame as approve/veto/redirect. Each item: short label + one-sentence context + 2-4 choices.214215**Outstanding Questions (Q)** — Unresolved decisions:216- Always generate at least 2 unless the feature is completely unambiguous217- Each must be actionable: decision needed, options, why it matters218- Include a recommendation where the design supports one, marked *(recommended)*219- Frame as A/B/C/D choices220221**KISS/YAGNI Check (K)** — Scope narrowing:222- "Is this component necessary for the initial implementation?"223- "Could a simpler pattern achieve the same goal?"224- Frame as scope-check choices225226**Item guidelines:**227- Target 2-5 items per subsection. No forced minimum — include a subsection only when genuine items exist.228- Each item: 2-4 choices (A/B minimum, A/B/C/D maximum).229- Exactly one choice per item MUST be marked *(recommended)*. This is the default applied when the user does not override the item.230231## Write design.md232233**Voice pre-write check.** When the design exceeds roughly 300 lines, run the Pre-Write Verification step from `ai-skills-reference/voice.md` before writing to file: sample 3-5 sentences from the final third, confirm each term is defined where it first appears, confirm each finding states its consequence, and confirm each reference to another part of the design carries that part's substance. Fix a failing sentence and check its neighbours — drift is systematic. Skip this below ~300 lines.234235Write the design document to `<feature-folder>/design.md` — the folder that resolved in Context Loading, date prefix included — with this structure:236237```markdown238---239title: "Design: <Feature Title>"240---241242# Design: <Feature Title>243244> Feature: <folder name> | Context: .context/README.md | Date: <date>245> Architecture: <selected pattern> | Complexity: <simple/moderate/complex>246247## Architecture Pattern248249**Selected: <Pattern Name>**250251<1-2 sentences: why this pattern fits this feature and project context.>252253### Layers254255| Layer | Responsibility | Dependency Direction |256|-------|---------------|---------------------|257| <layer> | <what it owns> | <depends on → > |258259## Component Inventory260261| Component | Type | Layer | Purpose |262|-----------|------|-------|---------|263| <name> | Model / Repository / Service / etc. | <layer> | <one-line purpose> |264265## Data Flow266267<Mermaid diagram showing data flow for key operation(s)>268269## Cross-Cutting Concerns270271| Concern | Approach | Notes |272|---------|----------|-------|273| Error Handling | <approach or "N/A"> | |274| Logging | <approach or "N/A"> | |275| Security | <approach or "N/A"> | |276| Configuration | <approach or "N/A"> | |277| Caching | <approach or "N/A"> | |278279## Design Decisions280281<Numbered list of key decisions made during design, with brief rationale.>282283## Human-in-the-Loop (HITL) Review284285Every item has a *(recommended)* default. To accept all defaults, proceed without a response. To override, list only the items you want changed (e.g., `S1.B, Q3.C`).286287### Steering Opportunities288289> **S** = Steering — approve, veto, or redirect a direction this design committed to.290291S1. **<Short label>** <One-sentence context.>292 A) <Option> B) <Option> *(recommended)* C) <Option>293294### Outstanding Questions295296> **Q** = Question — resolve an open ambiguity so planning can proceed.297298Q1. **<Short label>** <One-sentence context.>299 A) <Option> *(recommended)* B) <Option> C) <Option> D) <Option>300301### KISS/YAGNI Check302303> **K** = KISS/YAGNI — keep it simple; you aren't gonna need it. Agree to narrow scope or confirm the current approach.304305K1. **<Short label>** <One-sentence context.>306 A) <Option> B) <Option> *(recommended)*307308---309*No response = all *(recommended)* defaults applied. Override format: `S1.B, Q3.C` (only the items you want to change). Free-form feedback also accepted. Resolve before running `/ai-plan`.*310```311312## Status Tracking313314After completing design:3151. Read the feature's README.md3162. Find the Status section3173. Update: `- [x] In progress` (the 3-item Status ladder is Research / In progress / Complete; `Complete` is checked by a human, never by a skill)3184. Use the Edit tool to update (preserve all other content)319320## Manifest Update321322After updating status, update the working manifest at `<output_root>/README.md`:3233241. Read `<output_root>/README.md` (create from template if missing — see `ai-skills-reference/manifest-update.md`)3252. Read this feature's README.md — extract title, first sentence of Description, and last checked Status item3263. Find or append the row for this folder in the table (maintain alphabetical order — for `YYYY-MM-DD-` names this is also chronological order, oldest first; undated legacy rows sort after dated ones because digits precede letters in ASCII)3274. Determine state emoji from the 4-state ladder in `ai-skills-reference/manifest-update.md`: 🆕 (README only) → 🔬 (Research) → 🛠️ (In progress) → ✅ (Complete)3285. Update the row: `| [<folder>](<folder>/) | <emoji> <State> | <description> |`3296. Update the "Last updated" date in the blockquote3307. Write back with the Edit tool (preserve all other rows unchanged)331332## Confirm and Guide333334After writing design.md, tell the user:335- Design document location336- Architecture pattern selected and why337- Number of components in the inventory338- "Run `/ai-plan <feature-name>` to create an implementation plan from this design"339340## Design Standards341342- **Voice**: Read `ai-skills-reference/voice.md` before writing and apply its core rules. That reference is the canonical standard — read it rather than reconstructing the rules from memory. `design.md` is a working artifact, so the deliverable overlay does not apply.343- **Cite context**: Name the `.context/README.md` constraint or objective that informed a decision *and* quote or paraphrase what it said. Naming a section of a second file without its content is the most expensive pointer for a reader — they must open another document to learn what the decision rested on.344- **Be specific**: "Layered Architecture with repository pattern for data access" not "some kind of layers"345- **Justify choices**: Every pattern selection needs a one-sentence rationale tied to the feature's requirements346- **No implementation**: Design describes structure and responsibilities, not code. Code samples belong in the plan.347- **No fabrication**: If you can't determine something from the context or research, say so