@haaaiawd/anws 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/cli.js +52 -22
- package/lib/diff.js +5 -2
- package/lib/init.js +217 -96
- package/lib/install-state.js +18 -3
- package/lib/manifest.js +376 -79
- package/lib/prompt.js +68 -0
- package/lib/resources/index.js +36 -2
- package/lib/update.js +12 -6
- package/package.json +48 -47
- package/templates/.agents/skills/anws-system/SKILL.md +108 -108
- package/templates/.agents/skills/code-reviewer/SKILL.md +170 -115
- package/templates/.agents/skills/concept-modeler/SKILL.md +230 -179
- package/templates/.agents/skills/craft-authoring/SKILL.md +186 -183
- package/templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +61 -0
- package/templates/.agents/skills/design-reviewer/SKILL.md +265 -190
- package/templates/.agents/skills/e2e-testing-guide/SKILL.md +246 -135
- package/templates/.agents/skills/nexus-mapper/SKILL.md +321 -321
- package/templates/.agents/skills/output-contract/SKILL.md +37 -0
- package/templates/.agents/skills/report-template/SKILL.md +92 -92
- package/templates/.agents/skills/sequential-thinking/SKILL.md +222 -225
- package/templates/.agents/skills/spec-writer/SKILL.md +75 -30
- package/templates/.agents/skills/system-architect/SKILL.md +538 -678
- package/templates/.agents/skills/system-designer/SKILL.md +601 -601
- package/templates/.agents/skills/task-planner/SKILL.md +1 -2
- package/templates/.agents/skills/task-reviewer/SKILL.md +428 -388
- package/templates/.agents/skills/tech-evaluator/SKILL.md +252 -144
- package/templates/.agents/workflows/blueprint.md +157 -69
- package/templates/.agents/workflows/challenge.md +331 -497
- package/templates/.agents/workflows/change.md +182 -339
- package/templates/.agents/workflows/craft.md +159 -197
- package/templates/.agents/workflows/design-system.md +202 -674
- package/templates/.agents/workflows/explore.md +187 -399
- package/templates/.agents/workflows/forge.md +650 -609
- package/templates/.agents/workflows/genesis.md +439 -351
- package/templates/.agents/workflows/probe.md +219 -241
- package/templates/.agents/workflows/quickstart.md +302 -123
- package/templates/.agents/workflows/upgrade.md +145 -182
- package/templates_en/.agents/skills/anws-system/SKILL.md +108 -0
- package/templates_en/.agents/skills/code-reviewer/SKILL.md +170 -0
- package/templates_en/.agents/skills/concept-modeler/SKILL.md +230 -0
- package/templates_en/.agents/skills/craft-authoring/SKILL.md +179 -0
- package/templates_en/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +60 -0
- package/templates_en/.agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md +92 -0
- package/templates_en/.agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md +52 -0
- package/templates_en/.agents/skills/design-reviewer/SKILL.md +265 -0
- package/templates_en/.agents/skills/e2e-testing-guide/SKILL.md +246 -0
- package/templates_en/.agents/skills/nexus-mapper/SKILL.md +306 -0
- package/templates_en/.agents/skills/nexus-mapper/references/language-customization.md +167 -0
- package/templates_en/.agents/skills/nexus-mapper/references/output-schema.md +311 -0
- package/templates_en/.agents/skills/nexus-mapper/references/probe-protocol.md +246 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/extract_ast.py +706 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/git_detective.py +194 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/languages.json +127 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/query_graph.py +556 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/requirements.txt +6 -0
- package/templates_en/.agents/skills/nexus-query/SKILL.md +114 -0
- package/templates_en/.agents/skills/nexus-query/scripts/extract_ast.py +706 -0
- package/templates_en/.agents/skills/nexus-query/scripts/git_detective.py +194 -0
- package/templates_en/.agents/skills/nexus-query/scripts/languages.json +127 -0
- package/templates_en/.agents/skills/nexus-query/scripts/query_graph.py +556 -0
- package/templates_en/.agents/skills/nexus-query/scripts/requirements.txt +6 -0
- package/templates_en/.agents/skills/output-contract/SKILL.md +37 -0
- package/templates_en/.agents/skills/report-template/SKILL.md +85 -0
- package/templates_en/.agents/skills/report-template/references/REPORT_TEMPLATE.md +100 -0
- package/templates_en/.agents/skills/runtime-inspector/SKILL.md +101 -0
- package/templates_en/.agents/skills/sequential-thinking/SKILL.md +214 -0
- package/templates_en/.agents/skills/spec-writer/SKILL.md +153 -0
- package/templates_en/.agents/skills/spec-writer/references/prd_template.md +177 -0
- package/templates_en/.agents/skills/system-architect/SKILL.md +538 -0
- package/templates_en/.agents/skills/system-architect/references/rfc_template.md +59 -0
- package/templates_en/.agents/skills/system-designer/SKILL.md +534 -0
- package/templates_en/.agents/skills/system-designer/references/system-design-detail-template.md +187 -0
- package/templates_en/.agents/skills/system-designer/references/system-design-template.md +605 -0
- package/templates_en/.agents/skills/task-planner/SKILL.md +251 -0
- package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +109 -0
- package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05B.md +176 -0
- package/templates_en/.agents/skills/task-reviewer/SKILL.md +428 -0
- package/templates_en/.agents/skills/tech-evaluator/SKILL.md +252 -0
- package/templates_en/.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md +78 -0
- package/templates_en/.agents/workflows/blueprint.md +200 -0
- package/templates_en/.agents/workflows/challenge.md +331 -0
- package/templates_en/.agents/workflows/change.md +182 -0
- package/templates_en/.agents/workflows/craft.md +159 -0
- package/templates_en/.agents/workflows/design-system.md +202 -0
- package/templates_en/.agents/workflows/explore.md +187 -0
- package/templates_en/.agents/workflows/forge.md +651 -0
- package/templates_en/.agents/workflows/genesis.md +439 -0
- package/templates_en/.agents/workflows/probe.md +219 -0
- package/templates_en/.agents/workflows/quickstart.md +303 -0
- package/templates_en/.agents/workflows/upgrade.md +145 -0
- package/templates_en/AGENTS.md +149 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: system-designer
|
|
3
|
+
description: Design detailed technical documentation for a single system. Responsible for architecture diagrams, interface design, data models, Trade-offs discussions, etc.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# System Designer Manual
|
|
7
|
+
|
|
8
|
+
> "Good design is obvious. Great design is transparent."
|
|
9
|
+
> ― Joe Sparano
|
|
10
|
+
|
|
11
|
+
You are a **System Designer**, responsible for designing detailed technical architecture documentation for a single system.
|
|
12
|
+
Your goal is to produce clear, complete, implementable system design.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Core Principles
|
|
17
|
+
|
|
18
|
+
> [!IMPORTANT]
|
|
19
|
+
> **Three Pillars of Design**:
|
|
20
|
+
>
|
|
21
|
+
> 1. **Clear Boundaries** - Clearly define system responsibility scope, what to do, what not to do
|
|
22
|
+
> 2. **Constraint Inheritance** - Inherit performance, security and other constraints from PRD and ADR, cannot relax on your own
|
|
23
|
+
> 3. **Transparent Trade-offs** - Every tech selection must explain "why choose A not B"
|
|
24
|
+
|
|
25
|
+
**Wrong approach**:
|
|
26
|
+
- Design in isolation, not researching industry best practices
|
|
27
|
+
- Over-design, introducing unnecessary complexity
|
|
28
|
+
- Tech selection without explaining reasons
|
|
29
|
+
- Ignore performance/security constraints
|
|
30
|
+
- Missing or unclear architecture diagrams
|
|
31
|
+
|
|
32
|
+
**Right approach**:
|
|
33
|
+
- **Research-driven** - First use /explore to research best practices
|
|
34
|
+
- **Deep thinking** - Use `sequential-thinking` skill to organize 3-7 thoughts for design
|
|
35
|
+
- **Trade-offs discussion** - Google Design Docs style, explain trade-offs
|
|
36
|
+
- **Visualized architecture** - Use Mermaid to draw architecture diagrams and data flow diagrams
|
|
37
|
+
- **Traceability chain** - Reference PRD requirements [REQ-XXX]
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Design Framework: 6D Methodology
|
|
42
|
+
|
|
43
|
+
### 1. **Discover**
|
|
44
|
+
- **Input**: PRD summary + Architecture Overview + system boundaries
|
|
45
|
+
- **Questions**:
|
|
46
|
+
- "Which PRD requirements does this system relate to?"
|
|
47
|
+
- "What is the core responsibility of this system? Summarize in one sentence."
|
|
48
|
+
- "Where are the system boundaries? What are inputs and outputs?"
|
|
49
|
+
- **Output**: System understanding report
|
|
50
|
+
|
|
51
|
+
### 2. **Deep-Dive**
|
|
52
|
+
- **Input**: System understanding report
|
|
53
|
+
- **Action**: Call `/explore` to research industry best practices
|
|
54
|
+
- **Questions**:
|
|
55
|
+
- "What architecture patterns are typically used for this type of system?"
|
|
56
|
+
- "What are common tech selections? Pros and cons?"
|
|
57
|
+
- "What are common pitfalls and anti-patterns?"
|
|
58
|
+
- **Output**: Research report (save to `_research/{system-id}-research.md`)
|
|
59
|
+
|
|
60
|
+
### 3. **Decompose**
|
|
61
|
+
- **Input**: Research report + system understanding
|
|
62
|
+
- **Action**: Use `sequential-thinking` skill to decompose system
|
|
63
|
+
- **Questions**:
|
|
64
|
+
- "What are the core components? What are their responsibilities?"
|
|
65
|
+
- "How do components communicate?"
|
|
66
|
+
- "How is code directory structure organized?"
|
|
67
|
+
- **Output**: Component list + architecture sketch
|
|
68
|
+
|
|
69
|
+
### 4. **Design**
|
|
70
|
+
- **Input**: Component list + architecture sketch
|
|
71
|
+
- **Action**: Design interfaces, data models, tech stack
|
|
72
|
+
- **Questions**:
|
|
73
|
+
- "How to design interfaces? (API endpoints/component Props/message formats)"
|
|
74
|
+
- "What is the data model? (entities, Schema)"
|
|
75
|
+
- "Why choose this tech stack? (Trade-offs)"
|
|
76
|
+
- **Output**: Detailed design draft
|
|
77
|
+
|
|
78
|
+
### 5. **Defend**
|
|
79
|
+
- **Input**: Detailed design draft
|
|
80
|
+
- **Action**: Analyze performance, security, maintainability
|
|
81
|
+
- **Questions**:
|
|
82
|
+
- "What are performance bottlenecks? How to optimize?"
|
|
83
|
+
- "What are security risks? How to mitigate?"
|
|
84
|
+
- "How to test? Unit, integration, E2E?"
|
|
85
|
+
- **Output**: Defense strategy (performance, security, testing)
|
|
86
|
+
|
|
87
|
+
### 6. **Document**
|
|
88
|
+
- **Input**: All above outputs
|
|
89
|
+
- **Action**: Use system design template to fill 14 chapters
|
|
90
|
+
- **Output**: Complete system design document (.md)
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Two-Layer Document Structure
|
|
95
|
+
|
|
96
|
+
> [!IMPORTANT]
|
|
97
|
+
> **Each system's design document uses L0 + (optional) L1 two-layer structure.**
|
|
98
|
+
|
|
99
|
+
| Layer | File | Content | Load Frequency |
|
|
100
|
+
| :-----------: | -------------------- | --------------------------------- | :-------------------------: |
|
|
101
|
+
| **L0 Navigation** | `{system}.md` | Architecture diagram, operation contract table, design decisions | High (load every time) |
|
|
102
|
+
| **L1 Implementation** | `{system}.detail.md` | Complete pseudocode, config constants, edge cases | Low (load when explicitly referenced) |
|
|
103
|
+
|
|
104
|
+
### L1 Split Rules (R1–R5)
|
|
105
|
+
|
|
106
|
+
**Trigger any one rule to create `{system}.detail.md`**:
|
|
107
|
+
|
|
108
|
+
| Rule ID | Trigger Condition | Reason |
|
|
109
|
+
| :-----: | ----------------------------------------------- | ---------------------------------------------- |
|
|
110
|
+
| **R1** | Single continuous code block **> 30 lines** | This length is already implementation detail, not design intent |
|
|
111
|
+
| **R2** | Total lines of all code blocks in doc **> 200 lines** | Code exceeding text means doc leans toward implementation layer |
|
|
112
|
+
| **R3** | Config constant dictionary entries **> 5** | Config data and design doc have different reading purposes |
|
|
113
|
+
| **R4** | Version inline comments (`# vX.X change`) **> 5** | Version history should be centralized to §Version History, not scattered in code |
|
|
114
|
+
| **R5** | Total doc lines **> 500 lines** | `.md` over 500 lines is burden on AI context |
|
|
115
|
+
|
|
116
|
+
### L0 and L1 Content Boundaries
|
|
117
|
+
|
|
118
|
+
| Content Type | L0 Navigation | L1 Implementation |
|
|
119
|
+
| ------------------------------- | :------------: | :---------------: |
|
|
120
|
+
| System goals, architecture diagram, Trade-offs | | |
|
|
121
|
+
| Operation contract table (see Rule 7) | | |
|
|
122
|
+
| `@dataclass` attribute field declarations | | |
|
|
123
|
+
| Protocol/ABC interface signatures | | |
|
|
124
|
+
| Mermaid decision tree, data flow | | |
|
|
125
|
+
| Function body pseudocode (> 10 lines) | | |
|
|
126
|
+
| Config constant definition table | | |
|
|
127
|
+
| Version change history | | |
|
|
128
|
+
| Edge cases, implementation notes | | |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Output Format: System Design Document Structure
|
|
133
|
+
|
|
134
|
+
Use `.agent\skills\system-designer\references\system-design-template.md` template.
|
|
135
|
+
|
|
136
|
+
**14 chapters**:
|
|
137
|
+
|
|
138
|
+
### Must Have Chapters — L0 Navigation Layer
|
|
139
|
+
1. **Overview** - System purpose, boundaries, responsibilities
|
|
140
|
+
2. **Goals & Non-Goals** - Inherited from PRD
|
|
141
|
+
3. **Background** - Why needed, related requirements
|
|
142
|
+
4. **Architecture** - Architecture diagram + components + data flow
|
|
143
|
+
5. **Interface Design** - Operation contract table / cross-system protocols
|
|
144
|
+
6. **Data Model** - Attribute field declarations + entity relationship diagram
|
|
145
|
+
7. **Tech Stack** - Core technologies + dependency libraries
|
|
146
|
+
8. **Trade-offs & Alternatives** - Why choose A not B
|
|
147
|
+
9. **Security** - Authentication, encryption, risk mitigation
|
|
148
|
+
10. **Performance** - Goals, optimization strategies, monitoring
|
|
149
|
+
11. **Testing** - Unit, integration, E2E, contract verification responsibility matrix
|
|
150
|
+
|
|
151
|
+
### Optional Chapters
|
|
152
|
+
12. **Deployment** - Deployment process, monitoring alerts (can simplify for small projects)
|
|
153
|
+
13. **Future** - Extensibility, technical debt (can omit)
|
|
154
|
+
14. **Appendix** - Glossary, references (can omit)
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Designer Rules
|
|
159
|
+
|
|
160
|
+
### Rule 1: Research First
|
|
161
|
+
**Rule**: Before designing any system, **must** first research industry best practices.
|
|
162
|
+
|
|
163
|
+
**Why?** Avoid reinventing the wheel, learn from others' experience.
|
|
164
|
+
|
|
165
|
+
**How?**
|
|
166
|
+
```
|
|
167
|
+
1. Identify system type (frontend/backend/database/Agent)
|
|
168
|
+
2. Call /explore to research best practices for that type of system
|
|
169
|
+
3. Extract key insights (architecture patterns, tech selections, pitfalls)
|
|
170
|
+
4. Apply to design
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Example**:
|
|
174
|
+
```
|
|
175
|
+
- Frontend system → research "React + Vite best architecture 2025"
|
|
176
|
+
- Backend API → research "FastAPI best practices"
|
|
177
|
+
- Agent system → research "LangGraph multi-agent design patterns"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### Rule 2: Deep Thinking, No Guessing
|
|
183
|
+
**Rule**: Use `sequential-thinking` skill to organize **3-7 thoughts** for design, depending on complexity.
|
|
184
|
+
|
|
185
|
+
**Why?** Design is complex activity, needs systematic thinking.
|
|
186
|
+
|
|
187
|
+
**Thinking path**:
|
|
188
|
+
```
|
|
189
|
+
Architecture design (patterns, components, communication)
|
|
190
|
+
Interface design (API, data formats)
|
|
191
|
+
Data model design
|
|
192
|
+
Trade-offs discussion (why choose A not B)
|
|
193
|
+
Performance and security (bottlenecks, risks, optimization)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### Rule 3: Transparent Trade-offs (Google Style)
|
|
199
|
+
**Rule**: Every important tech selection must explain "why choose A not B".
|
|
200
|
+
|
|
201
|
+
**Why?** Help future maintainers understand design intent.
|
|
202
|
+
|
|
203
|
+
**Template**:
|
|
204
|
+
```markdown
|
|
205
|
+
### Decision X: [Decision Title]
|
|
206
|
+
|
|
207
|
+
**Option A: [Option A] ( Selected)**
|
|
208
|
+
- Pros: [List pros]
|
|
209
|
+
- Cons: [List cons]
|
|
210
|
+
|
|
211
|
+
**Option B: [Option B]**
|
|
212
|
+
- Pros: [List pros]
|
|
213
|
+
- Cons: [List cons]
|
|
214
|
+
|
|
215
|
+
**Decision**: [Why choose A? What are key reasons?]
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Example**:
|
|
219
|
+
```markdown
|
|
220
|
+
### Decision 1: Why PostgreSQL not MongoDB?
|
|
221
|
+
|
|
222
|
+
**Option A: PostgreSQL ( Selected)**
|
|
223
|
+
- ACID guarantee, strong consistency
|
|
224
|
+
- Team familiar with SQL
|
|
225
|
+
- Horizontal scaling not as good as NoSQL
|
|
226
|
+
|
|
227
|
+
**Option B: MongoDB**
|
|
228
|
+
- Flexible Schema
|
|
229
|
+
- We need strong consistency
|
|
230
|
+
|
|
231
|
+
**Decision**: Choose PostgreSQL, because user authentication needs strong consistency, more important than Schema flexibility.
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Rule 4: Architecture Visualization
|
|
237
|
+
**Rule**: **Must** use Mermaid to draw architecture diagrams and data flow diagrams.
|
|
238
|
+
|
|
239
|
+
**Why?** A picture is worth a thousand words.
|
|
240
|
+
|
|
241
|
+
**Architecture diagram example**:
|
|
242
|
+
```mermaid
|
|
243
|
+
graph TD
|
|
244
|
+
A[User] -->|HTTP| B[Frontend]
|
|
245
|
+
B -->|API Call| C[Backend API]
|
|
246
|
+
C -->|Query| D[PostgreSQL]
|
|
247
|
+
C -->|Cache| E[Redis]
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Data flow diagram example**:
|
|
251
|
+
```mermaid
|
|
252
|
+
sequenceDiagram
|
|
253
|
+
User->>Frontend: Input login info
|
|
254
|
+
Frontend->>Backend: POST /auth/login
|
|
255
|
+
Backend->>Database: Verify user
|
|
256
|
+
Database-->>Backend: User info
|
|
257
|
+
Backend-->>Frontend: JWT Token
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### Rule 5: Constraint Inheritance, No Relaxation
|
|
263
|
+
**Rule**: Constraints inherited from PRD and ADR **cannot be relaxed**, can only be stricter.
|
|
264
|
+
|
|
265
|
+
**Why?** Constraints are business and technology baselines.
|
|
266
|
+
|
|
267
|
+
**Checklist**:
|
|
268
|
+
- [ ] Are PRD performance constraints inherited? (e.g., API < 200ms)
|
|
269
|
+
- [ ] Are PRD security constraints inherited? (e.g., HTTPS only)
|
|
270
|
+
- [ ] Are ADR tech decisions followed? (e.g., use JWT authentication)
|
|
271
|
+
|
|
272
|
+
**Example**:
|
|
273
|
+
```
|
|
274
|
+
PRD constraint: API response time p95 < 200ms
|
|
275
|
+
↓
|
|
276
|
+
System Design:
|
|
277
|
+
- Performance goal: p95 < 200ms, p99 < 500ms (stricter)
|
|
278
|
+
- Optimization strategy: Redis cache, database indexes
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
### Rule 6: Complete Traceability Chain
|
|
284
|
+
**Rule**: Reference PRD requirements `[REQ-XXX]` in interface design and data model.
|
|
285
|
+
|
|
286
|
+
**Why?** Ensure any design can be traced back to requirements, avoid over-design.
|
|
287
|
+
|
|
288
|
+
**Example**:
|
|
289
|
+
```markdown
|
|
290
|
+
## 5. Interface Design
|
|
291
|
+
|
|
292
|
+
### POST /auth/login [REQ-001]
|
|
293
|
+
**Purpose**: User login authentication (corresponds to PRD requirement REQ-001)
|
|
294
|
+
|
|
295
|
+
### User Entity [REQ-001, REQ-002]
|
|
296
|
+
```typescript
|
|
297
|
+
interface User {
|
|
298
|
+
id: string;
|
|
299
|
+
email: string; // REQ-001: User login
|
|
300
|
+
name: string; // REQ-002: User profile
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
### Rule 7: Operation Contract Table (Must for Agent/Game Systems)
|
|
308
|
+
**Rule**: For Agent, game core, messaging systems, **must use operation contract table instead of function pseudocode**, move complete pseudocode to `.detail.md`.
|
|
309
|
+
|
|
310
|
+
**Why?** One table row = information of 30 lines pseudocode, and more AI context friendly.
|
|
311
|
+
|
|
312
|
+
**Table format**:
|
|
313
|
+
|
|
314
|
+
```markdown
|
|
315
|
+
### Operation Contract: {XXX Class Operations}
|
|
316
|
+
|
|
317
|
+
| Operation | [REQ-XXX] | Preconditions | Cost/Input | Output/Side Effects | Implementation Detail |
|
|
318
|
+
| -------------------------- | :-------: | -------------------------- | --------- | ----------------------------------------- | :-------------------------------: |
|
|
319
|
+
| `embark(unit, port)` | [REQ-012] | Land unit; has port; hasn't acted | 3 | Generate Boat, carry unit; original unit disappears | [§3.1](./detail.md) |
|
|
320
|
+
| `disembark(boat, pos)` | [REQ-012] | boat has load; target is land | 0 | Release unit to pos; boat disassembles | [§3.2](./detail.md) |
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Fill guidelines**:
|
|
324
|
+
- Operation name: `func_name(key_params)` style, parameters only write key inputs, no type annotations
|
|
325
|
+
- Preconditions: separated by `;`, no more than 3
|
|
326
|
+
- Implementation detail: link to `.detail.md` corresponding chapter (if not yet created, fill "to be added")
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
### Rule 8: Mermaid Before Pseudocode
|
|
331
|
+
**Rule**: For decision tree, state machine type logic, **prioritize using Mermaid flowchart**, move complete pseudocode to `.detail.md`.
|
|
332
|
+
|
|
333
|
+
**Why?** Mermaid diagrams have lower AI input token consumption in L0 layer, and higher visualization degree.
|
|
334
|
+
|
|
335
|
+
**Example**:
|
|
336
|
+
|
|
337
|
+
````markdown
|
|
338
|
+
### Decision Tree: Land Unit Task Planning
|
|
339
|
+
|
|
340
|
+
```mermaid
|
|
341
|
+
flowchart TD
|
|
342
|
+
A[Unit on neutral village?] -->|Yes| B[→ capture task, priority 100]
|
|
343
|
+
A -->|No| C[HP < retreat threshold?]
|
|
344
|
+
C -->|Yes| D[→ move_to nearest friendly city, priority 90]
|
|
345
|
+
C -->|No| E{Military strategy}
|
|
346
|
+
E -->|aggressive| F[→ attack/approach target]
|
|
347
|
+
E -->|defensive| G[→ guard undefended city]
|
|
348
|
+
E -->|neutral| H[→ explore/expansion focus]
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
> Complete implementation see [`executor.detail.md §4.1`](./executor.detail.md)
|
|
352
|
+
````
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
### Tool 1: System Design L0 Template (Navigation Layer)
|
|
357
|
+
- **Path**: `.agent/skills/system-designer/references/system-design-template.md`
|
|
358
|
+
- **Purpose**: L0 navigation layer template, 14 chapter structure, operation contract table format
|
|
359
|
+
- **Usage**: `view_file .agent/skills/system-designer/references/system-design-template.md`
|
|
360
|
+
|
|
361
|
+
### Tool 2: System Design L1 Template (Implementation Layer)
|
|
362
|
+
- **Path**: `.agent/skills/system-designer/references/system-design-detail-template.md`
|
|
363
|
+
- **Purpose**: L1 implementation layer template, create `{system}.detail.md` when any of R1-R5 triggered
|
|
364
|
+
- **Usage**: `view_file .agent/skills/system-designer/references/system-design-detail-template.md`
|
|
365
|
+
|
|
366
|
+
### Tool 3: Research Report Storage
|
|
367
|
+
- **Path**: `.anws/v{N}/04_SYSTEM_DESIGN/_research/{system-id}-research.md`
|
|
368
|
+
- **Purpose**: Save /explore research results
|
|
369
|
+
- **Format**: Exploration Report (generated by /explore)
|
|
370
|
+
|
|
371
|
+
### Tool 4: Architecture Diagram Tool
|
|
372
|
+
- **Tool**: Mermaid
|
|
373
|
+
- **Syntax**:
|
|
374
|
+
- `graph TD` - Architecture diagram
|
|
375
|
+
- `flowchart TD` - Decision tree (prioritize this over pseudocode, see Rule 8)
|
|
376
|
+
- `sequenceDiagram` - Data flow diagram
|
|
377
|
+
- `classDiagram` - Entity relationship diagram
|
|
378
|
+
- **Reference**: [Mermaid Documentation](https://mermaid.js.org/)
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Quality Checklist
|
|
383
|
+
|
|
384
|
+
After completing system design document, use this checklist for self-check:
|
|
385
|
+
|
|
386
|
+
### Structural Completeness
|
|
387
|
+
- [ ] Contains all 11 mandatory chapters
|
|
388
|
+
- [ ] Architecture diagram exists and is clear (Mermaid)
|
|
389
|
+
- [ ] Data flow diagram exists (if applicable)
|
|
390
|
+
- [ ] If system involves public contracts, 11.5 Contract Verification Matrix filled
|
|
391
|
+
- [ ] Trade-offs chapter discusses at least 2 important decisions
|
|
392
|
+
|
|
393
|
+
### Content Quality
|
|
394
|
+
- [ ] System boundary definition clear (input/output/dependencies)
|
|
395
|
+
- [ ] **§5 Interface Design uses operation contract table**, not function pseudocode (Rule 7)
|
|
396
|
+
- [ ] **§6 Data Model only has attribute fields + Protocol signatures**, no method bodies (Rule 8)
|
|
397
|
+
- [ ] Trade-offs chapter discusses at least 2 important decisions
|
|
398
|
+
- [ ] Decision trees/flowcharts use Mermaid, not pseudocode (Rule 8)
|
|
399
|
+
|
|
400
|
+
### Constraint Compliance
|
|
401
|
+
- [ ] PRD performance constraints inherited
|
|
402
|
+
- [ ] PRD security constraints inherited
|
|
403
|
+
- [ ] ADR tech decisions followed
|
|
404
|
+
- [ ] Traceability chain complete ([REQ-XXX] references)
|
|
405
|
+
- [ ] **L0 file has no method body pseudocode** (if present, immediately move to `.detail.md §3`)
|
|
406
|
+
- [ ] **`.detail.md` created when R1-R5 triggered** (otherwise mark "to be added")
|
|
407
|
+
|
|
408
|
+
### Implementability
|
|
409
|
+
- [ ] Operation contract table complete (each core operation has corresponding row)
|
|
410
|
+
- [ ] Testing strategy clear (unit/integration/E2E)
|
|
411
|
+
- [ ] If `.detail.md` created, §3 each subsection filled with "admission reason"
|
|
412
|
+
- [ ] Deployment process clear (if needed)
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Common Scenarios and Best Practices
|
|
417
|
+
|
|
418
|
+
### Scenario 1: Design Frontend System
|
|
419
|
+
**Core focus**:
|
|
420
|
+
- Component design (reusability, Props interface)
|
|
421
|
+
- State management (Context vs Zustand vs Redux)
|
|
422
|
+
- Routing design (React Router)
|
|
423
|
+
- Performance optimization (lazy loading, Code Splitting)
|
|
424
|
+
|
|
425
|
+
**Research topics**:
|
|
426
|
+
- "React component design patterns 2025"
|
|
427
|
+
- "React state management best practices"
|
|
428
|
+
- "Frontend performance optimization techniques"
|
|
429
|
+
|
|
430
|
+
**Trade-offs examples**:
|
|
431
|
+
- Context API vs Zustand
|
|
432
|
+
- CSS-in-JS vs TailwindCSS
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
### Scenario 2: Design Backend API System
|
|
437
|
+
**Core focus**:
|
|
438
|
+
- API design (RESTful vs GraphQL)
|
|
439
|
+
- Authentication authorization (JWT vs Session)
|
|
440
|
+
- Database connection (ORM vs native SQL)
|
|
441
|
+
- Caching strategy (Redis, local cache)
|
|
442
|
+
|
|
443
|
+
**Research topics**:
|
|
444
|
+
- "FastAPI best architecture 2025"
|
|
445
|
+
- "RESTful API design best practices"
|
|
446
|
+
- "API performance optimization and caching"
|
|
447
|
+
|
|
448
|
+
**Trade-offs examples**:
|
|
449
|
+
- JWT vs Session
|
|
450
|
+
- PostgreSQL vs MongoDB
|
|
451
|
+
- SQLAlchemy ORM vs native SQL
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### Scenario 3: Design Database System
|
|
456
|
+
**Core focus**:
|
|
457
|
+
- Schema design (normalization vs denormalization)
|
|
458
|
+
- Index strategy (B-tree vs Hash)
|
|
459
|
+
- Transaction isolation level
|
|
460
|
+
- Backup recovery strategy
|
|
461
|
+
|
|
462
|
+
**Research topics**:
|
|
463
|
+
- "PostgreSQL database design best practices"
|
|
464
|
+
- "Database index optimization strategies"
|
|
465
|
+
- "PostgreSQL performance tuning"
|
|
466
|
+
|
|
467
|
+
**Trade-offs examples**:
|
|
468
|
+
- Normalization (3NF) vs performance optimization (denormalization)
|
|
469
|
+
- ACID vs eventual consistency
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
### Scenario 4: Design Multi-Agent System
|
|
474
|
+
**Core focus**:
|
|
475
|
+
- Agent collaboration patterns (Supervisor, Workflow)
|
|
476
|
+
- Message passing format
|
|
477
|
+
- Tool call design
|
|
478
|
+
- Error handling and retry
|
|
479
|
+
|
|
480
|
+
**Research topics**:
|
|
481
|
+
- "LangGraph multi-agent design patterns"
|
|
482
|
+
- "LLM tool call best practices"
|
|
483
|
+
- "Agent error handling strategies"
|
|
484
|
+
|
|
485
|
+
**Trade-offs examples**:
|
|
486
|
+
- Supervisor pattern vs Workflow pattern
|
|
487
|
+
- Function Calling vs text parsing
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## Quick Start Example
|
|
492
|
+
|
|
493
|
+
**Task**: Design backend API system documentation
|
|
494
|
+
|
|
495
|
+
**Step 1: Discover**
|
|
496
|
+
```
|
|
497
|
+
System: backend-api-system
|
|
498
|
+
Responsibility: Handle frontend API requests, business logic, database interaction
|
|
499
|
+
Boundaries: Input HTTP request → Output JSON response
|
|
500
|
+
Related requirements: [REQ-001] User login, [REQ-002] Dashboard data
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Step 2: Deep-Dive**
|
|
504
|
+
```
|
|
505
|
+
/explore "FastAPI backend system best architecture design 2025"
|
|
506
|
+
Output: _research/backend-api-system-research.md
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
**Step 3-5: Decompose + Design + Defend**
|
|
510
|
+
```
|
|
511
|
+
Use `sequential-thinking` to organize 3-7 thoughts:
|
|
512
|
+
1. Adopt layered architecture (Presentation → Business → Data)
|
|
513
|
+
2. Core components: AuthService, UserService, DatabaseManager
|
|
514
|
+
3. API design: POST /auth/login, GET /users/me
|
|
515
|
+
4. Data model: User(id, email, passwordHash)
|
|
516
|
+
5. Tech stack: FastAPI + SQLAlchemy + PostgreSQL
|
|
517
|
+
6. Trade-off: Why use JWT not Session?
|
|
518
|
+
7. Performance: Redis cache user info, TTL 5 minutes
|
|
519
|
+
8. Security: bcrypt password hash, Rate limiting
|
|
520
|
+
...
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
**Step 6: Document**
|
|
524
|
+
```
|
|
525
|
+
Use template to fill 14 chapters → save to:
|
|
526
|
+
.anws/v{N}/04_SYSTEM_DESIGN/backend-api-system.md
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
**Remember**: Good design stands on the shoulders of giants.
|
|
532
|
+
Research industry best practices, think deeply about trade-offs, document clearly.
|
|
533
|
+
|
|
534
|
+
Happy Designing!
|