architext 0.0.3 → 0.0.5

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 (118) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/README.md +94 -12
  3. package/README.zh-CN.md +94 -12
  4. package/dist/index.js +43 -39
  5. package/dist/templates/en/briefs/_base.md +44 -11
  6. package/dist/templates/en/briefs/_modules.md +31 -4
  7. package/dist/templates/en/docs/global/api_snapshot.json +24 -0
  8. package/dist/templates/en/docs/global/command_api.json +26 -0
  9. package/dist/templates/en/docs/global/env_registry.json +12 -0
  10. package/dist/templates/en/docs/global/map.json +5 -0
  11. package/dist/templates/en/docs/global/public_api.json +12 -0
  12. package/dist/templates/en/docs/prompts/audit.md +80 -94
  13. package/dist/templates/en/docs/prompts/code.md +100 -109
  14. package/dist/templates/en/docs/prompts/edit.md +52 -47
  15. package/dist/templates/en/docs/prompts/fix.md +49 -42
  16. package/dist/templates/en/docs/prompts/help.md +23 -31
  17. package/dist/templates/en/docs/prompts/inherit.md +110 -116
  18. package/dist/templates/en/docs/prompts/map.md +47 -69
  19. package/dist/templates/en/docs/prompts/plan.md +160 -171
  20. package/dist/templates/en/docs/prompts/recover.md +48 -0
  21. package/dist/templates/en/docs/prompts/ref.md +163 -0
  22. package/dist/templates/en/docs/prompts/remove.md +55 -107
  23. package/dist/templates/en/docs/prompts/revise.md +63 -106
  24. package/dist/templates/en/docs/prompts/scope.md +77 -117
  25. package/dist/templates/en/docs/prompts/start.md +93 -139
  26. package/dist/templates/en/docs/shared/verify-result-handling.md +6 -0
  27. package/dist/templates/en/docs/templates/design.template.md +77 -0
  28. package/dist/templates/en/docs/templates/spec.template.md +60 -25
  29. package/dist/templates/en/rules/00_system.md +36 -79
  30. package/dist/templates/en/rules/01_workflow.md +59 -57
  31. package/dist/templates/en/rules/03_data_governance.md +46 -42
  32. package/dist/templates/en/skills/archi-data-sync/SKILL.md +83 -0
  33. package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +166 -151
  34. package/dist/templates/en/skills/archi-design-patterns/SKILL.md +140 -0
  35. package/dist/templates/en/skills/archi-feature-relations/SKILL.md +118 -0
  36. package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +2 -1
  37. package/dist/templates/en/skills/archi-plan-options/SKILL.md +4 -3
  38. package/dist/templates/en/skills/archi-silent-audit/SKILL.md +118 -0
  39. package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +315 -270
  40. package/dist/templates/zh/briefs/_base.md +46 -14
  41. package/dist/templates/zh/briefs/_modules.md +29 -2
  42. package/dist/templates/zh/docs/global/api_snapshot.json +24 -0
  43. package/dist/templates/zh/docs/global/command_api.json +26 -0
  44. package/dist/templates/zh/docs/global/data_snapshot.json +0 -1
  45. package/dist/templates/zh/docs/global/design_tokens.json +0 -1
  46. package/dist/templates/zh/docs/global/dictionary.json +1 -1
  47. package/dist/templates/zh/docs/global/env_registry.json +12 -0
  48. package/dist/templates/zh/docs/global/error_codes.json +0 -8
  49. package/dist/templates/zh/docs/global/map.json +28 -3
  50. package/dist/templates/zh/docs/global/public_api.json +12 -0
  51. package/dist/templates/zh/docs/global/vision.md +1 -1
  52. package/dist/templates/zh/docs/prompts/audit.md +43 -57
  53. package/dist/templates/zh/docs/prompts/code.md +68 -77
  54. package/dist/templates/zh/docs/prompts/edit.md +44 -39
  55. package/dist/templates/zh/docs/prompts/fix.md +33 -26
  56. package/dist/templates/zh/docs/prompts/help.md +13 -21
  57. package/dist/templates/zh/docs/prompts/inherit.md +81 -87
  58. package/dist/templates/zh/docs/prompts/map.md +23 -45
  59. package/dist/templates/zh/docs/prompts/plan.md +134 -146
  60. package/dist/templates/zh/docs/prompts/recover.md +48 -0
  61. package/dist/templates/zh/docs/prompts/ref.md +163 -0
  62. package/dist/templates/zh/docs/prompts/remove.md +31 -83
  63. package/dist/templates/zh/docs/prompts/revise.md +43 -84
  64. package/dist/templates/zh/docs/prompts/scope.md +53 -93
  65. package/dist/templates/zh/docs/prompts/start.md +75 -121
  66. package/dist/templates/zh/docs/shared/verify-result-handling.md +6 -0
  67. package/dist/templates/zh/docs/templates/design.template.md +77 -0
  68. package/dist/templates/zh/docs/templates/spec.template.md +60 -25
  69. package/dist/templates/zh/rules/00_system.md +37 -80
  70. package/dist/templates/zh/rules/01_workflow.md +60 -58
  71. package/dist/templates/zh/rules/02_tech_stack.md +7 -6
  72. package/dist/templates/zh/rules/03_data_governance.md +43 -39
  73. package/dist/templates/zh/rules/99_context_glue.md +2 -2
  74. package/dist/templates/zh/skills/archi-data-sync/SKILL.md +83 -0
  75. package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +70 -56
  76. package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +140 -0
  77. package/dist/templates/zh/skills/archi-feature-relations/SKILL.md +118 -0
  78. package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -1
  79. package/dist/templates/zh/skills/archi-plan-options/SKILL.md +26 -25
  80. package/dist/templates/zh/skills/archi-silent-audit/SKILL.md +118 -0
  81. package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +317 -269
  82. package/package.json +1 -1
  83. package/dist/templates/zh-Hant/briefs/_base.md +0 -115
  84. package/dist/templates/zh-Hant/briefs/_modules.md +0 -173
  85. package/dist/templates/zh-Hant/docs/global/data_snapshot.json +0 -31
  86. package/dist/templates/zh-Hant/docs/global/design_tokens.json +0 -135
  87. package/dist/templates/zh-Hant/docs/global/dictionary.json +0 -35
  88. package/dist/templates/zh-Hant/docs/global/error_codes.json +0 -19
  89. package/dist/templates/zh-Hant/docs/global/map.json +0 -94
  90. package/dist/templates/zh-Hant/docs/global/roadmap.json +0 -39
  91. package/dist/templates/zh-Hant/docs/global/vision.md +0 -82
  92. package/dist/templates/zh-Hant/docs/prompts/audit.md +0 -150
  93. package/dist/templates/zh-Hant/docs/prompts/code.md +0 -160
  94. package/dist/templates/zh-Hant/docs/prompts/edit.md +0 -87
  95. package/dist/templates/zh-Hant/docs/prompts/fix.md +0 -86
  96. package/dist/templates/zh-Hant/docs/prompts/help.md +0 -69
  97. package/dist/templates/zh-Hant/docs/prompts/inherit.md +0 -270
  98. package/dist/templates/zh-Hant/docs/prompts/map.md +0 -131
  99. package/dist/templates/zh-Hant/docs/prompts/plan.md +0 -252
  100. package/dist/templates/zh-Hant/docs/prompts/remove.md +0 -162
  101. package/dist/templates/zh-Hant/docs/prompts/revise.md +0 -160
  102. package/dist/templates/zh-Hant/docs/prompts/scope.md +0 -198
  103. package/dist/templates/zh-Hant/docs/prompts/start.md +0 -258
  104. package/dist/templates/zh-Hant/docs/templates/plan.template.json +0 -88
  105. package/dist/templates/zh-Hant/docs/templates/scope-brief.template.md +0 -58
  106. package/dist/templates/zh-Hant/docs/templates/spec.template.md +0 -51
  107. package/dist/templates/zh-Hant/docs/templates/ui.template.md +0 -51
  108. package/dist/templates/zh-Hant/rules/00_system.md +0 -123
  109. package/dist/templates/zh-Hant/rules/01_workflow.md +0 -93
  110. package/dist/templates/zh-Hant/rules/02_tech_stack.md +0 -192
  111. package/dist/templates/zh-Hant/rules/03_data_governance.md +0 -102
  112. package/dist/templates/zh-Hant/rules/04_cli_tools.md +0 -50
  113. package/dist/templates/zh-Hant/rules/90_custom_rules.md +0 -21
  114. package/dist/templates/zh-Hant/rules/99_context_glue.md +0 -53
  115. package/dist/templates/zh-Hant/skills/archi-decompose-roadmap/SKILL.md +0 -293
  116. package/dist/templates/zh-Hant/skills/archi-interview-protocol/SKILL.md +0 -86
  117. package/dist/templates/zh-Hant/skills/archi-plan-options/SKILL.md +0 -364
  118. package/dist/templates/zh-Hant/skills/archi-ui-wireframe/SKILL.md +0 -337
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: archi-decompose-roadmap
3
- description: Architext task decomposition expert. Five-step method: first calibrate project type to anchor the infrastructure checklist, then apply dual-perspective extraction for business Tasks and Infra tasks. NFR cross-cutting concerns are merged into goal fields (never standalone tasks). Produces Tier 1 Schema-compliant roadmap.json tasks as input contracts for `/archi.plan`. Use whenever Roadmap tasks need to be generated or appended.
3
+ type: subagent
4
+ description: Architext task decomposition expert. Five-step method: calibrate project type for infrastructure checklist, extract business Tasks and Infra tasks via dual perspective, identify Polish tasks, route NFR cross-cutting concerns by weight (inject vs. standalone), build dependency chain and output parallel batches. Task type encoded by ID prefix (INF/FEAT/POLISH/EDIT); tag field carries business domain labels. Produces Tier 1 Schema-compliant roadmap.json tasks as input contracts for `/archi.plan`.
4
5
  ---
