moicle 2.3.1 → 3.0.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 (32) hide show
  1. package/README.md +36 -49
  2. package/assets/commands/marketing.md +6 -6
  3. package/assets/skills/docs/sync/SKILL.md +195 -157
  4. package/assets/skills/feature/build/SKILL.md +891 -0
  5. package/assets/skills/feature/track/SKILL.md +8 -8
  6. package/assets/skills/fix/bug/SKILL.md +449 -0
  7. package/assets/skills/fix/incident/SKILL.md +6 -6
  8. package/assets/skills/marketing/brand/SKILL.md +304 -0
  9. package/assets/skills/marketing/content/SKILL.md +199 -141
  10. package/assets/skills/research/explore/SKILL.md +392 -0
  11. package/assets/skills/review/code/SKILL.md +622 -0
  12. package/dist/commands/install/usage.js +2 -2
  13. package/dist/commands/install/usage.js.map +1 -1
  14. package/package.json +1 -1
  15. package/assets/skills/docs/write/SKILL.md +0 -274
  16. package/assets/skills/feature/api/SKILL.md +0 -277
  17. package/assets/skills/feature/deprecate/SKILL.md +0 -276
  18. package/assets/skills/feature/new/SKILL.md +0 -273
  19. package/assets/skills/feature/refactor/SKILL.md +0 -269
  20. package/assets/skills/fix/hotfix/SKILL.md +0 -233
  21. package/assets/skills/fix/pr-comment/SKILL.md +0 -186
  22. package/assets/skills/fix/root-cause/SKILL.md +0 -276
  23. package/assets/skills/marketing/logo/SKILL.md +0 -252
  24. package/assets/skills/marketing/seo-blog/SKILL.md +0 -367
  25. package/assets/skills/marketing/video/SKILL.md +0 -258
  26. package/assets/skills/research/onboarding/SKILL.md +0 -225
  27. package/assets/skills/research/spike/SKILL.md +0 -228
  28. package/assets/skills/research/web/SKILL.md +0 -204
  29. package/assets/skills/review/architect/SKILL.md +0 -274
  30. package/assets/skills/review/branch/SKILL.md +0 -277
  31. package/assets/skills/review/pr/SKILL.md +0 -231
  32. package/assets/skills/review/tdd/SKILL.md +0 -245
package/README.md CHANGED
@@ -16,7 +16,7 @@ A toolkit to bootstrap and accelerate project development with Claude Code throu
16
16
 
17
17
  - **16 AI Agents** - 6 developer agents + 10 utility agents
18
18
  - **4 Commands** - Wizards for bootstrap, brainstorm, documentation, and marketing
19
- - **22 Skills** - Auto-triggered workflows for the full SDLC (feature, bug, review, release, ops, content)
19
+ - **9 Skills** - Mode-based, auto-triggered workflows for the full SDLC (feature, bug, review, research, docs, marketing)
20
20
  - **9 Architecture References** - DDD + Hexagonal + stack-specific patterns
21
21
 
22
22
 
@@ -124,82 +124,69 @@ moicle install --target cursor --project
124
124
  | `/brainstorm` | Brainstorm ideas with 6 frameworks |
125
125
  | `/doc` | Scan project and generate documentation |
126
126
 
127
- ### Skills (22)
127
+ ### Skills (9)
128
128
 
129
- Skills are grouped by a `<group>-` prefix. Type `/<group>-` then `Tab` in Claude Code to see all skills in a group.
129
+ Skills are grouped by a `<group>-` prefix. Type `/<group>-` then `Tab` in Claude Code to see all skills in a group. Each skill bundles several related workflows into **modes** chosen at the top of the file — pick a mode (or let Claude pick it from your natural-language phrasing).
130
130
 
131
131
  **`/feature-*` — Build & Change**
132
132
 
