moicle 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +20 -9
  2. package/assets/architecture/_shared/severity-levels.md +34 -0
  3. package/assets/architecture/_shared/stack-detection.md +34 -0
  4. package/assets/commands/marketing.md +7 -7
  5. package/assets/skills/docs/sync/SKILL.md +159 -519
  6. package/assets/skills/docs/write/SKILL.md +89 -186
  7. package/assets/skills/feature/new/SKILL.md +152 -192
  8. package/assets/skills/feature/refactor/SKILL.md +152 -233
  9. package/assets/skills/fix/hotfix/SKILL.md +139 -305
  10. package/assets/skills/fix/incident/SKILL.md +107 -19
  11. package/assets/skills/fix/pr-comment/SKILL.md +98 -224
  12. package/assets/skills/fix/root-cause/SKILL.md +161 -104
  13. package/assets/skills/{docs → marketing}/content/SKILL.md +4 -4
  14. package/assets/skills/marketing/logo/SKILL.md +252 -0
  15. package/assets/skills/marketing/seo-blog/SKILL.md +367 -0
  16. package/assets/skills/marketing/video/SKILL.md +258 -0
  17. package/assets/skills/research/onboarding/SKILL.md +127 -510
  18. package/assets/skills/research/spike/SKILL.md +128 -436
  19. package/assets/skills/research/web/SKILL.md +124 -83
  20. package/assets/skills/review/architect/SKILL.md +157 -306
  21. package/assets/skills/review/branch/SKILL.md +153 -208
  22. package/assets/skills/review/pr/SKILL.md +129 -519
  23. package/assets/skills/review/tdd/SKILL.md +108 -69
  24. package/bin/cli.js +2 -2
  25. package/dist/commands/install.d.ts.map +1 -1
  26. package/dist/commands/install.js +176 -8
  27. package/dist/commands/install.js.map +1 -1
  28. package/dist/commands/list.d.ts.map +1 -1
  29. package/dist/commands/list.js +31 -1
  30. package/dist/commands/list.js.map +1 -1
  31. package/dist/commands/status.d.ts.map +1 -1
  32. package/dist/commands/status.js +30 -1
  33. package/dist/commands/status.js.map +1 -1
  34. package/dist/commands/uninstall.d.ts.map +1 -1
  35. package/dist/commands/uninstall.js +64 -8
  36. package/dist/commands/uninstall.js.map +1 -1
  37. package/dist/utils/symlink.d.ts +1 -0
  38. package/dist/utils/symlink.d.ts.map +1 -1
  39. package/dist/utils/symlink.js +8 -6
  40. package/dist/utils/symlink.js.map +1 -1
  41. package/package.json +1 -1
  42. package/assets/skills/docs/logo/SKILL.md +0 -492
  43. package/assets/skills/docs/video/SKILL.md +0 -666
@@ -5,583 +5,223 @@ description: Sync documentation workflow - reads codebase and docs folder to gen
5
5
 
6
6
  # Sync Docs Workflow
7
7
 
8
- Automated workflow that reads codebase and existing docs to generate a complete, structured documentation output with architecture overview, use case diagrams, and a README index linking all sub-files.
8
+ Generate a complete `docs/` site (business overview, architecture, use cases with sequence diagrams, README index) from the current codebase. Includes a 3-iteration auto-review loop.
9
9
 
10
10
  ## When to use this skill
11
11
 
12
- - ✅ Need to (re)generate a whole `docs/` site from current codebase state
13
- - ✅ Existing docs have drifted from code and you want batch sync + review loop
14
- - ✅ Onboarding a project that has no structured docs at all
12
+ - ✅ Re-generate the whole `docs/` site from current code
13
+ - ✅ Existing docs have drifted; want batch sync with review loop
14
+ - ✅ Project has no structured docs at all
15
15
  - ❌ Authoring a single doc by hand (README / API.md only) → use `/docs:write`
16
- - ❌ Need to understand the codebase, not document it → use `/research:onboarding`
17
- - ❌ Adding one new endpoint's doc only → use `/feature:api` Phase 4
16
+ - ❌ Understand the codebase, not document it → use `/research:onboarding`
17
+ - ❌ Adding doc for one endpoint → use `/feature:api` Phase 4
18
18
 
19
- ## Workflow Overview
19
+ ## Read Architecture First
20
20
 