5
6
 
6
7
  # Roadmap Task Decomposition
@@ -9,30 +10,30 @@ description: Architext task decomposition expert. Five-step method: first calibr
9
10
 
10
11
  ```
11
12
  Brief → [This Skill] → roadmap.json tasks
12
-
13
- /archi.plan <task-id>
14
- reads: vision.md + map.json + tech_stack.md
15
- writes: spec.md (behavior spec / acceptance criteria)
16
- ui.md (component structure, AI coding truth source) [?UI]
13
+
14
+ /archi.plan <task-id>
15
+ reads: vision.md + map.json + tech_stack.md
16
+ writes: spec.md (behavior spec / acceptance criteria)
17
+ ui.md (task UI scope) [?UI]
18
+ plan.json (executable steps + test checkboxes)
19
+ also updates: map.json / dictionary.json / data_snapshot.json
17
20
  visual ref: [[__DOCS_DIR__]]/global/ui_context.md [?UI]
18
- plan.json (executable steps + test case checkboxes)
19
- also updates: map.json / dictionary.json / data_snapshot.json
20
-
21
- /archi.code → reads spec.md + ui.md + plan.json → writes code
21
+
22
+ /archi.code reads spec.md + ui.md + plan.json → writes code
22
23
  ```
23
24
 
24
25
  > **Skill responsibility boundary**:
25
26
  > - Owns: task what (description), done criteria (goal), dependency chain, design decision injection, Core interface contracts
26
- > - Does NOT own: file paths (map.json owns), variable naming (dictionary.json owns), test cases (plan.json owns), UI component structure (ui.md owns)
27
+ > - Does NOT own: file paths (map.json), variable naming (dictionary.json), test cases (plan.json), UI component structure (ui.md)
27
28
  >
28
- > **Schema constraint (Tier 1 Strict)**: roadmap.json is validated by CLI Zod Schema. **Adding or removing fields is forbidden.**
29
+ > **Schema constraint (Tier 1 Strict)**: roadmap.json validated by CLI Zod Schema. **Adding or removing fields is forbidden.**
29
30
 
30
- ## Invocation Mode
31
+ ## Invocation Modes
31
32
 
32
33
  | Mode | Triggered By | Input | Constraint |
33
34
  |:---|:---|:---|:---|
34
35
  | From Scratch | `/archi.start` | Brief task list | No EDIT tasks allowed |
35
- | Incremental | `/archi.scope` | Brief + existing Roadmap context | Never modify existing tasks, continue ID watermark |
36
+ | Incremental | `/archi.scope` | Brief + existing Roadmap context | Never modify existing tasks; continue ID watermark |
36
37
 
37
38
  ---
38
39
 
@@ -40,7 +41,7 @@ Brief → [This Skill] → roadmap.json tasks
40
41
 
41
42
  ### Step 0 · Project Type Calibration
42
43
 
43
- Identify the project type from the Brief's tech stack / description. Establish a standard infrastructure checklist to prevent Step 2 from missing framework-level Infra.
44
+ Identify project type from Brief's tech stack / description. Establish standard infrastructure checklist to prevent Step 2 from missing framework-level Infra.
44
45
 
45
46
  | Project Type | Scaffold Must Include (beyond common build toolchain) |
46
47
  |:---|:---|
@@ -48,245 +49,259 @@ Identify the project type from the Brief's tech stack / description. Establish a
48
49
  | Full-Stack Web (SSR/SSG) | Routing conventions (loader/action/pages) + API Routes layer + global layout + Auth session management (Cookie/JWT); [?UI] theme injection |
49
50
  | CLI Tool | Logger module + AppError handling layer + command registration entry |
