Use when SRS doc exists but no design doc and no feature-list.json - take the approved SRS as input and produce an architecture/design document focused on HOW to build it
LANGUAGE RULE: You MUST respond to the user in Chinese (Simplified). All generated documents, reports, and user-facing output must be written in Chinese. Skill names, code identifiers, and JSON field names remain in English.
Design Document Generation
Take the approved SRS as input. Propose implementation approaches, get section-by-section design approval, and produce a design document that answers HOW — while the SRS answers WHAT.
<HARD-GATE>
Do NOT invoke any implementation skill, write any code, scaffold any project, run init_project.py, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.
</HARD-GATE>
Anti-Pattern: "The SRS Is Detailed Enough To Start Coding"
The SRS describes WHAT the system must do. The design document describes HOW. Even when requirements are crystal clear, the implementation approach (architecture, data model, tech stack choices) needs explicit decisions and user approval. Skipping design causes mid-session corrections and rework.
Checklist
相關技能
You MUST create a TodoWrite task for each of these items and complete them in order:
Internal API contracts (§6.2) — feature-to-feature boundaries; every §3.3 component diagram edge must have a corresponding §6.2 row with Contract ID, request/response schemas, and error codes
Boundary: "Detailed requirement-to-test-category mapping, NFR test methods, and cross-feature integration scenarios are defined in the ATS phase — not here."
Development plan — milestones, task decomposition, priority ordering
Must define milestones with clear exit criteria
Must decompose into context-budget-sized features (P0-P3) — each row in §10.2 becomes one feature in feature-list.json; group related right-sized FRs (already validated by SRS G+S heuristics) into vertical slices; include Mapped FRs column for traceability
Must show dependency chain (Mermaid graph) identifying the critical path
Must include risk assessment with mitigation strategies
Feature sizing is upstream: FRs are right-sized at the Requirements phase via bidirectional granularity analysis (G1-G6 split + S1-S4 group). §10.2 groups these right-sized FRs into implementation features. Each row should map 1+ related FRs into a vertical slice that productively fills one Worker session (~50% of context window). Feature counts in the scaling table below refer to the final §10.2 row count.
Present each section. Wait for user feedback. Incorporate changes before moving to the next.
For simple projects (< 5 features): Combine all sections into a single approval step, but still include the required diagrams and dependency versions.
Step 4b: Merge Codebase Conventions into Design
Skip this step if docs/rules/ does not exist or contains only a greenfield stub.
If docs/rules/ is populated with convention scan results (from Phase 0-pre codebase scanner):
Read all docs/rules/*.md files — coding-style.md, coding-constraints.md, build-and-compilation.md, commit-conventions.md
Populate §13 of the design document (Codebase Conventions & Constraints) using the design template's §13 structure:
§13.1: Extract "Mandatory Internal Libraries" table from coding-constraints.md
§13.2: Extract "Prohibited APIs / Libraries" table from coding-constraints.md
§13.3: Extract "Approved 3rd-Party Libraries" table from coding-constraints.md
§13.4: Extract "Static Analysis Tools" table from coding-constraints.md (tool name + config path + run command only — do not read config contents)
§13.5: Extract key naming and formatting rules from coding-style.md (summary table)
§13.6: Extract error handling pattern from coding-constraints.md
§13.7: Extract build system and CI/CD summary from build-and-compilation.md
§13.8: Extract commit format and branch naming from commit-conventions.md
Cross-verify — check for conflicts between scanned conventions and design decisions:
§8 (Third-Party Dependencies): new dependencies must not conflict with §13.2 prohibited list
§6.2 (Internal API Contracts): libraries used must comply with §13.1 internal library mandates
If conflicts exist: mark with "⚠ Design Override: [reason]" and present to user for confirmation
Present §13 to user for review (same approval flow as other sections)
Step 5: Write Design Document
Save the approved design to docs/plans/YYYY-MM-DD-<topic>-design.md.
Template usage
Read the template found in Step 2 (user-specified or default docs/templates/design-template.md):
Preserve the template's heading structure
Replace guidance text under each heading with approved design content
Add metadata at top if not already present (Date, Status, SRS Reference, Template path)
For uncovered template sections: mark "[Not applicable]"
For approved content without matching template section: append as "Additional Notes"
Step 5b: Design Integration Coherence Check
Before transitioning to ATS, mechanically verify cross-feature integration coherence:
Contract completeness: For each edge in §3.3 component diagram, verify a corresponding row exists in §6.2 Internal API Contracts. Flag missing rows.
Schema consistency: For each §6.2 row, verify that Provider feature's §4.N class diagram includes the Response Schema type, and Consumer feature's §4.N references the Request Schema. Flag mismatches.
Dependency completeness: For each feature that appears in a §6.2 "Consumer" column, verify it lists the Provider feature ID in §11.3 dependency chain. Flag missing dependency edges.
Present any flagged issues to the user. Resolve before proceeding to ATS.
Step 6: Transition to ATS
Once the design document is saved and committed:
Summarize key inputs the ATS skill will need:
From SRS: all FR/NFR/IFR requirements with acceptance criteria
From Design: testing strategy, tech stack, architecture risk areas
REQUIRED SUB-SKILL: Invoke long-task:long-task-ats to generate the Acceptance Test Strategy
Scaling the Design Phase
Project Size
Features
Design Depth
Tiny
1-5
Single paragraph approach + 1 approval step; logical view + 1 feature diagram + dependency table + simplified dev plan
Thin for ALL features: overview + key types + integration surface only
Thin §4.N format:
### 4.N Feature: <Name> (FR-xxx)
#### 4.N.1 Overview
[1-2 sentences]
#### 4.N.2 Key Types
[List the main classes/types this feature introduces, with one-line purpose each]
#### 4.N.6 Integration Surface
[Provides/Requires tables referencing §6.2]
This is safe because the feature-design SubAgent (Worker Step 4) produces the full class/sequence/flow/algorithm design with access to §6.2 contracts. The thin §4.N serves as an integration specification, not a complete design.
Red Flags
Rationalization
Correct Response
"The SRS already implies the architecture"
SRS describes WHAT, not HOW. Present options.
"There's only one way to build this"
Present at least 2 approaches. Even obvious choices benefit from stated trade-offs.
"I already know the best approach"
Present options, let the user choose
"The user seems impatient, I'll skip design"
Explain the value briefly, then run efficiently
"I'll design as I go"
Upfront design is cheaper than mid-session corrections
"Let me re-clarify requirements here"
Requirements belong in the SRS. If missing, note as Open Question and resolve with user before design.
Diagram Requirements
All architectural and design views MUST use Mermaid syntax. This ensures:
Diagrams are version-controlled alongside the document (no external image files)
Diagrams are renderable in GitHub, GitLab, and most Markdown viewers
Diagrams stay in sync with design changes
Required Diagram Types
Section
Diagram Type
Mermaid Syntax
Required?
Architecture Logical View
Layered package diagram
graph TB
Always
Architecture Components
Component interaction
graph LR
Always
Key Feature — Structure
Class diagram
classDiagram
Per feature
Key Feature — Behavior
Sequence diagram
sequenceDiagram
Per feature (at least one behavioral)
Key Feature — Logic
Flow/decision diagram
flowchart TD
Per feature (at least one behavioral)
Data Model
ER diagram
erDiagram
If persistent storage
Dependency Graph
Dependency tree
graph LR
If > 3 third-party deps
Development Plan
Critical path
graph LR
Always
Diagram Quality Checklist
Each diagram has a clear title or surrounding heading
Class diagrams show visibility modifiers (+/-/#) and key methods
Sequence diagrams show the main success path and at least one error path
Flow diagrams include decision nodes for all branching logic
No placeholder diagrams — every diagram reflects actual approved design content
Every edge in §3.3 component diagram includes Contract ID referencing §6.2
Third-Party Dependency Rules
Exact versions required — specify 1.2.3 or a constrained range ^1.2.0 / >=1.2,<2.0; never use latest or omit version
Compatibility matrix — verify each dependency is compatible with:
The target language/runtime version (e.g., Python >= 3.10, Node >= 18)
Other dependencies in the stack (check for known conflicts)
License audit — document the license for each dependency; flag any copyleft licenses (GPL, AGPL) that may conflict with project requirements
Upgrade path — note any dependencies approaching EOL or with known migration concerns
Development Plan Rules
The development plan section bridges the design document to the Init phase. It MUST include:
Milestones — time-boxed phases with clear scope and exit criteria
M1 is always "Foundation" (project skeleton, CI, core abstractions)
Final milestone is always "Polish & Release" (NFR verification, docs, examples)
Task decomposition — features mapped to priorities (P0-P3) with rationale
P0: Foundation — required by all other features
P1: Core value — the minimum viable feature set
P2: Extended — important but not launch-blocking
P3: Nice-to-have — defer if timeline is tight
Dependency chain — Mermaid graph showing which features block others
Paired feature ordering — When the project has both backend and frontend features, organize the task decomposition table so that each backend feature is paired with its corresponding frontend feature. This produces a natural development flow: Backend A → Frontend A → Backend B → Frontend B. The Init phase uses this pairing to order features in feature-list.json.
Risk register — technical and schedule risks with mitigation
The Init phase uses this plan to populate feature-list.json with correct priority ordering, paired grouping, and dependency chains.
Integration
Called by: using-long-task (when SRS + UCD exist, no design doc, no feature-list.json) or long-task-ucd (Step 8)
Requires: Approved SRS at docs/plans/*-srs.md; optionally approved UCD at docs/plans/*-ucd.md (for UI projects); optionally docs/rules/*.md (codebase conventions from Phase 0-pre scan)
Chains to: long-task-ats (after design approval)
Produces:docs/plans/YYYY-MM-DD-<topic>-design.md (includes §13 Codebase Conventions if docs/rules/ exists)
02
Anti-Pattern: "The SRS Is Detailed Enough To Start Coding"