moicle 1.7.0 → 2.1.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 (53) hide show
  1. package/README.md +76 -27
  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 +245 -0
  6. package/assets/skills/docs/write/SKILL.md +274 -0
  7. package/assets/skills/feature/api/SKILL.md +277 -0
  8. package/assets/skills/feature/deprecate/SKILL.md +276 -0
  9. package/assets/skills/feature/new/SKILL.md +273 -0
  10. package/assets/skills/feature/refactor/SKILL.md +269 -0
  11. package/assets/skills/fix/hotfix/SKILL.md +233 -0
  12. package/assets/skills/fix/incident/SKILL.md +360 -0
  13. package/assets/skills/fix/pr-comment/SKILL.md +186 -0
  14. package/assets/skills/fix/root-cause/SKILL.md +276 -0
  15. package/assets/skills/marketing/content/SKILL.md +269 -0
  16. package/assets/skills/marketing/logo/SKILL.md +252 -0
  17. package/assets/skills/marketing/seo-blog/SKILL.md +367 -0
  18. package/assets/skills/marketing/video/SKILL.md +258 -0
  19. package/assets/skills/research/onboarding/SKILL.md +225 -0
  20. package/assets/skills/research/spike/SKILL.md +228 -0
  21. package/assets/skills/research/web/SKILL.md +204 -0
  22. package/assets/skills/review/architect/SKILL.md +274 -0
  23. package/assets/skills/review/branch/SKILL.md +277 -0
  24. package/assets/skills/review/pr/SKILL.md +231 -0
  25. package/assets/skills/review/tdd/SKILL.md +245 -0
  26. package/dist/commands/list.d.ts.map +1 -1
  27. package/dist/commands/list.js +2 -2
  28. package/dist/commands/list.js.map +1 -1
  29. package/dist/utils/symlink.d.ts +7 -0
  30. package/dist/utils/symlink.d.ts.map +1 -1
  31. package/dist/utils/symlink.js +82 -0
  32. package/dist/utils/symlink.js.map +1 -1
  33. package/package.json +1 -1
  34. package/assets/skills/api-integration/SKILL.md +0 -883
  35. package/assets/skills/architect-review/SKILL.md +0 -393
  36. package/assets/skills/content-writer/SKILL.md +0 -721
  37. package/assets/skills/deep-debug/SKILL.md +0 -114
  38. package/assets/skills/deprecation/SKILL.md +0 -923
  39. package/assets/skills/documentation/SKILL.md +0 -1333
  40. package/assets/skills/fix-pr-comment/SKILL.md +0 -283
  41. package/assets/skills/hotfix/SKILL.md +0 -397
  42. package/assets/skills/incident-response/SKILL.md +0 -946
  43. package/assets/skills/logo-design/SKILL.md +0 -477
  44. package/assets/skills/new-feature/SKILL.md +0 -297
  45. package/assets/skills/onboarding/SKILL.md +0 -607
  46. package/assets/skills/pr-review/SKILL.md +0 -620
  47. package/assets/skills/refactor/SKILL.md +0 -338
  48. package/assets/skills/research/SKILL.md +0 -124
  49. package/assets/skills/review-changes/SKILL.md +0 -312
  50. package/assets/skills/spike/SKILL.md +0 -535
  51. package/assets/skills/sync-docs/SKILL.md +0 -575
  52. package/assets/skills/tdd/SKILL.md +0 -828
  53. package/assets/skills/video-content/SKILL.md +0 -651