50
51
  | API Service (REST / GraphQL) | Router layer + middleware layer + DB connection layer + global error handling; [?GraphQL] Schema definition layer + DataLoader |
51
- | Mobile App (Native / Cross-platform) | Navigation skeleton (React Navigation / Go Router) + platform adapter layer (iOS/Android permissions, native modules) + environment config (dev/staging/prod) |
52
- | Mini Program | Page routing config + global app.js/ts + request wrapper layer |
53
- | Browser Extension | manifest.json (V2/V3) + Background Service Worker + Content Script injection layer + message bus (background ↔ content ↔ popup) + Popup/Options page entry |
54
- | Desktop App (Standalone) | Main process entry (Electron main / Tauri main.rs) + IPC bridge + system-level capabilities (tray, hotkeys) + native file system wrapper |
55
- | Web + Desktop (Hybrid) | Web scaffold base + desktop runtime integration (Tauri/Electron) + system-level capabilities (system tray, global hotkeys, system notifications); **desktop integration must be split into a separate INF task** (OS differences are significant; tech stack is entirely different from Web — the Step 2 "same execution window = merge" rule does not apply) |
56
- | Library / SDK / NPM Package | Dual output config (CJS + ESM) + public API entry (barrel index.ts) + type declaration generation (.d.ts) + changelog / versioning toolchain; **no business Tasks INF layer only** |
57
- | Real-time / Collaborative App | WebSocket server layer + event schema definitions (shared types) + room/session management foundation; [?CRDT] conflict resolution layer |
58
- | AI Agent / MCP Tool | LLM client abstraction layer (provider-agnostic) + prompt template management + Tool/Function Calling schema + conversation state / memory management; [?MCP] MCP protocol adapter |
59
-
60
- **Action (two outputs)**:
61
- 1. **Inject into Step 2 INF-01**: Write the corresponding type's scaffold checklist into the INF-01 description.
62
- 2. **Inject into Step 1 scene constraint**: Constrain the scenario sentence format for Step 1 based on project type. The following rules apply when extracting business scenarios:
63
-
64
- | Project Type | Scenario Template | Forbidden Vocabulary |
52
+ | Mobile App (native/cross-platform) | Navigation skeleton (React Navigation / Go Router) + platform adapter (iOS/Android permissions, native modules) + env config (dev/staging/prod) |
53
+ | Mini Program | Page routing config + global app.js/ts + request wrapper |
54
+ | Browser Extension | manifest.json (V2/V3) + Background Service Worker + Content Script injection + message bus (background ↔ content ↔ popup) + Popup/Options entry |
55
+ | Desktop App (standalone) | Main process entry (Electron main / Tauri main.rs) + IPC bridge + system capabilities (tray, hotkey) + native FS wrapper |
56
+ | Web + Desktop (Hybrid) | Web scaffold base + desktop runtime (Tauri/Electron) + system capabilities (tray, global hotkey, notifications); **desktop integration must be separate INF subtask** (OS differences, distinct from Web stack) |
57
+ | Library / SDK / NPM Package | Dual output (CJS + ESM) + public API entry (barrel index.ts) + type declaration (.d.ts) + Changelog / version toolchain; **no business Tasks, INF only** |
58
+ | Real-time / Collaborative App | WebSocket service layer + event Schema (shared types) + room/session management; [?CRDT] conflict resolution |
59
+ | AI Agent / MCP Tool | LLM client abstraction (provider-agnostic) + Prompt template management + Tool/Function Calling Schema + conversation state / Memory; [?MCP] MCP protocol adapter |
60
+
61
+ **Actions (two outputs)**:
62
+ 1. **Inject Step 2 INF-01**: Write scaffold checklist for the project type into INF-01 description.
63
+ 2. **Inject Step 1 scenario constraints**: Limit scenario phrasing by project type:
64
+
65
+ | Project Type | Scenario Template | Forbidden Terms |
65
66
  |:---|:---|:---|
66
- | CLI Tool | `User can [run command / pass arg] → [terminal output]` | page, route, component, UI |
67
- | Library / SDK | `Caller can [invoke API X] → [returns Y]` | user, interface, interaction |
67
+ | CLI Tool | `User can [run command/args] → [terminal output]` | page, route, component, UI |
68
+ | Library / SDK | `Caller can [invoke API X] → [return Y]` | user, interface, interaction |
68
69
  | API Service | `Client can [HTTP METHOD /path] → [response structure]` | frontend, page, component |
69
- | Mini Program | `User can [action] on [page name] → [visible result in WeChat]` | backend route, REST |
70
- | Web SPA / Full-Stack / Mobile / Desktop | `User can [action] → [perceivable outcome]` | (no special restriction) |
70
+ | Mini Program | `User can [page name] [action] → [visible result in WeChat]` | backend route, REST |
71
+ | Web SPA / Full-Stack / Mobile / Desktop | `User can [action] → [perceivable result]` | (no special limit) |
71
72
 
72
73
  ---
73
74
 
74
75
  ### Step 1 · PM Perspective → Business Tasks
75
76
 
76
- Extract user scenarios from the Brief task descriptions and aggregate them into business Tasks.
77
+ Extract user scenarios from Brief, aggregate into business Tasks.
77
78
 
78
- 1. Convert each item into scenario format: `User can [action] → [perceivable outcome]`
79
+ 1. Convert each feature into scenario: `User can [action] → [perceivable result]`
79
80
  2. Scenarios sharing the same core flow → merge into one business Task
80
- > **Note**: "Shared feature domain / theme" ≠ "Shared core flow". Scenarios belonging to the same domain (e.g. "community interaction") but with independent UI areas and implementation domains must follow the split signals below never force-merge because they share a theme. "Shared core flow" means: scenarios complete within the same UI view, operate on the same data entity, and share the same state transitions.
81
- 3. Granularity calibration (core principle: **one task = one `/archi.plan` session = one `tasks/<slug>/` subdirectory**):
81
+ > **Note**: "Shared domain/theme" ≠ "Shared core flow". Scenarios in the same domain (e.g. "community interaction") but with distinct UI areas and implementation domains must be split per signals below; do not merge by theme alone. "Shared core flow" means: same UI view, same data entity, same state flow.
82
+ 3. Granularity calibration (core rule: **one task = one `/archi.plan` session = one `tasks/<slug>/` subdir**):
82
83
 
83
84
  **Behavior perspective (PM)**:
84
85
 
85
86
  | Signal | Action |
86
87
  |:---|:---|
87
88
  | Description contains "and" (two independent concerns) | Split |
