@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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +2 -2
  3. package/lib/manifest.js +4 -16
  4. package/package.json +1 -1
  5. package/templates/.agents/skills/anws-system/SKILL.md +5 -3
  6. package/templates/.agents/skills/code-reviewer/SKILL.md +6 -5
  7. package/templates/.agents/skills/concept-modeler/SKILL.md +6 -6
  8. package/templates/.agents/skills/craft-authoring/SKILL.md +1 -1
  9. package/templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +13 -32
  10. package/templates/.agents/skills/design-reviewer/SKILL.md +11 -11
  11. package/templates/.agents/skills/e2e-testing-guide/SKILL.md +3 -3
  12. package/templates/.agents/skills/nexus-mapper/SKILL.md +2 -2
  13. package/templates/.agents/skills/nexus-mapper/references/probe-protocol.md +1 -1
  14. package/templates/.agents/skills/nexus-query/SKILL.md +1 -1
  15. package/templates/.agents/skills/runtime-inspector/SKILL.md +150 -99
  16. package/templates/.agents/skills/spec-writer/SKILL.md +3 -3
  17. package/templates/.agents/skills/system-architect/SKILL.md +5 -5
  18. package/templates/.agents/skills/system-designer/SKILL.md +188 -601
  19. package/templates/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +2 -2
  20. package/templates/.agents/skills/task-reviewer/SKILL.md +8 -13
  21. package/templates/.agents/skills/tech-evaluator/SKILL.md +19 -19
  22. package/templates/.agents/workflows/blueprint.md +5 -5
  23. package/templates/.agents/workflows/challenge.md +12 -18
  24. package/templates/.agents/workflows/change.md +8 -8
  25. package/templates/.agents/workflows/craft.md +9 -9
  26. package/templates/.agents/workflows/design-system.md +6 -6
  27. package/templates/.agents/workflows/explore.md +4 -4
  28. package/templates/.agents/workflows/forge.md +9 -9
  29. package/templates/.agents/workflows/genesis.md +9 -10
  30. package/templates/.agents/workflows/probe.md +6 -9
  31. package/templates/.agents/workflows/quickstart.md +9 -7
  32. package/templates/.agents/workflows/upgrade.md +9 -9
  33. package/templates_en/.agents/skills/anws-system/SKILL.md +5 -3
  34. package/templates_en/.agents/skills/code-reviewer/SKILL.md +6 -5
  35. package/templates_en/.agents/skills/concept-modeler/SKILL.md +6 -6
  36. package/templates_en/.agents/skills/craft-authoring/SKILL.md +1 -1
  37. package/templates_en/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +12 -30
  38. package/templates_en/.agents/skills/design-reviewer/SKILL.md +9 -10
  39. package/templates_en/.agents/skills/e2e-testing-guide/SKILL.md +3 -3
  40. package/templates_en/.agents/skills/nexus-mapper/SKILL.md +2 -2
  41. package/templates_en/.agents/skills/nexus-mapper/references/probe-protocol.md +1 -1
  42. package/templates_en/.agents/skills/nexus-query/SKILL.md +1 -1
  43. package/templates_en/.agents/skills/runtime-inspector/SKILL.md +150 -101
  44. package/templates_en/.agents/skills/spec-writer/SKILL.md +3 -3
  45. package/templates_en/.agents/skills/system-architect/SKILL.md +5 -5
  46. package/templates_en/.agents/skills/system-designer/SKILL.md +188 -534
  47. package/templates_en/.agents/skills/task-reviewer/SKILL.md +4 -10
  48. package/templates_en/.agents/skills/tech-evaluator/SKILL.md +6 -6
  49. package/templates_en/.agents/workflows/blueprint.md +5 -5
  50. package/templates_en/.agents/workflows/challenge.md +7 -12
  51. package/templates_en/.agents/workflows/change.md +7 -7
  52. package/templates_en/.agents/workflows/craft.md +9 -9
  53. package/templates_en/.agents/workflows/design-system.md +6 -6
  54. package/templates_en/.agents/workflows/explore.md +4 -4
  55. package/templates_en/.agents/workflows/forge.md +9 -9
  56. package/templates_en/.agents/workflows/genesis.md +9 -10
  57. package/templates_en/.agents/workflows/probe.md +3 -7
  58. package/templates_en/.agents/workflows/quickstart.md +7 -5
  59. package/templates_en/.agents/workflows/upgrade.md +8 -8
  60. package/templates/.agents/skills/report-template/SKILL.md +0 -92
  61. package/templates/.agents/skills/report-template/references/REPORT_TEMPLATE.md +0 -100
  62. package/templates_en/.agents/skills/report-template/SKILL.md +0 -85
  63. package/templates_en/.agents/skills/report-template/references/REPORT_TEMPLATE.md +0 -100
@@ -1,534 +1,188 @@
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!
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>