@@ -0,0 +1,269 @@
1
+ ---
2
+ name: feature-refactor
3
+ description: DDD refactoring workflow with phase-based checks and review loop. Refactor existing code to DDD architecture or improve existing DDD structure. Use when user says "refactor", "clean up", "improve code", "restructure", "migrate to ddd", "refactor ddd".
4
+ args: "[MODULE] [DOMAIN]"
5
+ ---
6
+
7
+ # DDD Refactor Workflow
8
+
9
+ Restructure existing code into DDD layers, or fix drift in an existing DDD module. **Preserves behavior** — refactor structure, never change logic.
10
+
11
+ **ARGUMENTS:** `<module> <domain>` — e.g., `marketing notification`, `users identity`, `products catalog`
12
+
13
+ ## When to use this skill
14
+
15
+ - ✅ Migrating a legacy module into DDD layers
16
+ - ✅ Existing DDD module has drifted (fat controller, anemic entity, mixed concerns)
17
+ - ✅ Splitting one domain into multiple bounded contexts
18
+ - ❌ Building a brand-new feature → use `/feature:new`
19
+ - ❌ Just renaming files / variables → just do it
20
+ - ❌ Fixing a bug → use `/fix:hotfix` or `/fix:root-cause`
21
+
22
+ ## Read Architecture First
23
+
24
+ Detect stack via `~/.claude/architecture/_shared/stack-detection.md`. Load `ddd-architecture.md` + stack doc.
25
+
26
+ ---
27
+
28
+ ## Workflow
29
+
30
+ ```
31
+ 0 FOUNDATION → 1 ANALYZE → 2 DOMAIN → 3 INFRA → 4 APP → 5 TESTS → 6 CLEANUP → REVIEW LOOP
32
+ ```
33
+
34
+ Each phase has a Rule Check. Do not skip any phase.
35
+
36
+ ---
37
+
38
+ ## Phase 0: FOUNDATION
39
+
40
+ **New project (no `domain/` yet):** create
41
+ - `domain/shared/` — base event types, event collector, dispatcher interface
42
+ - Event bus infrastructure
43
+ - App bootstrap/config struct
44
+
45
+ **Existing project:** verify
46
+ ```bash
47
+ ls {domain_root}/shared/ 2>/dev/null && echo PASS || echo NEED SETUP
48
+ ls {eventbus_path}/ 2>/dev/null && echo PASS || echo NEED SETUP
49
+ ```
50
+
51
+ If FAIL → set up foundation before continuing.
52
+
53
+ ### Gate
54
+ - [ ] Shared domain types exist
55
+ - [ ] Event infrastructure exists (if domain raises events)
56
+
57
+ ---
58
+
59
+ ## Phase 1: ANALYZE
60
+
61
+ **Goal:** read ALL source files in the old module before touching anything.
62
+
63
+ ### Read
64
+ - All files in the module dir
65
+ - Related models / types / enums
66
+ - Routes / providers / screens for this module
67
+ - Existing tests (CRITICAL — used in Phase 5)
68
+
69
+ ### Output to user
70
+ ```markdown
71
+ ## Refactor Plan: {module} → {domain}
72
+
73
+ ### Current state
74
+ - Entities/models: {list with fields}
75
+ - Usecases (functions): {list with 1-line logic summary}
76
+ - DTOs: {list}
77
+ - Cross-module calls: {list}
78
+ - Side-effects: {notifications / SSE / analytics / async jobs}
79
+ - External deps: {DB, cache, messaging}
80
+ - Endpoints/screens: {list with method + path}
81
+ - Test files: {list with case counts}
82
+
83
+ ### Proposed DDD structure
84
+ - Value objects to extract: {list}
85
+ - Entities: {list}
86
+ - Events: {list}
87
+ - Ports: {list}
88
+ - Usecases: {list}
89
+ - Listeners: {list}
90
+ ```
91
+
92
+ ### Gate
93
+ - [ ] All module files read
94
+ - [ ] Plan presented to user
95
+ - [ ] **User CONFIRMED** before continuing
96
+
97
+ ---
98
+
99
+ ## Phase 2: DOMAIN LAYER
100
+
101
+ Create `domain/{domain}/` (or add to existing).
102
+
103
+ ### Order: VO → entities → events → ports → usecases
104
+
105
+ - **Value Objects** (`valueobjects/`) — extract typed values (status strings, rates, amounts). Immutable + behavior methods. Stdlib imports only.
106
+ - **Entities** (`entities/`) — convert old models. Constructor + behavior methods + event collection. Add mappers to/from persistence. No framework imports.
107
+ - **Events** (`events/`) — one file per event. Extract from existing direct side-effect calls.
108
+ - **Ports** (`ports/`) — one file per interface. Store ports (persistence), adapter ports (external services). Platform-agnostic naming (`URLParser` not `ShopeeURLParser`). No infra imports.
109
+ - **UseCases** (`usecases/`) — extract business logic from old controllers/handlers/services. Import from `ports/`. Split by concern, ≤200 lines/file. No infra imports.
110
+
111
+ ### Gate
112
+ ```bash
113
+ {build_domain} && echo PASS || echo FAIL
114
+ {grep_forbidden in domain/} && echo FAIL || echo PASS
115
+ {cross_domain_check} && echo FAIL || echo PASS
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Phase 3: INFRASTRUCTURE LAYER
121
+
122
+ - Implement port interfaces from `domain/{domain}/ports/`
123
+ - Mapper functions: domain entity ↔ persistence model
124
+ - Compile-time interface check (where supported)
125
+ - NO business logic
126
+ - Keep existing persistence models in place
127
+
128
+ ### Gate
129
+ - [ ] Infra build passes
130
+ - [ ] All port interfaces implemented
131
+
132
+ ---
133
+
134
+ ## Phase 4: APPLICATION LAYER
135
+
136
+ ### 4.1 Listeners (extract side-effects)
137
+ **CRITICAL:** Side-effects (notifications, SSE, analytics, jobs) **MUST NOT** be called directly in usecases or infra. Flow must be: entity collects event → usecase dispatches → listener handles.
138
+
139
+ - One file per event listener
140
+ - Register in event bus
141
+
142
+ ### 4.2 Service
143
+ - Thin wrapper, delegates to usecases. No business logic.
144
+
145
+ ### 4.3 Handler / Controller / Screen
146
+ - Registration / wiring function
147
+ - Thin: parse → service → return
148
+ - DTOs in separate file
149
+ - **All endpoints must match the old paths + methods**
150
+
151
+ ### Gate
152
+ - [ ] App build passes
153
+ - [ ] Every old endpoint has a new handler at the same path
154
+
155
+ ---
156
+
157
+ ## Phase 5: TESTS
158
+
159
+ **CRITICAL:** read old tests first, copy every scenario. Do not lose coverage.
160
+
161
+ 1. Read all old test files
162
+ 2. List all test cases + business scenarios
163
+ 3. Write domain tests covering all of them
164
+
165
+ ### What to test
166
+ - **Entities** — behavior methods, edge cases, business rules (pure, no mocks)
167
+ - **UseCases** — happy + error paths, validation, event collection (mock ports)
168
+ - **Value Objects** — transitions, calculations, edge cases (pure)
169
+
170
+ ### Gate
171
+ - [ ] Old test count ≤ new test count
172
+ - [ ] Every old scenario covered
173
+ - [ ] `{test_command}` passes
174
+
175
+ ---
176
+
177
+ ## Phase 6: INTEGRATION & CLEANUP
178
+
179
+ ### 6.1 Wire up the new module
180
+ - Add registration calls in router / provider / registry
181
+ - Remove old module registrations
182
+ - Endpoints/screens match old paths
183
+
184
+ ### 6.2 Remove old module
185
+ - Delete old directory **only after** build + tests pass
186
+ - Do NOT delete shared models/types other modules still use
187
+
188
+ ### Gate
189
+ ```bash
190
+ {full_build} && echo PASS || echo FAIL
191
+ test -d {old_module_path} && echo "FAIL: still there" || echo PASS
192
+ grep -r "{old_import_path}" --include="*.{ext}" . && echo "FAIL: stale imports" || echo PASS
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Review Loop
198
+
199
+ After Phase 6, call `/review:architect {stack} {domain}`. Loop until score ≥ B.
200
+
201
+ ```
202
+ LOOP:
203
+ 1. /review:architect {stack} {domain}
204
+ 2. IF violations severity ≥ MEDIUM:
205
+ fix all → full build → all tests → GOTO 1
206
+ 3. IF score ≥ B → BREAK
207
+ ```
208
+
209
+ ---
210
+
211
+ ## Final Report
212
+
213
+ ```markdown
214
+ ## Refactor Complete: {module} → {domain}
215
+
216
+ ### Changes
217
+ - Files created: {N}
218
+ - Files modified: {N}
219
+ - Files deleted: {N}
220
+
221
+ ### Endpoints preserved
222
+ | Old path | New handler | Status |
223
+ |----------|-------------|--------|
224
+
225
+ ### Domain events introduced
226
+ | Event | Listener(s) |
227
+ |-------|-------------|
228
+
229
+ ### Tests
230
+ - Files: {N}, cases: {M}
231
+ - All old scenarios migrated: YES
232
+
233
+ ### Review score: {A/B}
234
+ - Build / Lint / Domain purity / Old module removed / No stale imports / Tests: all PASS
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Hard Rules
240
+
241
+ - **Preserve behavior** — never change business logic during refactor
242
+ - **MUST read old tests** before writing new ones (no scenario lost)
243
+ - **MUST read old code** carefully — don't invent logic from variable names
244
+ - **All endpoints keep their paths** — refactor is invisible to clients
245
+ - **Don't skip phases** — Rule Checks gate the next phase
246
+ - **Multiple modules → same domain:** first module creates the domain dir, others add to it
247
+ - **One module at a time** — finish one before starting the next
248
+
249
+ ---
250
+
251
+ ## Related Skills
252
+
253
+ | When | Use |
254
+ |------|-----|
255
+ | Building from scratch (no existing code) | `/feature:new` |
256
+ | Just adding tests to untested code | `/review:tdd` |
257
+ | Reviewing the refactor before merging | `/review:branch` |
258
+ | Final architecture check (called automatically in review loop) | `/review:architect` |
259
+
260
+ ## Recommended Agents
261
+
262
+ | Phase | Agent | Purpose |
263
+ |-------|-------|---------|
264
+ | ANALYZE | `@refactor` | Identify refactor scope |
265
+ | ANALYZE | `@code-reviewer` | Smell detection |
266
+ | PLAN | `@clean-architect` | Architecture alignment |
267
+ | BUILD | Stack-specific dev agent | Implementation |
268
+ | TESTS | `@test-writer` | Domain tests |
269
+ | REVIEW | `@code-reviewer` | Final quality check |
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: fix-hotfix
3
+ description: Quick bug fix workflow with rollback plan. Use when fixing bugs, hotfixes, urgent issues, production bugs, or when user says "fix bug", "hotfix", "urgent fix", "production issue".
4
+ ---
5
+
6
+ # Hotfix Workflow
7
+
8
+ Fast-track bug fix with a rollback plan. Use when the cause is identifiable in under an hour of investigation.
9
+
10
+ ## When to use this skill
11
+
12
+ - ✅ Bug is reproducible and root cause is clear (or quickly identifiable)
13
+ - ✅ Need a fix shipped fast with a rollback plan
14
+ - ✅ Severity ranges from low (minor UI) to high (feature broken)
15
+ - ❌ Production is down right now → use `/fix:incident` first
16
+ - ❌ Bug has been "fixed" multiple times and keeps returning → use `/fix:root-cause`
17
+ - ❌ Building a new feature → use `/feature:new`
18
+
19
+ ## Read Architecture First
20
+
21
+ Read `ddd-architecture.md` + stack-specific doc — the fix must land in the right layer (usecase / handler / infra) per architecture rules.
22
+
23
+ ## Severity
24
+
25
+ Use `~/.claude/architecture/_shared/severity-levels.md` (incident table). Hotfix typically covers P2-P4. P1 → start with `/fix:incident` for triage / comms.
26
+
27
+ ---
28
+
29
+ ## Workflow
30
+
31
+ ```
32
+ IDENTIFY → REPRODUCE → FIX → VERIFY → DEPLOY
33
+ ↑ ↓
34
+ └── ROLLBACK (if needed)
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Phase 1: IDENTIFY (≤15 min)
40
+
41
+ **Goal:** capture exactly what's broken — no speculation.
42
+
43
+ ### Capture
44
+ - Error message / stack trace (verbatim)
45
+ - Steps to reproduce
46
+ - Expected vs actual behavior
47
+ - Environment (prod / staging / dev)
48
+ - Affected users (all / subset / specific tenant)
49
+ - Recent deploys / config changes (last 24-48h)
50
+
51
+ ### 5 Whys (worked example)
52
+ > Q1: Why does checkout fail? A1: `OrderService.calculate` returns NaN.
53
+ > Q2: Why NaN? A2: `quantity * price` where price is undefined.
54
+ > Q3: Why undefined? A3: New SKUs from supplier feed have null price.
55
+ > Q4: Why null? A4: Feed schema added optional `price` field, defaulted to null.
56
+ > Q5: Why didn't validation catch it? A5: Import worker skips schema validation for "perf".
57
+
58
+ → Root cause: skipped validation in import worker. Fix at the import boundary, not in checkout.
59
+
60
+ ### Gate
61
+ - [ ] Error captured verbatim
62
+ - [ ] Reproduction steps known (or "intermittent" noted)
63
+ - [ ] Severity assigned (P2 / P3 / P4)
64
+ - [ ] Root cause identified (use `/fix:root-cause` if 5 Whys doesn't converge)
65
+
66
+ ---
67
+
68
+ ## Phase 2: REPRODUCE (≤30 min)
69
+
70
+ **Goal:** reproduce locally before changing any code.
71
+
72
+ ### Steps
73
+ 1. Check out the deployed commit (NOT main if main has drifted)
74
+ 2. Reproduce with the exact data / inputs from Phase 1
75
+ 3. If you can't reproduce → it's environment-specific. Check:
76
+ - Env vars on prod vs local
77
+ - DB state / data shape
78
+ - Cache / CDN state
79
+ - Runtime version differences
80
+
81
+ ### Gate
82
+ - [ ] Reproduced locally on the deployed commit
83
+ - [ ] OR documented why local reproduction is impossible + plan to test on staging
84
+
85
+ ---
86
+
87
+ ## Phase 3: FIX
88
+
89
+ **Goal:** smallest correct change at the right layer.
90
+
91
+ ### Rules
92
+ - Fix at the **root cause**, not the symptom
93
+ - Land the fix in the right layer (boundary validation → handler/DTO; business rule → usecase; data shape → infra mapper)
94
+ - **Add a regression test first** (RED), then make it pass (GREEN). See `/review:tdd`.
95
+ - Don't refactor on the fix — separate PR
96
+ - If the fix requires schema migration, plan it as 2 deploys (compatible code first, then migration)
97
+
98
+ ### Boundary defense
99
+ For data-shape bugs (null where not expected, type mismatch from external API): defend at the **trust boundary** (handler / adapter), not inside business logic.
100
+
101
+ ### Gate
102
+ - [ ] Regression test added (red → green)
103
+ - [ ] Fix is in the right layer (per architecture)
104
+ - [ ] No unrelated changes in the PR
105
+ - [ ] Existing tests still pass
106
+
107
+ ---
108
+
109
+ ## Phase 4: VERIFY
110
+
111
+ **Goal:** confirm fix works without breaking other paths.
112
+
113
+ ### Local
114
+ - [ ] Original failure no longer reproducible
115
+ - [ ] All tests pass (`{test command}`)
116
+ - [ ] Linter clean
117
+ - [ ] Build green
118
+
119
+ ### Staging (if available)
120
+ - [ ] Deploy to staging
121
+ - [ ] Reproduce the failure scenario — should pass
122
+ - [ ] Smoke-test adjacent features (anything sharing the code path)
123
+ - [ ] Monitor logs for 5-15 min
124
+
125
+ ### Gate
126
+ - [ ] Local + staging both verified
127
+ - [ ] No regressions in adjacent features
128
+
129
+ ---
130
+
131
+ ## Phase 5: DEPLOY
132
+
133
+ ### Pre-deploy checklist
134
+ - [ ] PR reviewed (`/review:branch` self + `/review:pr` from teammate)
135
+ - [ ] Rollback plan documented (see below)
136
+ - [ ] On-call notified
137
+ - [ ] CHANGELOG entry
138
+
139
+ ### Rollback plan
140
+ Document **before** deploying:
141
+ - Rollback method: `revert PR` / `redeploy commit {sha}` / `feature flag off` / `DB migration down`
142
+ - Estimated rollback time
143
+ - Who has authority to roll back (usually IC or on-call)
144
+ - Signal to roll back (specific metric + threshold)
145
+
146
+ ### Deploy steps
147
+ 1. Deploy via normal pipeline (don't skip CI even under pressure)
148
+ 2. Watch metrics + logs for the symptom + adjacent code paths
149
+ 3. Hold deploy attention for at least 1× normal request cycle (15-30 min)
150
+
151
+ ### Gate
152
+ - [ ] Deployed successfully
153
+ - [ ] Symptom no longer occurring
154
+ - [ ] No new errors in monitoring
155
+ - [ ] Stakeholders notified
156
+
157
+ ---
158
+
159
+ ## Phase 6: ROLLBACK (if Phase 5 verify fails)
160
+
161
+ ### When to roll back
162
+ - Error rate increases post-deploy
163
+ - New error type appears
164
+ - Adjacent feature breaks
165
+ - Performance degrades meaningfully
166
+
167
+ ### How
168
+ 1. Announce: "Rolling back {fix} in 60s due to {observation}"
169
+ 2. Execute: revert / redeploy previous / flip flag / migration down
170
+ 3. Verify rollback: metrics return to baseline
171
+ 4. Post-mortem the rollback — what was missed in Phase 3/4?
172
+
173
+ ---
174
+
175
+ ## Final Report
176
+
177
+ ```markdown
178
+ ## Hotfix: {short description}
179
+
180
+ ### Root cause
181
+ {From Phase 1, 5 Whys final answer}
182
+
183
+ ### Fix
184
+ - File: `path/to/file:line`
185
+ - Layer: {handler / usecase / infra / etc.}
186
+ - Approach: {boundary defense / logic correction / data migration}
187
+
188
+ ### Tests
189
+ - Regression test: {file:line}
190
+ - All tests passing
191
+
192
+ ### Deploy
193
+ - Deployed: {timestamp}
194
+ - Verified: {timestamp + how}
195
+ - Rollback plan: {revert / redeploy / flag / migration}
196
+
197
+ ### Severity: {P2 / P3 / P4}
198
+ ### Status: SHIPPED ✅ (or ROLLED BACK + reason)
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Hard Rules
204
+
205
+ - **Reproduce before fixing** — no fix lands without local repro
206
+ - **Regression test required** — every fix gets a test that would have caught it
207
+ - **Fix at the root, not the symptom** — patching the symptom invites the bug back
208
+ - **No drive-by refactor** — fix PR is focused, refactor goes in a separate PR
209
+ - **Always have a rollback plan** documented before deploy
210
+ - **Don't skip CI** under pressure — bypassing CI is what causes the next incident
211
+
212
+ ---
213
+
214
+ ## Related Skills
215
+
216
+ | When | Use |
217
+ |------|-----|
218
+ | Production is down right now | `/fix:incident` first, then hotfix |
219
+ | Bug keeps coming back after fixes | `/fix:root-cause` |
220
+ | Need to write regression test first | `/review:tdd` |
221
+ | Bug is on an open PR | `/fix:pr-comment` |
222
+ | Self-review before opening PR | `/review:branch` |
223
+
224
+ ## Recommended Agents
225
+
226
+ | Phase | Agent | Purpose |
227
+ |-------|-------|---------|
228
+ | IDENTIFY | Stack-specific dev agent | Read error context |
229
+ | FIX | Stack-specific dev agent | Apply the fix |
230
+ | FIX | `@security-audit` | Security-related bugs |
231
+ | VERIFY | `@test-writer` | Regression test |
232
+ | VERIFY | `@code-reviewer` | Quick code review |
233
+ | DEPLOY | `@devops` | CI/CD + monitoring |