21
- ```
22
- ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
23
- │ 1. SCAN │──▶│1.5 CONFIRM──▶│2. GENERATE──▶│ 3. REVIEW │──▶│4. COMPLETE│
24
- └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘
25
- ▲ │
26
- │ Feedback │
27
- └──────────────┘
28
- (loop until pass)
29
- ```
30
-
31
- **Key**: Phase 1.5 CONFIRM asks user to choose between REFACTOR (full restructure) or UPDATE (keep structure, update & link only). Phase 3 REVIEW automatically loops back to Phase 2 GENERATE if issues are found.
21
+ Detect stack via `~/.claude/architecture/_shared/stack-detection.md`. Read `ddd-architecture.md` + stack doc.
32
22
 
33
23
  ---
34
24
 
35
- ## Phase 1: SCAN
36
-
37
- **Goal**: Read and understand the entire codebase and existing docs
25
+ ## Workflow
38
26
 
39
- ### Actions
40
-
41
- 1. **Identify project stack**:
42
- - Check `package.json`, `go.mod`, `pubspec.yaml`, `composer.json`, etc.
43
- - Determine primary language and framework
27
+ ```
28
+ SCAN → CONFIRM mode → GENERATE → REVIEW loop (≤3x) → COMPLETE
29
+ ```
44
30
 
45
- 2. **Read existing documentation**:
46
- ```bash
47
- # Find all doc files
48
- find . -name "*.md" -not -path "*/node_modules/*" -not -path "*/vendor/*" -not -path "*/.dart_tool/*" | sort
31
+ `CONFIRM` asks the user to pick **REFACTOR** (full restructure of `docs/`) or **UPDATE** (keep existing structure, refresh content).
49
32
 
50
- # Find existing docs folder
51
- ls -la docs/ 2>/dev/null
52
- ```
33
+ ---
53
34
 
54
- 3. **Map codebase structure**:
55
- ```bash
56
- # Get directory tree (exclude build artifacts)
57
- tree -L 4 -I 'node_modules|vendor|dist|build|.dart_tool|.git' --dirsfirst
58
- ```
35
+ ## Phase 1: SCAN
59
36
 
60
- 4. **Identify key components**:
61
- - Entry points (main files, routes, controllers)
62
- - Domain/business logic (services, use cases, models)
63
- - Data layer (repositories, database, APIs)
64
- - Configuration files
65
- - Test files
37
+ **Goal:** map codebase + existing docs in one pass.
66
38
 