88
- | DoD exceeds 4 acceptance criteria | Split |
89
- | Task spans 3+ independent UI areas or implementation domains | Split |
90
- | A single `/archi.plan` session cannot fully describe behavior in one spec.md | Split |
91
- | Two tasks share >50% of their file set | Merge |
89
+ | DoD has > 4 acceptance criteria | Split |
90
+ | Task spans > 3 independent UI areas or implementation domains | Split |
91
+ | Single spec.md cannot fully describe behavior in one `/archi.plan` | Split |
92
+ | Two tasks have >50% file overlap | Merge |
92
93
 
93
- > **Note**: If "Task B is meaningless without Task A", this describes a sequential dependency — **never merge**. Declare `deps: [A]` on B in Step 4 instead.
94
+ > **Note**: If "B only makes sense after A", that is a dependency — **do not merge**; declare `deps: [A]` for B in Step 4.
94
95
 
95
- **Engineering perspective (independent of behavior either trigger = split)**:
96
+ **Implementation perspective (Engineering, independent of behavior; either triggers split)**:
96
97
 
97
98
  | Signal | Action | Example |
98
99
  |:---|:---|:---|
99
- | Task contains ≥2 **implementation domains**, each independently unit-testable | Split | Pure logic layer + UI rendering layer → separate tasks |
100
- | Implementation requires mastering ≥3 independent technical concerns simultaneously | Split | Char rendering + state machine + animation API → three distinct things |
101
- | A concern has its own significant boundary complexity (e.g. IME, Canvas, third-party chart API) | Extract that concern | Input capture + IME own task |
100
+ | Task contains ≥2 **implementation domains**, each independently unit-testable | Split | Pure compute layer + UI render layer → separate |
101
+ | Implementation requires ≥3 independent technical concerns | Split | Character rendering + state machine + animation API → three things |
102
+ | One concern has independent boundary complexity (IME, Canvas, third-party chart API) | Extract that concern | Input capture + IME as separate task |
102
103
 
103
- > **Why add the engineering perspective**: The behavior perspective describes "what the user sees"; the engineering perspective describes "what the AI must simultaneously master during `/archi.code`". A task that is behaviorally cohesive (same screen) but spans multiple unrelated implementation domains will cause the AI to lose focus and produce poor cross-domain code.
104
+ > **Why engineering perspective**: Behavior describes "what user sees"; engineering describes "what AI must grasp when implementing". A task can be behaviorally cohesive (same page) but span multiple domains; AI in `/archi.code` will lose focus with too-wide context.
104
105
 
105
- **Granularity limits**:
106
+ **Granularity cap**:
106
107
 
107
- > One Roadmap Task = the minimum functional unit that **AI can handle without further decomposition and produce one cohesive spec.md** (HTN Primitive executability principle).
108
+ > A Roadmap Task = the smallest functional unit that **AI can produce a cohesive spec.md without further decomposition** (HTN Primitive executability).
108
109
 
109
- *Decomposition-phase proxy metrics (assessable directly from the Brief)*:
110
+ *Proxy metrics at decomposition (judge directly from Brief)*:
110
111
 
111
- | Proxy Metric | Limit | Action when exceeded |
112
+ | Proxy Metric | Cap | Action if exceeded |
112
113
  |:---|:---|:---|
113
- | Number of independent user operation flows in the task description | ≤ 3 | Split |
114
- | Number of independent data entities involved (each with its own state transitions) | ≤ 2 | Split |
115
- | Number of independent concerns joined by "and / plus / also" in the description | ≤ 1 | Split |
116
- | Task acceptance cannot be validated independently without running another business Task | — | Check coupling; redraw interface boundary (INVEST-I) |
114
+ | Independent user operation flows in task description | ≤ 3 | Split |
115
+ | Independent data entities (each with own state flow) | ≤ 2 | Split |
116
+ | "and/or/and also" connecting independent concerns | ≤ 1 | Split |
117
+ | Task cannot be validated without running another business Task | — | Check coupling, redraw interface boundary (INVEST-I) |
117
118
 
118
- > During `/archi.plan`, if spec.md Scenario count is projected to exceed 6 or plan.json Phase count to exceed 4, pause and prompt the user to return to `/archi.scope` for re-splitting. Never force-fit into a single task.
119
+ > If `/archi.plan` estimates spec.md Scenario > 6 or plan.json Phase > 4, pause and prompt user to return to `/archi.scope` for re-split; do not force into a single task.
119
120
 
120
- **DoD format**: `When done, user can <verifiable user behavior>; boundary: <what is explicitly excluded>`
121
+ **DoD format** (by task type):
121
122
 
122
- > DoD is the baseline for `/archi.plan` to write spec.md acceptance criteria and plan.json test cases. It must precisely describe user-perceivable outcomes. Implementation details (file paths, function names, test commands) are determined in the plan phase — do not include them here.
123
+ | Task Type | goal format |
124
+ |:---|:---|
125
+ | `FEAT-xx` | `When done, user can <verifiable user behavior>; boundary: <explicitly out of scope>` |
126
+ | `INF-xx` | `When done, <infrastructure deliverable description>, verified by <verification command>; boundary: <explicitly out of scope>` |
127
+ | `POLISH-xx` | `When done, <quality metric> improves from <baseline> to <target>; boundary: <explicitly out of scope>` |
128
+
129
+ > DoD is the basis for `/archi.plan` to generate spec.md acceptance criteria and plan.json test cases. FEAT must describe user-perceivable results; INF must describe infrastructure deliverables and verification; POLISH must describe quantifiable quality targets. Do not write implementation details (file paths, function names, test commands decided at plan stage).
123
130
 
124
- The following belong to the parent task never create standalone tasks for: **lightweight** result/completion pages, empty-state pages, confirmation dialogs.
131
+ Belong to parent task, do not make standalone: **lightweight** result page / completion page, empty state page, confirmation modal.
125
132
 
126
- > **Exemption**: If a result page contains independent data visualization components (charting libraries), complex animation logic, or independent business calculations, the parent-task rule does **not** apply — it must become its own business Task.
133
+ > **Exception**: Result page with independent data viz (chart lib), complex animation logic, or independent business logic must be standalone business Task.
127
134
 
128
135
  ---
129
136
 
130
137
  ### Step 2 · Architect Perspective → Infra Tasks
131
138
 
132
- Derive shared foundations from business Tasks. Never pre-assume infrastructure.
139
+ Derive shared foundations from business Tasks; no preset infrastructure.
133
140
 
134
- For all business Tasks, ask: do multiple Tasks depend on X, and must X exist before any Task can run? → X is an Infra task.
141
+ For each business Task ask: multiple Tasks depend on X and X must exist before Task → X is Infra task.
135
142
 
136
143
  | Infra Type | Criteria |
137
144
  |:---|:---|
