@haaaiawd/anws 2.4.0 → 2.4.1
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 +2 -2
- package/lib/manifest.js +4 -16
- package/package.json +1 -1
- package/templates/.agents/skills/anws-system/SKILL.md +5 -3
- package/templates/.agents/skills/code-reviewer/SKILL.md +6 -5
- package/templates/.agents/skills/concept-modeler/SKILL.md +6 -6
- package/templates/.agents/skills/craft-authoring/SKILL.md +1 -1
- package/templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +13 -32
- package/templates/.agents/skills/design-reviewer/SKILL.md +11 -11
- package/templates/.agents/skills/e2e-testing-guide/SKILL.md +3 -3
- package/templates/.agents/skills/nexus-mapper/SKILL.md +2 -2
- package/templates/.agents/skills/nexus-mapper/references/probe-protocol.md +1 -1
- package/templates/.agents/skills/nexus-query/SKILL.md +1 -1
- package/templates/.agents/skills/runtime-inspector/SKILL.md +150 -99
- package/templates/.agents/skills/spec-writer/SKILL.md +3 -3
- package/templates/.agents/skills/system-architect/SKILL.md +5 -5
- package/templates/.agents/skills/system-designer/SKILL.md +188 -601
- package/templates/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +2 -2
- package/templates/.agents/skills/task-reviewer/SKILL.md +8 -13
- package/templates/.agents/skills/tech-evaluator/SKILL.md +19 -19
- package/templates/.agents/workflows/blueprint.md +5 -5
- package/templates/.agents/workflows/challenge.md +12 -18
- package/templates/.agents/workflows/change.md +8 -8
- package/templates/.agents/workflows/craft.md +9 -9
- package/templates/.agents/workflows/design-system.md +6 -6
- package/templates/.agents/workflows/explore.md +4 -4
- package/templates/.agents/workflows/forge.md +9 -9
- package/templates/.agents/workflows/genesis.md +9 -10
- package/templates/.agents/workflows/probe.md +6 -9
- package/templates/.agents/workflows/quickstart.md +9 -7
- package/templates/.agents/workflows/upgrade.md +9 -9
- package/templates_en/.agents/skills/anws-system/SKILL.md +5 -3
- package/templates_en/.agents/skills/code-reviewer/SKILL.md +6 -5
- package/templates_en/.agents/skills/concept-modeler/SKILL.md +6 -6
- package/templates_en/.agents/skills/craft-authoring/SKILL.md +1 -1
- package/templates_en/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +12 -30
- package/templates_en/.agents/skills/design-reviewer/SKILL.md +9 -10
- package/templates_en/.agents/skills/e2e-testing-guide/SKILL.md +3 -3
- package/templates_en/.agents/skills/nexus-mapper/SKILL.md +2 -2
- package/templates_en/.agents/skills/nexus-mapper/references/probe-protocol.md +1 -1
- package/templates_en/.agents/skills/nexus-query/SKILL.md +1 -1
- package/templates_en/.agents/skills/runtime-inspector/SKILL.md +150 -101
- package/templates_en/.agents/skills/spec-writer/SKILL.md +3 -3
- package/templates_en/.agents/skills/system-architect/SKILL.md +5 -5
- package/templates_en/.agents/skills/system-designer/SKILL.md +188 -534
- package/templates_en/.agents/skills/task-reviewer/SKILL.md +4 -10
- package/templates_en/.agents/skills/tech-evaluator/SKILL.md +6 -6
- package/templates_en/.agents/workflows/blueprint.md +5 -5
- package/templates_en/.agents/workflows/challenge.md +7 -12
- package/templates_en/.agents/workflows/change.md +7 -7
- package/templates_en/.agents/workflows/craft.md +9 -9
- package/templates_en/.agents/workflows/design-system.md +6 -6
- package/templates_en/.agents/workflows/explore.md +4 -4
- package/templates_en/.agents/workflows/forge.md +9 -9
- package/templates_en/.agents/workflows/genesis.md +9 -10
- package/templates_en/.agents/workflows/probe.md +3 -7
- package/templates_en/.agents/workflows/quickstart.md +7 -5
- package/templates_en/.agents/workflows/upgrade.md +8 -8
- package/templates/.agents/skills/report-template/SKILL.md +0 -92
- package/templates/.agents/skills/report-template/references/REPORT_TEMPLATE.md +0 -100
- package/templates_en/.agents/skills/report-template/SKILL.md +0 -85
- package/templates_en/.agents/skills/report-template/references/REPORT_TEMPLATE.md +0 -100
|
@@ -1,534 +1,188 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: system-designer
|
|
3
|
-
description:
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# System Designer
|
|
7
|
-
|
|
8
|
-
>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
>
|
|
23
|
-
>
|
|
24
|
-
|
|
25
|
-
**
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
###
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
###
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
###
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
###
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
**
|
|
164
|
-
|
|
165
|
-
**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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!
|
|
1
|
+
---
|
|
2
|
+
name: system-designer
|
|
3
|
+
description: Load when `/design-system <system-id>` needs to produce L0/L1 detailed design documents for one system. Defines boundaries, interface contracts, data models, trade-offs, Mermaid diagrams, testing strategy, and L1 split rules; paired with the same-bundle `/design-system` workflow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# System Designer (ALPHA)
|
|
7
|
+
|
|
8
|
+
<phase_context>
|
|
9
|
+
You are **SYSTEM DESIGNER**.
|
|
10
|
+
|
|
11
|
+
**Mission**: refine one `system-id` from `02_ARCHITECTURE_OVERVIEW.md` into an implementable, reviewable system design that `/blueprint` can consume.
|
|
12
|
+
**Capabilities**: inherit PRD/ADR/Architecture constraints; consume `/explore` research; use the 6D framework to derive components, interfaces, data models, risks, and testing strategy; persist L0 and conditional L1 documents.
|
|
13
|
+
**Limits**: do not change PRD, ADR, or system-boundary premises; do not put long pseudocode, config dictionaries, or method bodies into L0; do not copy ADR content, only reference ADRs.
|
|
14
|
+
**Output Goal**: `{TARGET_DIR}/04_SYSTEM_DESIGN/{system-id}.md`, plus `{system-id}.detail.md` and `_research/{system-id}-research.md` when triggered.
|
|
15
|
+
</phase_context>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## CRITICAL Writing And Output Contract
|
|
20
|
+
|
|
21
|
+
> [!IMPORTANT]
|
|
22
|
+
> Persisted-report rules, evidence rules, single-writer rules, and de-duplication rules follow `.agents/skills/output-contract/SKILL.md`. This skill only adds system-design-specific constraints.
|
|
23
|
+
>
|
|
24
|
+
> - **Inherit constraints**: performance, security, interface, tech-stack, and boundary constraints from PRD, ADR, and Architecture Overview may only be tightened, not weakened.
|
|
25
|
+
> - **ADR one-way references**: cross-system decisions reference `03_ADR/*`; do not duplicate ADR rationale. If an ADR is insufficient, route through `/change` or `/genesis`.
|
|
26
|
+
> - **Lightweight L0**: L0 contains architecture, contracts, field declarations, key diagrams, and trade-offs; long algorithms, large config, pseudocode, and implementation edge cases go to L1.
|
|
27
|
+
> - **Traceability**: interfaces, data models, testing strategy, and trade-offs must point to at least one `[REQ-*]`, ADR, or Architecture section.
|
|
28
|
+
> - **No empty placeholders**: unknowns use `[OPEN: concrete question + owner/next step]`; do not use `TBD`, `TODO`, or vague "improve later" text.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Design Framework: 6D
|
|
33
|
+
|
|
34
|
+
### 1. Discover
|
|
35
|
+
|
|
36
|
+
### What
|
|
37
|
+
Read `01_PRD.md`, `02_ARCHITECTURE_OVERVIEW.md`, relevant `03_ADR/*`, and any existing design draft for this system. Extract responsibility, boundaries, dependencies, linked `[REQ-*]`, and non-goals.
|
|
38
|
+
|
|
39
|
+
### Why
|
|
40
|
+
Detailed design is not a second architecture pass; it refines approved boundaries into implementable contracts.
|
|
41
|
+
|
|
42
|
+
### Acceptance
|
|
43
|
+
- One sentence can state this system's responsibility.
|
|
44
|
+
- Inputs, outputs, dependencies, linked requirements, and relevant ADRs are listed.
|
|
45
|
+
|
|
46
|
+
### 2. Deep-Dive
|
|
47
|
+
|
|
48
|
+
### What
|
|
49
|
+
Use the same-bundle `/explore` workflow to produce `_research/{system-id}-research.md`; research only the risks that affect this system.
|
|
50
|
+
|
|
51
|
+
### Why
|
|
52
|
+
Complex design needs external evidence; otherwise trade-offs become preferences.
|
|
53
|
+
|
|
54
|
+
### Acceptance
|
|
55
|
+
- Research supports at least one design decision or risk mitigation.
|
|
56
|
+
- The `_research` path exists, or `/design-system` gives a concrete non-applicability reason.
|
|
57
|
+
|
|
58
|
+
### 3. Decompose
|
|
59
|
+
|
|
60
|
+
### What
|
|
61
|
+
Derive components, modules, data flow, state flow, and external interfaces. Use `sequential-thinking` when the host rules require it.
|
|
62
|
+
|
|
63
|
+
### Why
|
|
64
|
+
Component boundaries determine testability, dependency direction, and downstream task quality.
|
|
65
|
+
|
|
66
|
+
### Acceptance
|
|
67
|
+
- Each core component has responsibility and dependencies.
|
|
68
|
+
- Mermaid architecture or data-flow diagrams match the component inventory.
|
|
69
|
+
|
|
70
|
+
### 4. Design
|
|
71
|
+
|
|
72
|
+
### What
|
|
73
|
+
Define interface contracts, data models, error semantics, configuration boundaries, state transitions, and security/performance strategy. Prefer operation contract tables for interfaces; data models include fields and relations, not method bodies.
|
|
74
|
+
|
|
75
|
+
### Why
|
|
76
|
+
`/blueprint` needs externally observable contracts, not implementation prose.
|
|
77
|
+
|
|
78
|
+
### Acceptance
|
|
79
|
+
- Core operations have contract tables or equivalent interface tables.
|
|
80
|
+
- Data fields, error semantics, and verification responsibility are traceable.
|
|
81
|
+
|
|
82
|
+
### 5. Defend
|
|
83
|
+
|
|
84
|
+
### What
|
|
85
|
+
List key trade-offs, performance bottlenecks, security boundaries, observability, and testing strategy. Public contracts require a Contract Verification Matrix.
|
|
86
|
+
|
|
87
|
+
### Why
|
|
88
|
+
The design document should expose failure modes before `/forge` has to guess them.
|
|
89
|
+
|
|
90
|
+
### Acceptance
|
|
91
|
+
- At least two important decisions explain why option A was chosen over option B.
|
|
92
|
+
- Testing strategy distinguishes unit, API/interface, integration, E2E, smoke, and regression responsibility where applicable.
|
|
93
|
+
|
|
94
|
+
### 6. Document
|
|
95
|
+
|
|
96
|
+
### What
|
|
97
|
+
Read `.agents/skills/system-designer/references/system-design-template.md` and, when needed, `system-design-detail-template.md`; persist L0/L1.
|
|
98
|
+
|
|
99
|
+
### Why
|
|
100
|
+
The template is the long-term maintenance contract used by the host and downstream workflows.
|
|
101
|
+
|
|
102
|
+
### Acceptance
|
|
103
|
+
- L0 required sections 1-11 are present; optional sections 12-14 are kept or marked `N/A` with a reason.
|
|
104
|
+
- If L1 is triggered, L0 links to `.detail.md`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## L0 / L1 Boundaries
|
|
109
|
+
|
|
110
|
+
| Layer | File | Content | Load Frequency |
|
|
111
|
+
| --- | --- | --- | --- |
|
|
112
|
+
| L0 navigation | `{system-id}.md` | goals, boundaries, diagrams, operation contracts, field declarations, trade-offs, testing strategy | high; always loaded for task planning |
|
|
113
|
+
| L1 implementation | `{system-id}.detail.md` | long pseudocode, config constants, complex algorithms, implementation edge cases, detailed state tables | low; only when task input explicitly references it |
|
|
114
|
+
|
|
115
|
+
### L1 Split Rules R1-R5
|
|
116
|
+
|
|
117
|
+
Create `{system-id}.detail.md` if any rule is triggered:
|
|
118
|
+
|
|
119
|
+
| Rule | Trigger | Action |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| R1 | one continuous code block > 30 lines | move to L1 |
|
|
122
|
+
| R2 | total code block lines > 200 | move to L1 |
|
|
123
|
+
| R3 | config constant dictionary entries > 5 | move to L1 or a config table |
|
|
124
|
+
| R4 | inline version comments > 5 | consolidate into version history |
|
|
125
|
+
| R5 | L0 total length > 500 lines | split into L1 |
|
|
126
|
+
|
|
127
|
+
### Content Placement
|
|
128
|
+
|
|
129
|
+
| Content Type | L0 | L1 |
|
|
130
|
+
| --- | --- | --- |
|
|
131
|
+
| system goal, boundary, architecture diagrams, trade-offs | yes | no |
|
|
132
|
+
| operation contracts, HTTP/CLI/cross-system protocols | yes | details only |
|
|
133
|
+
| data fields, Protocol/ABC signatures | yes | complex schema examples |
|
|
134
|
+
| function-body pseudocode and complex algorithms | no | yes |
|
|
135
|
+
| config constants and edge-case expansion | summary | yes |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Template And Sections
|
|
140
|
+
|
|
141
|
+
Use `.agents/skills/system-designer/references/system-design-template.md`.
|
|
142
|
+
|
|
143
|
+
**Required L0 sections 1-11**:
|
|
144
|
+
|
|
145
|
+
1. Overview
|
|
146
|
+
2. Goals & Non-Goals
|
|
147
|
+
3. Background & Context
|
|
148
|
+
4. Architecture
|
|
149
|
+
5. Interface Design
|
|
150
|
+
6. Data Model
|
|
151
|
+
7. Technology Stack
|
|
152
|
+
8. Trade-offs & Alternatives
|
|
153
|
+
9. Security Considerations
|
|
154
|
+
10. Performance Considerations
|
|
155
|
+
11. Testing Strategy
|
|
156
|
+
|
|
157
|
+
**Optional sections 12-14**: Deployment & Operations, Future Considerations, Appendix. Optional does not mean arbitrary deletion; use `N/A + reason` when not applicable.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Design Rules
|
|
162
|
+
|
|
163
|
+
- **Research first**: obtain research evidence before design, or record why research is not applicable.
|
|
164
|
+
- **Mermaid first**: architecture, data flow, state machines, and decision trees prefer Mermaid; long pseudocode goes to L1.
|
|
165
|
+
- **Operation contracts first**: Agent, game-core, messaging, CLI/API, and other public behaviors use operation contract tables.
|
|
166
|
+
- **Do not weaken constraints**: inherit PRD/ADR performance, security, compliance, tech-stack, and error semantics.
|
|
167
|
+
- **Trade-offs are reviewable**: important decisions require alternatives and consequences.
|
|
168
|
+
- **Public contracts are verifiable**: public interfaces, config, error semantics, and persistence structures need testing responsibility.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Handoff Checklist
|
|
173
|
+
|
|
174
|
+
- [ ] `01`, `02`, relevant `03_ADR/*`, `_research`, and templates have been read.
|
|
175
|
+
- [ ] L0 exists and required sections 1-11 are complete.
|
|
176
|
+
- [ ] L1 trigger rules were evaluated; if triggered, `.detail.md` exists and L0 links to it.
|
|
177
|
+
- [ ] Interface contracts, data model, ADR references, and testing strategy do not contradict each other.
|
|
178
|
+
- [ ] No legacy `.agent/` paths, emoji, or empty `TODO/TBD` placeholders remain.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
<completion_criteria>
|
|
183
|
+
- `system_id` and `TARGET_DIR` were confirmed by the `/design-system` host.
|
|
184
|
+
- Output follows `.agents/skills/output-contract/SKILL.md` for persistence and collaboration closure.
|
|
185
|
+
- L0/L1 boundaries, R1-R5, required sections 1-11, and optional sections 12-14 are unambiguous.
|
|
186
|
+
- Every public contract has a source anchor and verification responsibility.
|
|
187
|
+
- This skill serves `/design-system` only and does not modify PRD, ADR, Architecture, or 05A/05B.
|
|
188
|
+
</completion_criteria>
|