133
- | Skill | When to use |
134
- |-------|-------------|
135
- | `/feature-new` | Build a new feature end-to-end following DDD |
136
- | `/feature-refactor` | Restructure existing module to DDD or improve internals |
137
- | `/feature-api` | Add a new endpoint or integrate an external API |
138
- | `/feature-deprecate` | Safely sunset a feature, API, or module |
139
- | `/feature-track` | Plan + approve, then run a tracked loop: branch → checklist → per-item test/implement/verify/commit |
133
+ | Skill | Modes | When to use |
134
+ |-------|-------|-------------|
135
+ | `/feature-build` | NEW · REFACTOR · API · DEPRECATE | Build a new DDD feature, restructure existing code, add/integrate an API, or safely sunset a feature |
136
+ | `/feature-track` | | Plan + approve, then run a tracked loop: branch → checklist → per-item test/implement/verify/commit |
140
137
 
141
138
  **`/fix-*` — Bugs & Incidents**
142
139
 
143
- | Skill | When to use |
144
- |-------|-------------|
145
- | `/fix-hotfix` | Fix a bug fast with a rollback plan |
146
- | `/fix-root-cause` | Hard-to-trace bug that has been "fixed" multiple times |
147
- | `/fix-incident` | Production outage / on-call workflow |
148
- | `/fix-pr-comment` | Address review comments on an existing PR |
140
+ | Skill | Modes | When to use |
141
+ |-------|-------|-------------|
142
+ | `/fix-bug` | QUICK · DEEP | QUICK: fix fast with rollback plan · DEEP: trace a hard / recurring / intermittent bug |
143
+ | `/fix-incident` | | Production outage / on-call workflow |
149
144
 
150
145
  **`/review-*` — Review & Quality**
151
146
 
152
- | Skill | When to use |
153
- |-------|-------------|
154
- | `/review-branch` | Self-review your branch BEFORE pushing / opening PR |
155
- | `/review-pr` | Review someone else's open PR |
156
- | `/review-architect` | DDD compliance check (called by `/feature-new` / `/feature-refactor`) |
157
- | `/review-tdd` | Drive implementation with test-first discipline |
147
+ | Skill | Modes | When to use |
148
+ |-------|-------|-------------|
149
+ | `/review-code` | SELF · PR · ARCHITECT · TDD · ADDRESS | Self-review a branch, review a teammate's PR, deep DDD audit, test-first development, or address PR comments |
158
150
 
159
151
  **`/research-*` — Explore & Learn**
160
152
 
161
- | Skill | When to use |
162
- |-------|-------------|
163
- | `/research-web` | Search the web for solutions / best practices |
164
- | `/research-spike` | Time-boxed prototype to learn / decide |
165
- | `/research-onboarding` | Get up to speed on a new codebase |
153
+ | Skill | Modes | When to use |
154
+ |-------|-------|-------------|
155
+ | `/research-explore` | WEB · SPIKE · ONBOARDING | Research solutions via docs, validate by building a prototype, or ramp up on a new codebase |
166
156
 
167
157
  **`/docs-*` — Project Documentation**
168
158
 
169
- | Skill | When to use |
170
- |-------|-------------|
171
- | `/docs-write` | Author docs manually (README / API / ARCH / CONTRIB) |
172
- | `/docs-sync` | Auto-generate structured docs from codebase with review loop |
159
+ | Skill | Modes | When to use |
160
+ |-------|-------|-------------|
161
+ | `/docs-sync` | SINGLE · FULL | SINGLE: hand-author one doc · FULL: auto-generate the whole docs site with review loop |
173
162
 
174
163
  **`/marketing-*` — Brand & Content** (wrapped by the `/marketing` command)
175
164
 
176
- | Skill | When to use |
177
- |-------|-------------|
178
- | `/marketing-content` | Multi-post content strategy (pillars, calendar, channels) |
179
- | `/marketing-seo-blog` | Write ONE evergreen blog post optimized for Search + AI tools |
180
- | `/marketing-logo` | Logo + brand identity specification |
181
- | `/marketing-video` | Video script, storyboard, production plan |
165
+ | Skill | Modes | When to use |
166
+ |-------|-------|-------------|
167
+ | `/marketing-content` | STRATEGY · POST | Multi-post content strategy, or write ONE evergreen post optimized for Search + AI |
168
+ | `/marketing-brand` | LOGO · VIDEO | Logo + brand identity spec, or video script/storyboard/production plan |
182
169
 