138
- | Project scaffolding / global Schema / type definitions | All business Tasks depend on it; must cover the Step 0 project type checklist |
139
- | Shared core engine (typing engine, rules engine, etc.) | Meets **any one** of: ① 2+ business Tasks call it directly; ② Pure logic layer, independently unit-testable, fully decoupled from UI. `tag: Core` |
140
- | Third-party integration layer | Multiple business Tasks reuse the same external service |
145
+ | Project scaffold / global Schema / type definitions | All business Tasks depend; must cover Step 0 project type checklist |
146
+ | Shared core engine (typing engine, rule engine, etc.) | Either: ① 2 business Tasks directly call; ② pure logic layer, independently unit-testable, fully decoupled from UI. Use `INF-xx` ID (infrastructure by nature), `tag` can label domain (e.g. `Core`, `Engine`) |
147
+ | Third-party integration layer | Multiple business Tasks reuse same external service |
141
148
 
142
- **Core Task Planning Contract**: Tasks with `tag: Core` must end their `description` with a declaration of their primary exported interface (function signature or key interface name). Downstream Task `/archi.plan` sessions can wire directly to this interface without reading upstream implementation, ensuring cross-task planning consistency and predictability.
149
+ **Shared engine planning contract**: Shared core engine INF tasks must declare main export interfaces (function signatures or key interface names) at end of `description`.
150
+ Downstream `/archi.plan` sessions can align to that interface without reading upstream implementation.
143
151
 
144
- **Infra task granularity principle: avoid micro-tasks, but never stack across layers**:
152
+ **Infra task granularity: avoid over-fragmentation, forbid cross-layer stacking**:
145
153
 
146
- - **No micro-splitting**: Config items within the same architectural layer with no meaningful technical distinction (e.g. ESLint + Prettier + TypeScript strict + commitlint) → merge to reduce task count and dependency chain noise.
147
- - **No cross-layer stacking**: Each independent architectural layer has its own technical domain details. Merging them still causes AI context overload — and packing multiple layers into one INF task creates the longest possible critical path, delaying the start of all downstream business Tasks.
154
+ - **No over-fragmentation**: Same-layer config items with no substantive technical difference (ESLint + Prettier + TypeScript strict + commitlint) → merge.
155
+ - **No cross-layer stacking**: Each architecture layer has distinct implementation details; merging blurs AI context; stacking layers into one INF task lengthens critical path and delays all business Tasks.
148
156
 
149
- > **Architectural layer reference** (each layer has independent implementation boundaries in principle each becomes its own task):
150
- > Project scaffold (build / code quality toolchain) | Data layer (DB connection / ORM / migrations) | Auth layer (auth middleware / session / JWT) | API routing layer (route registration / middleware chain / global error handling) | Frontend infrastructure (theme / Design Tokens / global layout) | Third-party service integrations (each service as its own INF task)
157
+ > **Architecture layer reference** (each has independent implementation boundary; in principle each as separate task):
158
+ > Project scaffold (build / code quality toolchain) | Data layer (DB connection / ORM / migrations) | Auth layer (Auth middleware / Session / JWT) | API router layer (route registration / middleware chain / global error handling) | Frontend infrastructure (theme / Design Token / global layout) | Third-party service integration (each service as separate INF task)
151
159
 
152
160
  | Signal | Action |
153
161
  |:---|:---|
154
- | Related config items within the same architectural layer (e.g. all code quality toolchain items, or router skeleton + global error middleware both belonging to the API routing layer) | Merge |
155
- | Spans independent architectural layers (e.g. DB connection layer + Auth middleware, or API routing + frontend theme system) | Split |
156
- | Completely different tech stacks (e.g. local storage layer vs. theme config) | Split |
157
- | Contains OS-level system APIs (system tray, global hotkeys, file associations, etc.) | **Force split** (Step 0 forced rule not subject to same-layer merge condition) |
158
- | An Infra output is called directly by ≥2 business Tasks (interface-type) | Keep as its own task (must declare exported interface contract) |
162
+ | Related config items within same architecture layer | Merge |
163
+ | Spans independent architecture layers (e.g. DB connection + Auth middleware) | Split |
164
+ | Completely different tech stacks (e.g. local storage vs theme config) | Split |
165
+ | Involves OS-level system API (tray, global hotkey, file association) | **Force split** (Step 0 rule, overrides "same-layer merge") |
166
+ | Infra deliverable directly called by ≥2 business Tasks (interface-type) | Standalone task (must declare export interface contract) |
159
167
 
160
- **Implicit standard features scan**: The following features rarely appear in a Brief and must be proactively added with correct classification (omission is not allowed):
168
+ **Implicit standard feature scan** (often absent from Brief; must proactively add):
161
169
 
162
- *Add as standalone business Task (Phase 2 user-visible behavior)*:
170
+ *Add as standalone business Task (Phase 2, user-visible behavior)*:
163
171
 
164
- | Check Item | Trigger Condition |
172
+ | Check | Trigger |
165
173
  |:---|:---|
166
- | User Profile / account settings page | Project includes Auth (INF layer has auth middleware) |
167
- | Account security / password settings page | Includes Auth and user can change password or link third-party accounts |
168
- | Notification center / message list page | Includes notification infrastructure and notifications have "read/unread" state |
174
+ | User Profile / account settings page | Project has Auth (INF layer has auth middleware) |
175
+ | Account security / password settings page | Has Auth and user can change password or bind third-party account |
176
+ | Notification center / message list page | Has notification infra and notifications have read/unread state |
169
177
 
170
- *Add as INF task (Phase 1 infrastructure)*:
178
+ *Add as INF task (Phase 1, infrastructure)*:
171
179
 
172
- | Check Item | Trigger Condition |
180
+ | Check | Trigger |
173
181
  |:---|:---|
174
- | Notification infrastructure (server-side push / message queue layer) | ≥1 Task mentions "notifications / reminders" verbally but no INF Task created |
175
- | Search infrastructure (PG FTS index / external search engine deployment) | ≥2 business Tasks independently describe "search" functionality; decide on the approach here as an INF Task — downstream Tasks depend on it |
176
- | Permission / role management layer (RBAC) | Includes Auth and has ≥2 user roles (e.g. admin / user) |
177
- | File storage integration layer (S3 / OSS wrapper) | ≥1 Task involves file upload / download / preview |
178
- | Email / SMS sending integration | Task mentions "send email / verification code / SMS notification" |
179
- | Payment integration layer | Task mentions "payment / order / checkout / refund" |
182
+ | Notification infrastructure (server push / message queue) | ≥1 Task mentions "notification/reminder" but no INF Task |
183
+ | Search infrastructure (PG FTS index / external engine) | ≥2 business Tasks describe "search"; decide approach here, downstream Tasks depend |
184
+ | Permission / role management (RBAC) | Has Auth and ≥2 user roles (e.g. admin / user) |
185
+ | File storage integration (S3 / OSS wrapper) | ≥1 Task involves file upload / download / preview |
186
+ | Email / SMS sending integration | Task mentions "send email / verification code / SMS" |
187
+ | Payment integration | Task mentions "payment / order / checkout / refund" |
180
188
 