67
- 5. **Extract use cases** from the codebase:
68
- - Read route definitions, controller methods, service methods
69
- - Identify distinct user-facing features/flows
70
- - Group related functionality into use cases
39
+ ```bash
40
+ # Existing docs
41
+ find . -name "*.md" -not -path "*/node_modules/*" -not -path "*/vendor/*" -not -path "*/.dart_tool/*" | sort
42
+ ls docs/ 2>/dev/null
71
43
 
72
- 6. **Read architecture files** (if exist):
73
- ```bash
74
- ls .claude/architecture/*.md 2>/dev/null
75
- ls ~/.claude/architecture/*.md 2>/dev/null
76
- ```
44
+ # Code surface
45
+ tree -L 4 -I 'node_modules|vendor|dist|build|.dart_tool|.git'
77
46
 
78
- ### Output
79
- ```markdown
80
- ## Scan Results
81
-
82
- ### Stack: [identified stack]
83
- ### Architecture: [identified pattern]
84
-
85
- ### Existing Docs
86
- - [list of existing .md files and their status]
87
-
88
- ### Identified Use Cases
89
- 1. [Use Case 1] - [brief description]
90
- 2. [Use Case 2] - [brief description]
91
- 3. [Use Case N] - [brief description]
92
-
93
- ### Key Components
94
- - Entry Points: [list]
95
- - Business Logic: [list]
96
- - Data Layer: [list]
97
- - Config: [list]
98
-
99
- ### Docs Output Plan
100
- - docs/README.md (index)
101
- - docs/business.md (business overview - non-technical, business language only)
102
- - docs/architecture.md
103
- - docs/use-cases/[usecase-name].md (per use case)
104
- - docs/diagrams/ (embedded in use case files via mermaid)
47
+ # Entry points / use cases (per stack)
48
+ # Go: grep -r "func.*Handler" internal/
49
+ # NestJS: grep -r "@Controller\|@Get\|@Post" src/
50
+ # Laravel: cat routes/web.php routes/api.php
51
+ # Remix: ls app/routes/
52
+ # Flutter: grep -r "MaterialPageRoute\|GoRoute" lib/
105
53
  ```
106
54
 
55
+ ### Extract
56
+ - Stack + framework
57
+ - All domains / modules
58
+ - All user-facing flows (endpoints / screens / commands)
59
+ - Existing docs structure (if any)
60
+
107
61
  ### Gate
108
- - [ ] Codebase fully scanned
109
- - [ ] Use cases identified
110
- - [ ] Existing docs read
111
- - [ ] Output plan defined
62
+ - [ ] Stack identified
63
+ - [ ] All domains listed
64
+ - [ ] All use cases listed (count + brief name)
65
+ - [ ] Existing docs inventoried
112
66
 
113
67
  ---
114
68
 
115
69
  ## Phase 1.5: CONFIRM
116
70
 
117
- **Goal**: Ask the user how they want to handle docs before generating.
118
-
119
- ### Actions
71
+ Ask the user **explicitly** which mode:
120
72
 
121
- 1. **Present scan results** from Phase 1 to the user (current structure, identified use cases, docs plan)
73
+ | Mode | When to use | Effect |
74
+ |------|-------------|--------|
75
+ | **REFACTOR** | Existing docs are messy / partial / wrong structure | Restructure `docs/` from scratch, may delete old files |
76
+ | **UPDATE** | Existing structure is fine, content is stale | Keep file paths + headings, refresh content + add missing sections |
122
77
 
123
- 2. **Ask the user**:
124
- ```
125
- How would you like to proceed with the docs?
126
-
127
- 1. Refactor - Restructure docs into the standard template (docs/README.md, business.md, architecture.md, use-cases/) and relink everything
128
- 2. Update & Link only - Keep the current docs structure as-is, only update content and fix linking
129
-
130
- (Choose 1 or 2)
131
- ```
132
-
133
- 3. **Based on the choice, set the mode for Phase 2**:
134
- - **REFACTOR mode (choice 1)**: Run Phase 2 GENERATE in full - create new structure, migrate useful content from old docs into the new template, remove/replace old doc files that are no longer needed
135
- - **UPDATE mode (choice 2)**: Run Phase 2 in update-only mode - preserve existing file/folder structure, only update content inside existing files to match current code, add/fix links between files, add mermaid diagrams where missing, DO NOT move/rename/delete existing files
78
+ If the user is unsure: default to **UPDATE** (less destructive).
136
79
 
137
80
  ### Gate
138
- - [ ] User has chosen a mode (REFACTOR or UPDATE)
139
- - [ ] Mode is recorded for Phase 2 to handle accordingly
81
+ - [ ] User confirmed mode
82
+ - [ ] If REFACTOR: explicit OK to remove old files
140
83
 
141
84
  ---
142
85
 
143
86
  ## Phase 2: GENERATE
144
87
 
145
- **Goal**: Generate all documentation files based on the selected mode from Phase 1.5
146
-
147
- ### Mode Selection
88
+ **Goal:** produce the target `docs/` tree.
148
89
 
149
- - **REFACTOR mode**: Create an entirely new docs structure following the template below. If old docs exist, migrate useful content into the new structure. May remove/replace old files.
150
- - **UPDATE mode**: Preserve the existing file/folder structure. Only perform:
151
- - Update content in existing doc files to match current code
152
- - Add/fix links between files (relative links)
153
- - Add mermaid diagrams to existing files where missing
154
- - Add new files ONLY when there are undocumented use cases/features
155
- - DO NOT move, rename, or delete existing files
156
- - Ensure there is 1 index file (README.md or existing index) linking to all docs
157
-
158
- > **The templates below apply fully to REFACTOR mode. For UPDATE mode, use them as content/format reference only — do NOT force the structure.**
159
-
160
- ### Output Structure
90
+ ### Target structure (REFACTOR mode)
161
91
 
162
92
  ```
163
93
  docs/
164
- ├── README.md # Index - links to all sub-files
165
- ├── business.md # Business overview - non-technical, business language only
166
- ├── architecture.md # Architecture overview + system diagram
167
- └── use-cases/
168
- ├── [use-case-1].md # Use case doc + sequence diagram
169
- ├── [use-case-2].md # Use case doc + sequence diagram
170
- └── [use-case-N].md # Use case doc + sequence diagram
171
- ```
172
-
173
- ### 2.1 Generate `docs/README.md` (Index)
174
-
175
- ```markdown
176
- # [Project Name] Documentation
177
-
178
- > Auto-generated documentation synced from codebase.
179
-
180
- ## Overview
181
-
182
- [1-2 paragraph project description derived from codebase]
183
-
184
- ## Table of Contents
185
-
186
- ### Business
187
- - [Business Overview](./business.md) - Business overview, goals, target users
188
-
189
- ### Architecture
190
- - [Architecture Overview](./architecture.md) - System architecture, layers, and patterns
191
-
192
- ### Use Cases
193
- - [Use Case 1](./use-cases/use-case-1.md) - [brief description]
194
- - [Use Case 2](./use-cases/use-case-2.md) - [brief description]
195
- - [Use Case N](./use-cases/use-case-n.md) - [brief description]
196
-
197
- ## Tech Stack
198
-
199
- | Component | Technology |
200
- |-----------|-----------|
201
- | Language | [language] |
202
- | Framework | [framework] |
203
- | Database | [database] |
204
- | Other | [key deps] |
205
-
206
- ## Quick Links
207
-
208
- - [Business Overview](./business.md)
209
- - [Architecture Diagram](./architecture.md#system-diagram)
210
- - [Use Case Diagrams](./use-cases/)
211
- ```
212
-
213
- ### 2.2 Generate `docs/business.md` (Business Overview)
214
-
215
- This file is written entirely in business language. NO code, NO class/function names, NO technical jargon. Target audience: stakeholders, product owners, business analysts - people who don't need to know the code.
216
-
217
- ```markdown
218
- # [Project Name] - Business Overview
219
-
220
- ## What is this product?
221
-
222
- [2-3 paragraphs describing the product in everyday language. Explain what problem it solves, for whom, and why it's needed.]
223
-
224
- ## Target Users
225
-
226
- ### [Role 1] - e.g., End User
227
- - **Who**: [description]
228
- - **Needs**: [what they need from the product]
229
- - **What they do**: [key actions on the system]
230
-
231
- ### [Role 2] - e.g., Administrator
232
- - **Who**: [description]
233
- - **Needs**: [what they need]
234
- - **What they do**: [key actions on the system]
235
-
236
- ## Core Business Processes
237
-
238
- ### [Process 1] - e.g., Registration and first-time use
239
- [Describe each step from the user's perspective. No mention of API, database, or any technical details.]
240
-
241
- 1. [Step 1 - what the user does]
242
- 2. [Step 2 - how the system responds]
243
- 3. [Step N]
244
-
245
- ### [Process 2] - e.g., Placing an order
246
- [Same approach - describe from a business perspective]
247
-
248
- ## Key Features
249
-
250
- | Feature | Description | Used by |
251
- |---------|-------------|---------|
252
- | [Feature 1] | [explain in business language] | [role] |
253
- | [Feature 2] | [explain] | [role] |
254
-
255
- ## Business Rules
256
-
257
- Key rules the system follows:
258
-
259
- 1. **[Rule 1]**: [explain - e.g., "Every order must contain at least 1 product"]
260
- 2. **[Rule 2]**: [explain - e.g., "Users can only request a refund within 7 days"]
261
- 3. **[Rule N]**: [explain]
262
-
263
- ## Business Entity Relationships
264
-
265
- [Describe key relationships in plain text, e.g.:]
266
- - A **customer** can create multiple **orders**
267
- - An **order** contains multiple **products**
268
- - A **product** belongs to a **category**
269
-
270
- ## Value Flow
271
-
272
- [Describe how the product creates value for each stakeholder:]
273
-
274
- - **For [role 1]**: [value they receive]
275
- - **For [role 2]**: [value they receive]
276
- - **For the business**: [value the business receives]
277
-
278
- ## Business Glossary
279
-
280
- | Term | Definition |
281
- |------|-----------|
282
- | [Term 1] | [explain in the product's context] |
283
- | [Term 2] | [explain] |
284
- ```
285
-
286
- **IMPORTANT rules for business.md**:
287
- - DO NOT use words like: API, endpoint, database, repository, controller, service, model, schema, query, migration, route, middleware, component, module, class, function, method, interface, type
288
- - NO code blocks whatsoever
289
- - NO file path references or code file names
290
- - Write as if explaining to someone who doesn't know programming
291
- - Use the project's business domain language (e.g., "order" instead of "Order entity", "user" instead of "User model")
292
- - Extract business rules from code logic (validation, conditions, constraints) and express them in business language
293
-
294
- ### 2.3 Generate `docs/architecture.md` (Technical)
295
-
296
- ```markdown
297
- # Architecture Overview
298
-
299
- ## System Diagram
300
-
301
- \`\`\`mermaid
302
- graph TB
303
- [Generate actual system architecture diagram based on codebase layers]
304
- \`\`\`
305
-
306
- ## Layers
307
-
308
- ### [Layer 1 Name]
309
- - **Location**: `[directory path]`
310
- - **Responsibility**: [what this layer does]
311
- - **Key Files**: [list important files]
312
-
313
- ### [Layer 2 Name]
314
- [same structure]
315
-
316
- ## Directory Structure
317
-
318
- \`\`\`
319
- [actual project directory tree with annotations]
320
- \`\`\`
321
-
322
- ## Dependencies Between Layers
323
-
324
- \`\`\`mermaid
325
- graph LR
326
- [Show dependency direction between layers]
327
- \`\`\`
328
-
329
- ## Design Patterns Used
330
- - [Pattern 1]: [where and why]
331
- - [Pattern 2]: [where and why]
332
-
333
- ## Data Flow
334
-
335
- \`\`\`mermaid
336
- flowchart LR
337
- [Show how data flows through the system]
338
- \`\`\`
339
- ```
340
-
341
- ### 2.4 Generate Use Case Files (`docs/use-cases/[name].md`)
342
-
343
- Generate ONE file per use case:
344
-
345
- ```markdown
346
- # [Use Case Name]
347
-
348
- ## Overview
349
-
350
- [Description of what this use case does from user perspective]
351
-
352
- ## Actors
353
- - [Actor 1]: [role]
354
- - [Actor 2]: [role]
355
-
356
- ## Flow
357
-
358
- ### Main Flow
359
-
360
- 1. [Step 1]
361
- 2. [Step 2]
362
- 3. [Step N]
363
-
364
- ### Sequence Diagram
365
-
366
- \`\`\`mermaid
367
- sequenceDiagram
368
- participant [Actor]
369
- participant [Component1]
370
- participant [Component2]
371
- participant [DataStore]
372
-
373
- [Actor]->>[Component1]: [action]
374
- [Component1]->>[Component2]: [action]
375
- [Component2]->>[DataStore]: [action]
376
- [DataStore]-->>[Component2]: [response]
377
- [Component2]-->>[Component1]: [response]
378
- [Component1]-->>[Actor]: [response]
379
- \`\`\`
380
-
381
- ## Related Files
382
-
383
- | File | Purpose |
384
- |------|---------|
385
- | `[path/to/file]` | [what it does in this use case] |
386
- | `[path/to/file]` | [what it does in this use case] |
387
-
388
- ## Error Cases
389
-
390
- | Error | Cause | Handling |
391
- |-------|-------|----------|
392
- | [Error 1] | [cause] | [how handled] |
393
-
394
- ## Notes
395
-
396
- - [Any important implementation details]
397
- ```
398
-
399
- ### Generation Rules
400
-
401
- 1. **Diagrams MUST be mermaid** - embedded in markdown, not external files
402
- 2. **Every use case MUST have a sequence diagram** showing the actual flow through code
403
- 3. **Architecture MUST have a system diagram** showing layers/components
404
- 4. **README MUST link to every sub-file** with working relative links
405
- 5. **Use actual file paths** from codebase, not placeholders
406
- 6. **Use actual class/function names** from codebase
407
- 7. **If existing docs/ folder has content**, merge/update rather than overwrite useful information
94
+ ├── README.md # Index linking to everything below
95
+ ├── business.md # WHAT the system does, for non-engineers
96
+ ├── architecture.md # HOW it's structured (layers + domains + tech)
97
+ ├── use-cases/
98
+ ├── README.md # Index of use cases
99
+ ├── <use-case-1>.md # One file per user-facing flow, with sequence diagram
100
+ └── ...
101
+ ├── api.md # If service has external API
102
+ └── runbook.md # How to run / deploy / debug
103
+ ```
104
+
105
+ ### File rules
106
+
107
+ **`docs/README.md`** — index only (≤30 lines).
108
+ - One-line description, link to each sub-doc, last-updated timestamp.
109
+
110
+ **`docs/business.md`** — for non-engineers.
111
+ - NO API endpoints, NO code blocks, NO file paths
112
+ - Cover: what problem this solves, who uses it, key user journeys (named like a PRD), success metrics
113
+ - Plain language, no jargon
114
+
115
+ **`docs/architecture.md`** — for engineers.
116
+ - Layer diagram (mermaid)
117
+ - Domain list with 1-line responsibility
118
+ - Cross-domain communication pattern
119
+ - Tech decisions (DB, queue, cache, auth — with rationale)
120
+ - Link to `~/.claude/architecture/<stack>.md` for layer rules
121
+
122
+ **`docs/use-cases/<name>.md`** one per flow.
123
+ - Trigger (who, what action)
124
+ - Preconditions
125
+ - Sequence diagram (mermaid `sequenceDiagram`) showing actor → handler → usecase → infra → response
126
+ - Postconditions / side effects (events raised, notifications sent)
127
+ - Errors (each with HTTP code + meaning)
128
+
129
+ **`docs/api.md`** only if external API exists.
130
+ - Auth, base URL, error format, pagination — then endpoint table
131
+ - For deep API ref, link to OpenAPI spec
132
+
133
+ **`docs/runbook.md`** for ops / on-call.
134
+ - Local dev (≤5 commands)
135
+ - Deploy steps
136
+ - Common failures + how to recover
137
+ - Monitoring dashboards + log queries
138
+
139
+ ### Mermaid rules
140
+
141
+ - Sequence diagrams for use cases
142
+ - Class diagrams only when ER is non-obvious
143
+ - Validate syntax: `mermaid-cli` if available, otherwise eyeball test
144
+ - ≤7 actors per sequence (split if more)
408
145
 
409
146
  ### Gate
410
- - [ ] docs/README.md generated with all links
411
- - [ ] docs/business.md generated with pure business language (no technical terms)
412
- - [ ] docs/architecture.md generated with system diagram
413
- - [ ] All use case files generated with sequence diagrams
414
- - [ ] All links are relative and correct
415
- - [ ] All diagrams use mermaid syntax
147
+ - [ ] All target files written
148
+ - [ ] business.md has zero code / endpoints
149
+ - [ ] Every use case has a sequence diagram
150
+ - [ ] README.md links to every file
151
+ - [ ] All file paths in docs resolve (no broken references)
416
152
 
417
153
  ---
418
154
 
419
- ## Phase 3: REVIEW (Automated Loop)
420
-
421
- **Goal**: Verify generated docs are complete and accurate. Loop back to GENERATE if issues found.
155
+ ## Phase 3: REVIEW LOOP (≤3 iterations)
422
156
 
423
- ### Review Checklist
157
+ **Goal:** auto-check + fix until docs pass.
424
158
 
425
- Run through ALL checks below. If ANY check fails, fix and re-check.
159
+ For each iteration:
426
160
 
427
- #### 3.1 Structure Check
428
- - [ ] `docs/README.md` exists and has all links
429
- - [ ] `docs/business.md` exists
430
- - [ ] `docs/architecture.md` exists with system diagram
431
- - [ ] Each identified use case has its own file in `docs/use-cases/`
432
- - [ ] All relative links in README.md point to existing files
161
+ ### 3.1 Structure
162
+ - [ ] All target files exist
163
+ - [ ] README.md links resolve
164
+ - [ ] No duplicate content across files
433
165
 
434
- #### 3.2 Business Check
435
- - [ ] `docs/business.md` contains NO technical jargon (API, endpoint, database, repository, controller, service, model, schema, query, migration, route, middleware, component, module, class, function, method, interface, type)
436
- - [ ] `docs/business.md` has NO code blocks
437
- - [ ] `docs/business.md` does NOT reference file paths
438
- - [ ] Business processes are fully described from the user's perspective
439
- - [ ] Business rules are correctly extracted from code logic
440
- - [ ] Glossary contains all domain-specific terms
166
+ ### 3.2 Business
167
+ - [ ] business.md uses plain language (no `API`, `JSON`, `class`, file paths)
168
+ - [ ] business.md covers all top-level user journeys
441
169
 
442
- #### 3.3 Content Check
443
- - [ ] Architecture diagram reflects actual codebase layers
444
- - [ ] Each use case sequence diagram matches actual code flow
445
- - [ ] File paths referenced in docs actually exist in codebase
446
- - [ ] Class/function names in diagrams match actual code
447
- - [ ] No placeholder text like `[TODO]`, `[TBD]`, `[placeholder]`
448
- - [ ] No template markers like `{name}`, `[name]` left unfilled
170
+ ### 3.3 Architecture
171
+ - [ ] Layer diagram matches actual code structure
172
+ - [ ] Every code domain has a row in domain table
449
173
 
450
- #### 3.4 Completeness Check
451
- - [ ] Every major feature/flow has a use case doc
452
- - [ ] Architecture doc covers all layers found in codebase
453
- - [ ] README links to ALL generated sub-files
454
- - [ ] Diagrams are syntactically valid mermaid
174
+ ### 3.4 Use cases
175
+ - [ ] One file per identified use case (Phase 1)
176
+ - [ ] Each has trigger / preconditions / sequence / postconditions / errors
177
+ - [ ] Sequence diagrams render
455
178
 
456
- #### 3.5 Consistency Check
457
- - [ ] Naming is consistent across all docs
458
- - [ ] Same component uses same name everywhere
459
- - [ ] File naming convention is consistent (kebab-case)
179
+ ### 3.5 Consistency
180
+ - [ ] Same terminology everywhere (e.g., "domain" vs "module")
181
+ - [ ] No file paths referenced that don't exist
182
+ - [ ] No endpoints referenced that don't exist in code
460
183
 
461
- ### Review Process
462
-
463
- ```
464
- FOR each check in checklist:
465
- IF check FAILS:
466
- 1. Note the issue
467
- 2. Fix it (go back to relevant GENERATE sub-step)
468
- 3. Re-run ALL checks from the beginning
469
- IF all checks PASS:
470
- Proceed to Phase 4
471
- ```
472
-
473
- ### Review Output
474
- ```markdown
475
- ## Review Results - Iteration [N]
476
-
477
- ### Checks Passed: [X/total]
478
- ### Checks Failed: [Y/total]
479
-
480
- ### Issues Found
481
- 1. [issue] → [fix applied]
482
- 2. [issue] → [fix applied]
483
-
484
- ### Status: [PASS - proceed to Phase 4 / FAIL - re-running Phase 2]
485
- ```
486
-
487
- **IMPORTANT**: Do NOT proceed to Phase 4 until ALL checks pass. Maximum 3 iterations - if still failing after 3 loops, report remaining issues and proceed.
184
+ ### Loop
185
+ - If any check fails → fix that section, restart the relevant subset of checks
186
+ - Max 3 iterations; if still failing → report what's blocking + ask user
488
187
 
489
188
  ---
490
189
 
491
190
  ## Phase 4: COMPLETE
492
191
 
493
- **Goal**: Final output and summary
494
-
495
- ### Actions
496
-
497
- 1. **List all generated files**:
498
- ```bash
499
- find docs/ -name "*.md" | sort
500
- ```
501
-
502
- 2. **Print summary**:
503
- ```markdown
504
- ## Sync Docs Complete
505
-
506
- ### Generated Files
507
- - docs/README.md (index)
508
- - docs/business.md (business overview)
509
- - docs/architecture.md
510
- - docs/use-cases/[list all]
511
-
512
- ### Use Cases Documented: [count]
513
- ### Diagrams Generated: [count]
514
- ### Review Iterations: [count]
515
-
516
- ### How to Use
517
- Start at `docs/README.md` - it links to everything.
518
- ```
519
-
520
- 3. **Read the docs/ folder one final time** to confirm everything is in order
521
-
522
- ### Gate
523
- - [ ] All files verified
524
- - [ ] Summary provided
525
- - [ ] User informed of output location
526
-
527
- ---
528
-
529
- ## Recommended Agents
192
+ ```markdown
193
+ ## Docs Sync Complete
530
194
 
531
- | Phase | Agent | Purpose |
532
- |-------|-------|---------|
533
- | SCAN | `@clean-architect` | Identify architecture patterns |
534
- | SCAN | `@code-reviewer` | Understand code structure |
535
- | GENERATE | `@docs-writer` | Write documentation |
536
- | REVIEW | `@code-reviewer` | Verify accuracy |
195
+ ### Mode: {REFACTOR / UPDATE}
537
196
 
538
- ---
197
+ ### Files
198
+ - Created: {N}
199
+ - Updated: {N}
200
+ - Deleted: {N — REFACTOR mode only}
539
201
 
540
- ## Quick Reference
202
+ ### Coverage
203
+ - Domains documented: {N/N}
204
+ - Use cases documented: {N/N}
205
+ - Diagrams: {N}
541
206
 
542
- ### Trigger Phrases
543
- - "sync docs"
544
- - "sync documentation"
545
- - "generate structured docs"
546
- - "update docs sync"
547
- - "create docs from codebase"
548
- - "doc sync"
207
+ ### Review iterations: {1/2/3}
549
208
 
550
- ### Output Structure
551
- ```
552
- docs/
553
- ├── README.md # Index with links
554
- ├── business.md # Business overview (non-technical)
555
- ├── architecture.md # System overview + diagram
556
- └── use-cases/
557
- └── *.md # One per use case + sequence diagram
209
+ ### Next steps for the team
210
+ - Review `docs/business.md` with product
211
+ - Validate `docs/use-cases/*.md` flows with team leads
212
+ - Set up doc lint in CI (broken-link checker)
558
213
  ```
559
214
 
560
- ### Diagram Types Used
561
- | Where | Diagram Type | Purpose |
562
- |-------|-------------|---------|
563
- | architecture.md | `graph TB` | System architecture |
564
- | architecture.md | `graph LR` | Layer dependencies |
565
- | architecture.md | `flowchart LR` | Data flow |
566
- | use-cases/*.md | `sequenceDiagram` | Use case flow |
567
-
568
- ### Review Loop
569
- ```
570
- Scan → Confirm (Refactor/Update?) → Generate → Review → Pass? → Complete
571
- → Fail? → Fix → Review again (max 3x)
572
- ```
215
+ ---
573
216
 
574
- ## Success Criteria
217
+ ## Hard Rules
575
218
 
576
- Documentation sync is complete when:
577
- 1. Business overview written entirely in business language, no technical jargon
578
- 2. All codebase features are documented as use cases
579
- 3. Architecture accurately reflects codebase
580
- 4. Every use case has a sequence diagram
581
- 5. README.md links to all sub-files
582
- 6. All file paths and names match actual codebase
583
- 7. All mermaid diagrams are valid
584
- 8. Review loop passed all checks
219
+ - **business.md is for humans** — strip jargon, no code, no file paths
220
+ - **architecture.md links to canonical rules**, doesn't duplicate them
221
+ - **One use case per file** easier to update, easier to review
222
+ - **Mermaid only if it renders** — broken diagrams worse than no diagrams
223
+ - **REFACTOR mode requires explicit user OK** — never delete docs without confirmation
224
+ - **Max 3 review iterations** — beyond that, the prompt or scope is the problem, not the docs
585
225
 
586
226
  ---
587
227
 
@@ -589,17 +229,17 @@ Documentation sync is complete when:
589
229
 
590
230
  | When | Use |
591
231
  |------|-----|
592
- | Authoring a single doc by hand | `/docs:write` |
593
- | Onboarding self / a new dev to the project | `/research:onboarding` |
594
- | Adding only an endpoint's doc | `/feature:api` Phase 4 |
595
- | The architecture itself needs a review | `/review:architect` |
232
+ | Author single doc by hand | `/docs:write` |
233
+ | Onboard self / new dev | `/research:onboarding` |
234
+ | Doc only one new endpoint | `/feature:api` Phase 4 |
235
+ | Architecture itself needs review | `/review:architect` |
596
236
 
597
237
  ## Recommended Agents
598
238
 
599
239
  | Phase | Agent | Purpose |
600
240
  |-------|-------|---------|
601
- | SCAN | `@clean-architect` | Identify domains and patterns |
241
+ | SCAN | `@clean-architect` | Identify domains + patterns |
602
242
  | GENERATE | `@docs-writer` | Write all doc files |
603
243
  | GENERATE | `@api-designer` | API reference accuracy |
604
- | GENERATE | `@db-designer` | Data model doc |
605
- | REVIEW | `@code-reviewer` | Verify code references resolve |
244
+ | GENERATE | `@db-designer` | Data model accuracy |
245
+ | REVIEW | `@code-reviewer` | Verify code refs resolve |