183
170
  ### Skill decision matrix
184
171
 
185
- When more than one skill could fit, use this matrix:
172
+ When more than one skill / mode could fit, use this matrix:
186
173
 
187
174
  | Situation | Use | Not |
188
175
  |-----------|-----|-----|
189
- | Bug just happened in prod, need fix in <1h | `/fix-hotfix` | `/fix-root-cause` (too slow) |
190
- | Bug keeps coming back after "fixes" | `/fix-root-cause` | `/fix-hotfix` (will repeat) |
191
- | About to push / open PR | `/review-branch` | `/review-pr` (that's for others') |
192
- | Reviewing teammate's PR | `/review-pr` | `/review-branch` (that's for own branch) |
193
- | Want to verify DDD compliance only | `/review-architect` | `/review-pr` (broader scope) |
194
- | Don't know the right solution yet | `/research-web` | `/research-spike` (skip if you can decide from docs) |
195
- | Need to validate an idea by building | `/research-spike` | `/feature-new` (commit only after spike) |
196
- | Driving a multi-step task as a checklist with commit-per-step | `/feature-track` | `/feature-new` (single full DDD feature), `/review-tdd` (one unit, no branch/commit) |
197
- | Writing README / API docs by hand | `/docs-write` | `/docs-sync` (overkill for single file) |
198
- | Generating full docs site from codebase | `/docs-sync` | `/docs-write` (manual is slower) |
176
+ | Bug just happened in prod, need fix in <1h | `/fix-bug` (QUICK) | `/fix-bug` DEEP (too slow) |
177
+ | Bug keeps coming back after "fixes" | `/fix-bug` (DEEP) | `/fix-bug` QUICK (will repeat) |
178
+ | About to push / open PR | `/review-code` (SELF) | `/review-code` PR (that's for others') |
179
+ | Reviewing teammate's PR | `/review-code` (PR) | `/review-code` SELF (that's for own branch) |
180
+ | Want to verify DDD compliance only | `/review-code` (ARCHITECT) | `/review-code` PR (broader scope) |
181
+ | Don't know the right solution yet | `/research-explore` (WEB) | SPIKE (skip if you can decide from docs) |
182
+ | Need to validate an idea by building | `/research-explore` (SPIKE) | `/feature-build` NEW (commit only after spike) |
183
+ | Driving a multi-step task as a checklist with commit-per-step | `/feature-track` | `/feature-build` NEW (single full DDD feature), `/review-code` TDD (one unit, no branch/commit) |
184
+ | Writing README / API docs by hand | `/docs-sync` (SINGLE) | `/docs-sync` FULL (overkill for single file) |
185
+ | Generating full docs site from codebase | `/docs-sync` (FULL) | `/docs-sync` SINGLE (manual is slower) |
199
186
 
200
187
  ### Backward compatibility
201
188
 
202
- Old trigger phrases still work — they're kept in the skill `description` so Claude auto-invokes the right skill when the user says e.g. "deep debug", "hotfix", "review changes". The flattened name `/group-action` is the explicit invocation form.
189
+ The 22 original skills were consolidated into 9 mode-based skills. Old trigger phrases still work — they're kept in each skill's `description` so Claude auto-invokes the right skill **and the right mode** when the user says e.g. "deep debug" (→ `/fix-bug` DEEP), "hotfix" (→ `/fix-bug` QUICK), "review changes" (→ `/review-code` SELF). The flattened name `/group-action` is the explicit invocation form.
203
190
 
204
191
  ## Architecture-First Approach
205
192
 
@@ -30,10 +30,10 @@ Let the user choose which areas to focus on:
30
30
  Which marketing areas do you want to plan?
31
31
 
32
32
  1. Logo & Brand Identity — Design logo, colors, typography, brand guidelines
33
- Triggers skill: /marketing-logo
33
+ Triggers skill: /marketing-brand (LOGO mode)
34
34
 