181
189
  ---
182
190
 
183
- ### Step 3 · NFR Filter
191
+ ### Step 3 · NFR Filtering and Polish Task Identification
192
+
193
+ Route cross-cutting concerns by **effort weight**: lightweight → inject into goal; heavyweight → standalone `POLISH-xx` task.
184
194
 
185
- The following types **must never become standalone tasks**: inject into the `goal` of the first task that implements the capability (`[NFR] <note>`); other affected tasks are noted only in the NFR list below. `/archi.plan` will propagate these NFRs into the constraints section of the corresponding spec.md.
195
+ > **"First task" definition** (for NFR injection): In dependency chain, task whose `deps` only include INF layer (no business pre-deps) and earliest to involve that NFR. If multiple candidates in same Batch, take smallest ID.
186
196
 
187
- > **"First task" definition**: The task earliest in the dependency chain whose `deps` contain only INF-layer tasks (no business prerequisites) and that is the first to involve this NFR capability. When multiple candidates exist in the same Batch, use the one with the smallest ID.
197
+ **Criteria**:
188
198
 
189
- | Type | Common Forms | Note |
199
+ | Signal | Action |
200
+ |:---|:---|
201
+ | Only needs "do in passing" within business Task (e.g. use i18n key instead of hardcode) | **NFR inject** — append to first related task goal: `[NFR] <description>` |
202
+ | Needs standalone infrastructure (e.g. integrate next-intl, create translation file structure) | **INF task** — create `INF-xx`, Phase 1 |
203
+ | Needs cross-feature dedicated work, acceptance independently measurable (e.g. Lighthouse ≥ 90, full a11y audit) | **POLISH task** — create `POLISH-xx`, Phase 3 |
204
+
205
+ **By type**:
206
+
207
+ | Type | Lightweight → NFR inject | Heavyweight → Standalone |
190
208
  |:---|:---|:---|
191
- | Internationalization | i18n, multi-language, translation copy | |
192
- | Visual theme (config) | Brand color tokens, Tailwind theme colors, CSS variable definitions | NFR inject into scaffold task |
193
- | Visual theme (feature) | Dark/light toggle button, OS preference detection, theme persistence | **Not NFR** — must be a standalone business Task (user-visible behavior) |
194
- | Animation style conventions | Page transition approach, duration standards | NFR — inject into the first Task goal that includes animation |
195
- | Performance | Lazy loading, virtual list, cache strategy | |
196
- | Accessibility | A11y, keyboard navigation, screen reader | |
209
+ | Internationalization | Use i18n key within business Task | Integrate i18n framework + translation file structure → `INF-xx`; full translation coverage + language switch UI → `POLISH-xx` |
210
+ | Visual theme (config) | Brand color Token into scaffold | — |
211
+ | Visual theme (functional) | — | Dark/light toggle + OS preference detection `FEAT-xx` (user-visible behavior) |
212
+ | Animation style | Transition duration into first Task with animation | |
213
+ | Performance optimization | Lazy load / cache within single Task | Cross-feature optimization (LCP < 2s, bundle size target) → `POLISH-xx` |
214
+ | Accessibility | ARIA attributes within single Task | Full a11y audit + fixes → `POLISH-xx` |
215
+ | Packaging / distribution | — | Desktop packaging + auto-update config → `POLISH-xx` |
197
216
 
198
217
  ---
199
218
 
200
- ### Step 4 · Dependency & Parallelism Optimization
219
+ ### Step 4 · Dependencies and Parallel Optimization
201
220
 
202
- - **Real dependency chains**: Never attach all business Tasks to `INF-01` only. Dependencies must reflect real business relationships.
203
- - **Business entity dependency (takes priority over minimal dependency)**: If the core subject of feature B is produced by feature A (i.e. B's data entity does not exist until A is complete), then B must declare a dependency on A. This rule takes precedence over the minimal dependency principle. Example: Usage Log records Prompt usage; Prompts are created by FEAT-Prompt_Create → the Usage Log Task must depend on the Prompt Task, not only on the INF layer.
204
- - **Minimal dependency principle**: Tasks that can run in parallel must not carry unnecessary deps maximize Batch parallelism.
221
+ - **Real dependency chain**: Forbid all business Tasks depending only on `INF-01`; reflect real business relationships.
222
+ - **Business entity dependency (overrides minimal deps)**: If feature B's core subject is produced by feature A (B's data entity does not exist before A), B must declare dep on A. Example: Usage Log records Prompt; Prompt created by FEAT-Prompt_Create → Usage Log Task must depend on Prompt Task, not just INF layer.
223
+ - **Minimal dependency principle**: Do not add unnecessary deps; maximize Batch parallelism.
205
224
 
206
225
  ---
207
226
 
208
227
  ## Task Rules
209
228
 
210
- 1. **ID generation**: Continue existing Roadmap ID watermark, increment each prefix from its max value. Fresh projects start at `INF-01` / `FEAT-01`.
229
+ 1. **ID prefix and task type**:
230
+
231
+ ID prefix is the **sole identifier** of task type; `/archi.plan` selects spec acceptance format by prefix.
232
+
233
+ | ID Prefix | Task Type | Meaning | Phase |
234
+ |:---|:---|:---|:---|
235
+ | `INF-xx` | Infrastructure | Scaffold, Schema, toolchain, third-party integration | Phase 1 |
236
+ | `FEAT-xx` | Feature | Business functionality: user-perceivable behavior | Phase 2 |
237
+ | `POLISH-xx` | Quality | Performance, full i18n, a11y audit, packaging | Phase 3 |
238
+ | `EDIT-xx` | Edit | Modify existing functionality (incremental mode only) | Same Phase as modified task |
211
239
 
212
- 2. **Phase assignment**:
240
+ Continue ID watermark from max per prefix + 1; new project starts from `INF-01` / `FEAT-01`.
213
241
 
214
- | Task Type | Phase |
215
- |:---|:---|
216
- | Project scaffolding, Schema, global types | Phase 1 (Infrastructure) |
217
- | Shared core engine (identified in Step 2) | Phase 1 (Infrastructure) |
218
- | Business Task | Phase 2 (Core Features) |
219
- | EDIT-xxx (modifying existing feature) | Same Phase as the modified task |
242
+ 2. **Phase structure**:
220
243
 
221
- 3. **Design decision injection**: Existing decisions from the Brief → append to corresponding task `goal`: `[User Preset] <content>`. Never repeat the same global decision across multiple tasks. `/archi.plan` treats these as non-negotiable hard constraints, writing them directly into spec.md without re-asking.
244
+ | Phase | ID | Name | Content |
245
+ |:---|:---|:---|:---|
246
+ | Phase 1 | `phase-infra` | Infrastructure | INF-xx tasks (scaffold, data layer, auth, API skeleton) |
247
+ | Phase 2 | `phase-core` | Core Features | FEAT-xx tasks (business features) |
248
+ | Phase 3 | `phase-polish` | Polish & Launch | POLISH-xx tasks (quality, packaging); omit if Brief has no polish needs |
222
249
 