35
35
  2. Video Content Strategy — Plan video series, scripts, production, publishing
36
- Triggers skill: /marketing-video
36
+ Triggers skill: /marketing-brand (VIDEO mode)
37
37
 
38
38
  3. Content Writing Strategy — Blog posts, social media, SEO, newsletter
39
39
  Triggers skill: /marketing-content
@@ -55,19 +55,19 @@ MARKETING PLAN WORKFLOW
55
55
 
56
56
  Phase 1: Brand Foundation
57
57
 
58
- ├── Execute: /marketing-logo skill
58
+ ├── Execute: /marketing-brand (LOGO mode)
59
59
  │ └── Output: Brand guidelines, color palette, typography
60
60
 
61
61
 
62
62
  Phase 2: Content Strategy
63
63
 
64
- ├── Execute: /marketing-content skill
64
+ ├── Execute: /marketing-content (STRATEGY mode)
65
65
  │ └── Output: Content pillars, blog plan, social media plan, newsletter
66
66
 
67
67
 
68
68
  Phase 3: Video Content
69
69
 
70
- ├── Execute: /marketing-video skill
70
+ ├── Execute: /marketing-brand (VIDEO mode)
71
71
  │ └── Output: Video series, scripts, production specs, calendar
72
72
 
73
73
 
@@ -85,7 +85,7 @@ Phase 5: Launch Plan
85
85
 
86
86
  ### Execution Notes:
87
87
  - Run skills sequentially — brand identity informs content and video decisions
88
- - Pass brand guidelines (colors, voice, tone) from /marketing-logo into /marketing-content and /marketing-video
88
+ - Pass brand guidelines (colors, voice, tone) from /marketing-brand (LOGO) into /marketing-content and /marketing-brand (VIDEO)
89
89
  - Ensure consistency across all outputs
90
90
 
91
91
  ## Step 4: Create Unified Calendar
@@ -1,70 +1,189 @@
1
1
  ---
2
2
  name: docs-sync
3
- description: Sync documentation workflow - reads codebase and docs folder to generate structured output docs with architecture, use cases, diagrams, and README index. Includes automated review loop. Use when user says "sync docs", "sync documentation", "generate docs", "update docs sync", "doc sync".
3
+ description: Documentation workflow with two modes — SINGLE (hand-author a specific doc like README/API.md/ARCHITECTURE.md with full control over voice) and FULL (auto-generate the whole docs/ site — business, architecture, use-cases with sequence diagrams, README index with a 3-iteration review loop). Use when user says "document", "generate docs", "write docs", "create documentation", "update docs", "sync docs", "sync documentation", "doc sync".
4
+ args: "[MODE]"
4
5
  ---
5
6
 
6
- # Sync Docs Workflow
7
+ # Documentation Workflow
7
8
 
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
+ One skill, two depths: hand-author a single doc, or batch-generate a whole docs site.
9
10
 
10
- ## When to use this skill
11
+ ## Pick your mode
11
12
 
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
- - Authoring a single doc by hand (README / API.md only) → use `/docs-write`
16
- - ❌ Understand the codebase, not document it → use `/research-onboarding`
17
- - ❌ Adding doc for one endpoint → use `/feature-api` Phase 4
13
+ | Situation | Mode | Jump to |
14
+ |-----------|------|---------|
15
+ | Authoring / updating a specific doc with opinionated prose | **SINGLE** | [Mode SINGLE](#mode-single) |
16
+ | Re-generating the whole `docs/` site from current code | **FULL** | [Mode FULL](#mode-full) |
17
+
18
+ - ❌ Just need API reference from OpenAPI → use `/feature-build` (API mode), Phase 4
19
+ - ❌ Understand the codebase, not document it → use `/research-explore` (ONBOARDING)
18
20
 
19
- ## Read Architecture First
21
+ ## Read Architecture First (both modes)
20
22
 
21
- Detect stack via `~/.claude/architecture/_shared/stack-detection.md`. Read `ddd-architecture.md` + stack doc.
23
+ Detect stack via `~/.claude/architecture/_shared/stack-detection.md`. Read `ddd-architecture.md` + the stack doc. Docs must reflect the architecture, not contradict it.
22
24
 
25
+ ---
23
26
  ---
24
27
 
28
+ # Mode SINGLE
29
+
30
+ Hand-author project docs (README, API.md, ARCHITECTURE.md, CONTRIBUTING.md) with full control over voice and structure.
31
+
32
+ ## When to use
33
+ - ✅ Authoring or updating a specific document
34
+ - ✅ Need opinionated prose, not just structure
35
+ - ✅ Doc is small / scoped — a single file or section
36
+ - ❌ Want automated multi-doc generation → **Mode FULL**
37
+
25
38
  ## Workflow
26
39
 
27
40
  ```
28
- SCAN → CONFIRM mode → GENERATE → REVIEW loop (≤3x) → COMPLETE
41
+ SCAN → ANALYZE → GENERATE → REVIEW (loop)
42
+ ```
43
+
44
+ ## Phase 1: SCAN
45
+
46
+ ```bash
47
+ tree -L 3 -I 'node_modules|vendor|dist|build'
48
+ find . -maxdepth 3 -name "*.md" -o -name "README*"
49
+ ```
50
+
51
+ Identify what needs work: README, API.md, ARCHITECTURE.md, CONTRIBUTING.md, setup/deployment/runbook, DB schema, config reference.
52
+
53
+ ### Gate
54
+ - [ ] Architecture doc read · Existing docs inventoried · Gaps identified, priorities set
55
+
56
+ ## Phase 2: ANALYZE
57
+
58
+ For each doc define: **Purpose** (what problem it solves), **Audience** (new contributor / API consumer / on-call), **Source** (which code feeds it).
59
+
60
+ ### Required sections per doc type
61
+
62
+ **README.md** — one-line description + badges · quick start (≤5 commands) · tech stack (link to architecture) · common commands · project structure (top 2 levels) · links to other docs
63
+
64
+ **API.md** — auth method + credentials · base URL per env · per endpoint (method, path, request, response, errors, example) · pagination (one block) · error format (one block) · rate limits, versioning
65
+
66
+ **ARCHITECTURE.md** — one mermaid layer diagram · domain list with 1-line responsibility · cross-domain communication (events) · key tech decisions with rationale · link to `~/.claude/architecture/<stack>.md`
67
+
68
+ **CONTRIBUTING.md** — local dev setup (≤5 steps) · branch + commit conventions · PR flow + review expectations · test commands + coverage · where to ask for help
69
+
70
+ ### Gate
71
+ - [ ] Each doc has purpose, audience, source · Required sections listed · Aligned with architecture doc
72
+
73
+ ## Phase 3: GENERATE
74
+
75
+ ### Rules
76
+ - **Use real code from the repo** — never invent examples
77
+ - **Link to architecture docs**, don't duplicate them
78
+ - **Code blocks must be runnable** — copy verbatim from working files
79
+ - **Diagrams** — mermaid; one per major concept
80
+ - **Tables** for any list with >3 parallel items
81
+
82
+ ### Minimal skeletons
83
+
84
+ **README.md** (≤80 lines for most projects)
85
+ ```markdown
86
+ # {Project Name}
87
+ > One-line value proposition.
88
+ ## Quick Start
89
+ `{install}` then `{run}`
90
+ ## Tech Stack
91
+ - {language + version}, {framework}, {DB / queue} → see [ARCHITECTURE.md](./ARCHITECTURE.md)
92
+ ## Commands
93
+ | Command | Purpose |
94
+ ## Docs
95
+ - [API.md](./API.md) · [ARCHITECTURE.md](./ARCHITECTURE.md) · [CONTRIBUTING.md](./CONTRIBUTING.md)
29
96
  ```
30
97
 
31
- `CONFIRM` asks the user to pick **REFACTOR** (full restructure of `docs/`) or **UPDATE** (keep existing structure, refresh content).
98
+ **API.md** (per-endpoint block)
99
+ ```markdown
100
+ ### POST /resource
101
+ Create a resource. Idempotent via `Idempotency-Key` header.
102
+ **Auth:** Bearer
103
+ **Request** `{ "field": "value" }`
104
+ **Response 201** `{ "id": "...", "field": "value" }`
105
+ **Errors:** `invalid_field` 400 · `unauthorized` 401 · `already_exists` 409
106
+ ```
107
+
108
+ **ARCHITECTURE.md** opener
109
+ ```markdown
110
+ # Architecture
111
+ ## Overview
112
+ {1-2 paragraphs: what this system does, key constraints}
113
+ ## Layers
114
+ ```mermaid
115
+ graph TD
116
+ App[Application] --> Domain
117
+ Domain --> Infra[Infrastructure]
118
+ ```
119
+ See [DDD rules](~/.claude/architecture/ddd-architecture.md) for layer details.
120
+ ## Domains
121
+ | Domain | Responsibility |
122
+ ```
123
+
124
+ **CONTRIBUTING.md** opener
125
+ ```markdown
126
+ # Contributing
127
+ ## Setup
128
+ `{1-5 commands}`
129
+ ## Branch + Commits
130
+ - Branch: `{prefix}/{ticket}-{slug}` · Commit: Conventional Commits
131
+ ## PR Flow
132
+ 1. Open PR vs `{base}` → 2. CI green → 3. ≥1 review approval → 4. Squash merge
133
+ ```
134
+
135
+ ### Gate
136
+ - [ ] All planned docs drafted · Code examples from real files · Diagrams render · Cross-links work
137
+
138
+ ## Phase 4: REVIEW
139
+
140
+ ### Per-doc checklist
141
+ - [ ] Reflects current architecture (not outdated)
142
+ - [ ] All commands run as written (try them)
143
+ - [ ] All file paths exist · All endpoints / functions referenced still exist
144
+ - [ ] Internal + external links resolve · Code blocks compile · Diagrams match code
145
+
146
+ ### Cross-doc consistency
147
+ - [ ] Same terminology everywhere · No duplicated info — link instead
148
+
149
+ ### Loop
150
+ If any issue → return to Phase 3 for that doc, fix, re-review.
32
151
 
152
+ ---
33
153
  ---
34
154
 
35
- ## Phase 1: SCAN
155
+ # Mode FULL
156
+
157
+ 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.
158
+
159
+ ## When to use
160
+ - ✅ Re-generate the whole `docs/` site from current code
161
+ - ✅ Existing docs have drifted; want batch sync with review loop
162
+ - ✅ Project has no structured docs at all
163
+ - ❌ Authoring a single doc by hand → **Mode SINGLE**
164
+ - ❌ Understand the codebase, not document it → `/research-explore` (ONBOARDING)
36
165
 
37
- **Goal:** map codebase + existing docs in one pass.
166
+ ## Workflow
167
+
168
+ ```
169
+ SCAN → CONFIRM mode → GENERATE → REVIEW loop (≤3x) → COMPLETE
170
+ ```
171
+
172
+ ## Phase 1: SCAN
38
173
 
39
174
  ```bash
40
- # Existing docs
41
175
  find . -name "*.md" -not -path "*/node_modules/*" -not -path "*/vendor/*" -not -path "*/.dart_tool/*" | sort
42
176
  ls docs/ 2>/dev/null
43
-
44
- # Code surface
45
177
  tree -L 4 -I 'node_modules|vendor|dist|build|.dart_tool|.git'
46
-
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/
178
+ # Entry points per stack:
179
+ # Go: grep -r "func.*Handler" internal/ · NestJS: grep -r "@Controller\|@Get\|@Post" src/
180
+ # Laravel: cat routes/web.php routes/api.php · Remix: ls app/routes/ · Flutter: grep -r "GoRoute" lib/
53
181
  ```
54
182
 
55
- ### Extract
56
- - Stack + framework
57
- - All domains / modules
58
- - All user-facing flows (endpoints / screens / commands)
59
- - Existing docs structure (if any)
183
+ **Extract:** stack + framework, all domains/modules, all user-facing flows, existing docs structure.
60
184
 
61
185
  ### Gate
62
- - [ ] Stack identified
63
- - [ ] All domains listed
64
- - [ ] All use cases listed (count + brief name)
65
- - [ ] Existing docs inventoried
66
-
67
- ---
186
+ - [ ] Stack identified · All domains listed · All use cases listed (count + name) · Existing docs inventoried
68
187
 
69
188
  ## Phase 1.5: CONFIRM
70
189
 
@@ -72,21 +191,16 @@ Ask the user **explicitly** which mode:
72
191
 
73
192
  | Mode | When to use | Effect |
74
193
  |------|-------------|--------|
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 |
194
+ | **REFACTOR** | Existing docs messy / partial / wrong structure | Restructure `docs/` from scratch, may delete old files |
195
+ | **UPDATE** | Existing structure fine, content stale | Keep file paths + headings, refresh content + add missing sections |
77
196
 
78
- If the user is unsure: default to **UPDATE** (less destructive).
197
+ If unsure: default to **UPDATE** (less destructive).
79
198
 
80
199
  ### Gate
81
- - [ ] User confirmed mode
82
- - [ ] If REFACTOR: explicit OK to remove old files
83
-
84
- ---
200
+ - [ ] User confirmed mode · If REFACTOR: explicit OK to remove old files
85
201
 
86
202
  ## Phase 2: GENERATE
87
203
 
88
- **Goal:** produce the target `docs/` tree.
89
-
90
204
  ### Target structure (REFACTOR mode)
91
205
 
92
206
  ```
@@ -96,150 +210,74 @@ docs/
96
210
  ├── architecture.md # HOW it's structured (layers + domains + tech)
97
211
  ├── use-cases/
98
212
  │ ├── README.md # Index of use cases
99
- ├── <use-case-1>.md # One file per user-facing flow, with sequence diagram
100
- │ └── ...
213
+ └── <use-case>.md # One file per user-facing flow, with sequence diagram
101
214
  ├── api.md # If service has external API
102
215
  └── runbook.md # How to run / deploy / debug
103
216
  ```
104
217
 
105
218
  ### 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
219
+ - **`docs/README.md`** — index only (≤30 lines): one-line description, link to each sub-doc, last-updated timestamp.
220
+ - **`docs/business.md`** — for non-engineers. NO API endpoints, NO code blocks, NO file paths. Cover: what problem this solves, who uses it, key user journeys (named like a PRD), success metrics. Plain language.
221
+ - **`docs/architecture.md`** — for engineers. Layer diagram (mermaid), domain list, cross-domain communication, tech decisions with rationale, link to `~/.claude/architecture/<stack>.md`.
222
+ - **`docs/use-cases/<name>.md`** — one per flow: trigger (who, what), preconditions, sequence diagram (mermaid `sequenceDiagram`: actor → handler → usecase → infra → response), postconditions / side effects, errors (HTTP code + meaning).
223
+ - **`docs/api.md`** — only if external API exists. Auth, base URL, error format, pagination → then endpoint table. Deep ref → link to OpenAPI spec.
224
+ - **`docs/runbook.md`** for ops/on-call: local dev (≤5 commands), deploy steps, common failures + recovery, monitoring dashboards + log queries.
138
225
 
139
226
  ### 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)
227
+ Sequence diagrams for use cases · class diagrams only when ER is non-obvious · validate syntax · ≤7 actors per sequence (split if more).
145
228
 
146
229
  ### Gate
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)
152
-
153
- ---
230
+ - [ ] All target files written · business.md has zero code/endpoints · Every use case has a sequence diagram · README links to every file · All file paths resolve
154
231
 
155
232
  ## Phase 3: REVIEW LOOP (≤3 iterations)
156
233
 
157
- **Goal:** auto-check + fix until docs pass.
158
-
159
234
  For each iteration:
235
+ - **3.1 Structure** — all target files exist · README links resolve · no duplicate content
236
+ - **3.2 Business** — plain language (no `API`/`JSON`/`class`/file paths) · covers all top-level journeys
237
+ - **3.3 Architecture** — layer diagram matches code · every domain has a table row
238
+ - **3.4 Use cases** — one file per identified use case · each has trigger/preconditions/sequence/postconditions/errors · diagrams render
239
+ - **3.5 Consistency** — same terminology everywhere · no nonexistent file paths / endpoints referenced
160
240
 
161
- ### 3.1 Structure
162
- - [ ] All target files exist
163
- - [ ] README.md links resolve
164
- - [ ] No duplicate content across files
165
-
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
169
-
170
- ### 3.3 Architecture
171
- - [ ] Layer diagram matches actual code structure
172
- - [ ] Every code domain has a row in domain table
173
-
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
178
-
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
183
-
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
187
-
188
- ---
241
+ **Loop:** any check fails → fix that section, restart the relevant subset. Max 3 iterations; if still failing → report what's blocking + ask user.
189
242
 
190
243
  ## Phase 4: COMPLETE
191
244
 
192
245
  ```markdown
193
246
  ## Docs Sync Complete
194
-
195
247
  ### Mode: {REFACTOR / UPDATE}
196
-
197
- ### Files
198
- - Created: {N}
199
- - Updated: {N}
200
- - Deleted: {N — REFACTOR mode only}
201
-
202
- ### Coverage
203
- - Domains documented: {N/N}
204
- - Use cases documented: {N/N}
205
- - Diagrams: {N}
206
-
248
+ ### Files: Created {N} · Updated {N} · Deleted {N — REFACTOR only}
249
+ ### Coverage: Domains {N/N} · Use cases {N/N} · Diagrams {N}
207
250
  ### Review iterations: {1/2/3}
208
-
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)
251
+ ### Next steps: review business.md with product · validate use-cases with leads · set up doc lint in CI
213
252
  ```
214
253
 
254
+ ---
215
255
  ---
216
256
 
217
- ## Hard Rules
218
-
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
257
+ ## Hard Rules (both modes)
225
258
 
226
- ---
259
+ - **Real examples only** — invented code drifts and lies.
260
+ - **Link, don't duplicate** — refer to architecture docs, don't restate rules.
261
+ - **Test every command** before publishing.
262
+ - **Update the doc when you change the code** — stale docs are worse than no docs.
263
+ - **SINGLE:** opinionated prose, full voice control.
264
+ - **FULL:** business.md is for humans (strip jargon, no code/paths); one use case per file; mermaid only if it renders; **REFACTOR mode requires explicit user OK** — never delete docs without confirmation; max 3 review iterations.
227
265
 
228
266
  ## Related Skills
229
267
 
230
268
  | When | Use |
231
269
  |------|-----|
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` |
270
+ | Document a newly added API endpoint | `/feature-build` (API mode), Phase 4 |
271
+ | Onboard self / new dev | `/research-explore` (ONBOARDING) |
272
+ | Architecture itself needs review | `/review-code` (ARCHITECT mode) |
273
+ | Write blog / social content | `/marketing-content` |
236
274
 
237
275
  ## Recommended Agents
238
276
 
239
277
  | Phase | Agent | Purpose |
240
278
  |-------|-------|---------|
241
- | SCAN | `@clean-architect` | Identify domains + patterns |
242
- | GENERATE | `@docs-writer` | Write all doc files |
243
- | GENERATE | `@api-designer` | API reference accuracy |
244
- | GENERATE | `@db-designer` | Data model accuracy |
245
- | REVIEW | `@code-reviewer` | Verify code refs resolve |
279
+ | SCAN | `@clean-architect` | Identify doc needs / domains + patterns |
280
+ | ANALYZE / GENERATE (API) | `@api-designer` | API doc structure + accuracy |
281
+ | ANALYZE / GENERATE (DB) | `@db-designer` | Database doc structure + accuracy |
282
+ | GENERATE | `@docs-writer` | Write all docs |
283
+ | REVIEW | `@code-reviewer` | Verify accuracy vs code |