223
- 4. **EDIT tasks**: When an existing feature must be modified → create `EDIT-xxx` (`tag: Edit`), goal describes the modification scope. Only used in Incremental mode.
250
+ 3. **tag field = business domain label**:
224
251
 
225
- 5. **Slug naming**: `slug` is the `tasks/<slug>/` folder name. Must clearly express the task content, in `Pascal_Snake_Case` format (e.g. `Typing_Engine_Core`). Each task maps to exactly one unique task subdirectory — no duplicates.
252
+ `tag` labels the **business domain** (e.g. `Core`, `Community`, `Auth`, `Data`), free text, determined by Brief.
253
+
254
+ > **Note**: `tag` does NOT determine task type — task type is determined by ID prefix. E.g. `FEAT-05` (`tag: Community`) has task type Feature, not Community.
255
+
256
+ 4. **Design decision injection**: Brief design decisions → inject into task `goal` end: `[User Preset] <content>`; do not repeat same decision across tasks. `/archi.plan` treats as hard constraint, writes into spec.md without asking.
257
+
258
+ 5. **EDIT tasks**: Modify existing functionality → create `EDIT-xxx`, goal states scope; incremental mode only.
259
+
260
+ 6. **Slug naming**: `slug` = `tasks/<slug>/` folder name, must clearly express task content, format `Pascal_Snake_Case` (e.g. `Typing_Engine_Core`). One task per subdir, no duplicates.
226
261
 
227
262
  ---
228
263
 
229
- ## Task JSON Schema (Tier 1 Strict no field additions or removals)
264
+ ## Task JSON Schema (Tier 1 Strict, no add/remove fields)
230
265
 
231
266
  ```json
232
267
  {
233
268
  "id": "FEAT-01",
234
269
  "title": "Task Title In English",
235
270
  "status": "pending | blocked",
236
- "description": "<1-2 sentences describing what this task builds and what it covers. Core tasks must end with a declaration of their primary exported interface>",
237
- "goal": "When done, user can <verifiable user behavior>; boundary: <what is explicitly excluded>",
271
+ "description": "<1-2 sentences on what this task builds and scope. Shared engine tasks must declare main export interfaces at end>",
272
+ "goal": "When done, user can <verifiable user behavior>; boundary: <explicitly out of scope>",
238
273
  "deps": ["INF-01"],
239
- "tag": "Infra | Core | Feature | Edit",
274
+ "tag": "<business domain label, free text. e.g. Core, Community, Auth, Data, UI>",
240
275
  "slug": "Task_Title_Snake_Case"
241
276
  }
242
277
  ```
243
278
 
244
- `deps` empty or all `done` → `pending`; any unfinished dep → `blocked`
279
+ `deps` empty or all `done` → `pending`; has incomplete deps → `blocked`
245
280
 
246
281
  ---
247
282
 
248
- ## Intermediate Output
283
+ ## Intermediate Outputs
249
284
 
250
- > This Skill is a subroutine: once structured data is produced, control returns to the caller.
251
- > - `/archi.scope` → caller displays to user for confirmation, then writes to `roadmap.json` after "OK"
285
+ > This Skill is a subroutine: after producing structured data, control returns to caller.
286
+ > - `/archi.scope` → caller shows user for confirmation, writes to `roadmap.json` on OK
252
287
  > - `/archi.start` → caller writes directly to `roadmap.json`
253
288
 
254
- Produces three parts:
255
-
256
- **① Task data** (maps directly to `roadmap.json` phases/tasks structure):
289
+ Three outputs:
257
290
 
258
- ```json
259
- {
260
- "phases": [
261
- {
262
- "id": "phase-1",
263
- "name": "Infrastructure",
264
- "tasks": [
265
- { "id": "INF-01", "title": "...", "status": "pending", "description": "...", "goal": "...", "deps": [], "tag": "Infra", "slug": "..." }
266
- ]
267
- },
268
- {
269
- "id": "phase-2",
270
- "name": "Core Features",
271
- "tasks": [
272
- { "id": "FEAT-01", "title": "...", "status": "blocked", "description": "...", "goal": "...", "deps": ["INF-01"], "tag": "Feature", "slug": "..." }
273
- ]
274
- }
275
- ]
276
- }
277
- ```
291
+ **① Task data** (directly maps to `roadmap.json` phases/tasks structure; each task follows Task JSON Schema above; phases ordered `phase-infra` → `phase-core` → `phase-polish`):
278
292
 
279
- **② NFR merge list** (returned alongside task data; caller appends as `nfr` top-level field in roadmap; `/archi.plan` `step_1_load` must read this list):
293
+ **② NFR merge list** (return with task data; caller appends as `nfr` top-level field; `/archi.plan` step_1_load must read):
280
294
 
281
- | NFR Name | Injected Into Task ID | Constraint Summary | Affected Task IDs |
295
+ | NFR Name | Inject Task ID | Constraint Summary | Affected (other task IDs) |
282
296
  |:---|:---|:---|:---|
283
- | (example) i18n | FEAT-01 | All copy must use i18n keys no hardcoded strings | FEAT-02, FEAT-03 |
297
+ | (example) i18n | FEAT-01 | All copy via i18n key, no hardcoded strings | FEAT-02, FEAT-03 |
284
298
 
285
- **③ Parallel execution batches** (DAG topology layers — tasks within the same Layer can be handled by separate parallel AI sessions):
299
+ **③ Parallel execution batches** (DAG layer diagram; same Layer can run in parallel):
286
300
 
287
301
  ```
288
302
  Layer 0 ║ INF-01
289
303
  Layer 1 ║ INF-02 · INF-03 ← both depend on INF-01
290
- Layer 2 ║ FEAT-01 · FEAT-02 ← depend on INF-02 / INF-03 respectively
304
+ Layer 2 ║ FEAT-01 · FEAT-02 ← each depends on INF-02 / INF-03
291
305
  Layer 3 ║ FEAT-03 ← depends on FEAT-01
306
+ Layer 4 ║ POLISH-01 · POLISH-02 ← depend on related FEAT tasks
292
307
  ```
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: archi-design-patterns
3
+ type: specialist
4
+ description: Architext technical design structured pattern library. Defines standard formats and self-check lists for four core mechanism description patterns (State Machine / Pipeline / Decision Matrix / Protocol). Referenced by /archi.plan step_4 when generating design.md § 2, and by /archi.code step_5 when auditing implementation vs. design consistency.
5
+ ---
6
+
7
+ # Technical Design Structured Pattern Library
8
+
9
+ ## System Flow Position
10
+
11
+ ```
12
+ /archi.plan step_4_generate → design.md § 2
13
+
14
+ [This Skill] pattern selection → format generation → self-check
15
+
16
+ design.md § 2 Core Mechanisms content
17
+ ```
18
+
19
+ > **Skill responsibility boundary**:
20
+ > - Responsible for: pattern selection guide, standard table formats per pattern, self-check lists
21
+ > - Not responsible for: design.md overall structure (see `design.template.md`), parameters/invariants/failure modes (see template §§ 3-5)
22
+
23
+ ---
24
+
25
+ ## Pattern Selection Guide
26
+
27
+ Select ≥1 pattern per mechanism characteristic. Same feature may combine multiple (e.g. State Machine for connection mgmt + Pipeline for message handling).
28
+
29
+ | Mechanism Characteristic | Recommended Pattern | Typical Scenarios |
30
+ |:---|:---|:---|
31
+ | Discrete state set with transitions | **State Machine** | Connection mgmt, workflow engine, component lifecycle, auth flow |
32
+ | Data/requests through ordered processing steps | **Pipeline** | Message decode chain, middleware stack, data transform pipe, request interceptor |
33
+ | Behavior depends on multi-condition combination | **Decision Matrix** | Permission check, policy routing, degradation rules, feature flags |
34
+ | Defined message exchange between two or more components | **Protocol** | Client-server comms, IPC, event bus, Worker messages |
35
+
36
+ **Execution flow**: Select pattern → fill standard format → **run self-check immediately** → if any item fails, fix and re-check → all pass before next mechanism.
37
+
38
+ ---
39
+
40
+ ## Pattern A: State Machine
41
+
42
+ ### Standard Format
43
+
44
+ **States**:
45
+
46
+ | State | Meaning | Entry Condition |
47
+ |:---|:---|:---|
48
+ | `idle` | [Initial/Idle] | [Init complete or active disconnect] |
49
+ | `connecting` | [Connecting] | [Connection request initiated] |
50
+ | `connected` | [Connected] | [open event received] |
51
+ | ... | ... | ... |
52
+
53
+ **Transitions**:
54
+
55
+ | From | → To | Guard (Trigger) | Action (Side Effect) |
56
+ |:---|:---|:---|:---|
57
+ | `idle` | `connecting` | [User triggers connect] | [Create Socket instance] |
58
+ | `connecting` | `connected` | [open event received] | [Start heartbeat, clear retry count] |
59
+ | `connecting` | `disconnected` | [Timeout or error event] | [Log error, increment retry count] |
60
+ | ... | ... | ... | ... |
61
+
62
+ ### Self-Check List
63
+
64
+ | # | Check | Verification |
65
+ |:---|:---|:---|
66
+ | 1 | **Completeness**: No deadlock | Every state has ≥1 outgoing edge |
67
+ | 2 | **Reachability**: No orphan | Every non-initial state has ≥1 incoming edge |
68
+ | 3 | **Termination**: Exit path exists | Terminal state or stable loop exists |
69
+ | 4 | **Determinism**: No ambiguous transition | Outgoing Guards from same state are mutually exclusive |
70
+ | 5 | **Exception coverage**: Not Happy Path only | Every non-terminal state has error/timeout outgoing edge |
71
+
72
+ ---
73
+
74
+ ## Pattern B: Pipeline
75
+
76
+ ### Standard Format
77
+
78
+ | Step | Input | Process | Output | On Error |
79
+ |:---|:---|:---|:---|:---|
80
+ | 1. [name] | [input type] | [logic] | [output type] | [drop/retry/abort/degrade] |
81
+ | 2. [name] | [prev Output] | [logic] | [output type] | [error handling] |
82
+ | ... | ... | ... | ... | ... |
83
+
84
+ ### Self-Check List
85
+
86
+ | # | Check | Verification |
87
+ |:---|:---|:---|
88
+ | 1 | **Type chain**: No break | Step N Output = Step N+1 Input |
89
+ | 2 | **Error handling**: No silent swallow | Every step has On Error |
90
+ | 3 | **Idempotency note**: Retry safety clear | Mark which steps are safe to retry, which have side effects |
91
+ | 4 | **Recoverability**: Safe termination | Any Step error can recover or exit safely |
92
+
93
+ ---
94
+
95
+ ## Pattern C: Decision Matrix
96
+
97
+ ### Standard Format
98
+
99
+ | Condition A | Condition B | Condition C | → Behavior | Note |
100
+ |:---|:---|:---|:---|:---|
101
+ | [val1] | [val1] | [val1] | [behavior] | |
102
+ | [val1] | [val1] | [val2] | [behavior] | |
103
+ | [val1] | [val2] | * | [behavior] | *=any |
104
+ | * | * | * | [fallback] | Default when unmatched |
105
+
106
+ ### Self-Check List
107
+
108
+ | # | Check | Verification |
109
+ |:---|:---|:---|
110
+ | 1 | **Exhaustiveness**: No gap | All condition value combos covered (* wildcards for unlisted) |
111
+ | 2 | **Unambiguous**: Single match | Same input hits only one row (priority top-to-bottom, or conditions mutually exclusive) |
112
+ | 3 | **Fallback row**: Default exists | Last row is * wildcard |
113
+ | 4 | **Testable**: Can construct cases | Each row can construct test input |
114
+
115
+ ---
116
+
117
+ ## Pattern D: Protocol
118
+
119
+ ### Standard Format
120
+
121
+ **Parties**: [Component A] ↔ [Component B]
122
+
123
+ | Seq | Sender → Receiver | Message | Payload | Expected Response | Timeout |
124
+ |:---|:---|:---|:---|:---|:---|
125
+ | 1 | [A → B] | `[name]` | {[field: type]} | `[response]` {[field: type]} | [Ns → timeout handling] |
126
+ | 2 | [B → A] | `[name]` | {[field: type]} | None (one-way push) | - |
127
+ | ... | ... | ... | ... | ... | ... |
128
+
129
+ ### Self-Check List
130
+
131
+ | # | Check | Verification |
132
+ |:---|:---|:---|
133
+ | 1 | **Pairing**: Request has response | Messages needing response have Response + Timeout defined |
134
+ | 2 | **Type explicit**: No any | Every Payload field has concrete type |
135
+ | 3 | **Order dependency**: Precedence declared | Mark which messages must follow which |
136
+ | 4 | **Concurrency safe**: Strategy stated | If multiple messages may arrive concurrently, state handling (queue/drop/merge) |
137
+
138
+ ---
139
+
140
+ > **Intermediate output**: This Skill is a subroutine; after producing mechanism description + self-check results, control returns to caller (step_4_generate or step_5_audit) to continue.