moicle 1.6.0 → 2.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 (56) hide show
  1. package/README.md +82 -32
  2. package/assets/skills/docs/content/SKILL.md +269 -0
  3. package/assets/skills/{logo-design → docs/logo}/SKILL.md +31 -16
  4. package/assets/skills/{sync-docs → docs/sync}/SKILL.md +31 -1
  5. package/assets/skills/{video-content → docs/video}/SKILL.md +32 -17
  6. package/assets/skills/docs/write/SKILL.md +371 -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/{new-feature → feature/new}/SKILL.md +28 -12
  10. package/assets/skills/{refactor → feature/refactor}/SKILL.md +24 -12
  11. package/assets/skills/{hotfix → fix/hotfix}/SKILL.md +32 -30
  12. package/assets/skills/fix/incident/SKILL.md +272 -0
  13. package/assets/skills/{fix-pr-comment → fix/pr-comment}/SKILL.md +30 -1
  14. package/assets/skills/fix/root-cause/SKILL.md +219 -0
  15. package/assets/skills/{onboarding → research/onboarding}/SKILL.md +32 -31
  16. package/assets/skills/{spike → research/spike}/SKILL.md +33 -32
  17. package/assets/skills/research/web/SKILL.md +163 -0
  18. package/assets/skills/{architect-review → review/architect}/SKILL.md +37 -7
  19. package/assets/skills/{review-changes → review/branch}/SKILL.md +27 -7
  20. package/assets/skills/{pr-review → review/pr}/SKILL.md +31 -30
  21. package/assets/skills/review/tdd/SKILL.md +206 -0
  22. package/bin/cli.js +12 -1
  23. package/dist/commands/install.d.ts.map +1 -1
  24. package/dist/commands/install.js +219 -38
  25. package/dist/commands/install.js.map +1 -1
  26. package/dist/commands/list.d.ts.map +1 -1
  27. package/dist/commands/list.js +42 -2
  28. package/dist/commands/list.js.map +1 -1
  29. package/dist/commands/postinstall.d.ts.map +1 -1
  30. package/dist/commands/postinstall.js +2 -0
  31. package/dist/commands/postinstall.js.map +1 -1
  32. package/dist/commands/status.d.ts.map +1 -1
  33. package/dist/commands/status.js +31 -1
  34. package/dist/commands/status.js.map +1 -1
  35. package/dist/commands/uninstall.d.ts.map +1 -1
  36. package/dist/commands/uninstall.js +93 -38
  37. package/dist/commands/uninstall.js.map +1 -1
  38. package/dist/commands/upgrade.d.ts +7 -0
  39. package/dist/commands/upgrade.d.ts.map +1 -0
  40. package/dist/commands/upgrade.js +165 -0
  41. package/dist/commands/upgrade.js.map +1 -0
  42. package/dist/types.d.ts +1 -1
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/utils/symlink.d.ts +8 -0
  45. package/dist/utils/symlink.d.ts.map +1 -1
  46. package/dist/utils/symlink.js +100 -0
  47. package/dist/utils/symlink.js.map +1 -1
  48. package/package.json +3 -1
  49. package/assets/skills/api-integration/SKILL.md +0 -883
  50. package/assets/skills/content-writer/SKILL.md +0 -721
  51. package/assets/skills/deep-debug/SKILL.md +0 -114
  52. package/assets/skills/deprecation/SKILL.md +0 -923
  53. package/assets/skills/documentation/SKILL.md +0 -1333
  54. package/assets/skills/incident-response/SKILL.md +0 -946
  55. package/assets/skills/research/SKILL.md +0 -124
  56. package/assets/skills/tdd/SKILL.md +0 -828
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: research-web
3
+ description: Research solutions on the internet for a given topic or the current conversation context. Use when user says "research", "tìm giải pháp", "search solution", "investigate", "find best practice", "so sánh giải pháp".
4
+ args: "[TOPIC]"
5
+ ---
6
+
7
+ # Research Solutions
8
+
9
+ Research solutions on the internet for a specific problem — from an explicit topic argument or by analyzing the current conversation context. **Research and propose only — do NOT implement.**
10
+
11
+ **ARGUMENTS:** (optional) Topic or question to research. If omitted, analyze the current conversation (recent messages, IDE selection, task at hand) to determine what to research.
12
+
13
+ ## When to use this skill
14
+
15
+ - ✅ You don't know the right solution / library / pattern yet
16
+ - ✅ Need to compare multiple approaches before committing
17
+ - ✅ Stack / framework changed and best practices may have shifted
18
+ - ❌ You already know the approach → use `/feature:new` or `/fix:hotfix`
19
+ - ❌ You want to validate the approach by building → use `/research:spike`
20
+ - ❌ Debugging a known bug → use `/fix:root-cause`
21
+
22
+ ---
23
+
24
+ ## Workflow
25
+
26
+ ```
27
+ IDENTIFY → DETECT STACK → SEARCH → SYNTHESIZE → PROPOSE
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Step 1: Identify what to research
33
+
34
+ ### Mode 1 — Argument provided
35
+ - Use the argument directly as the topic
36
+ - If too broad, narrow it down using project context (stack, architecture, current task) BEFORE searching
37
+
38
+ ### Mode 2 — No argument
39
+ - Analyze the current conversation: recent messages, IDE file selection, active task
40
+ - Identify: what is the user doing, what problem they hit, what solution they need
41
+ - **Summarize the problem back to the user and get confirmation** before burning search budget
42
+
43
+ ### Gate
44
+ - [ ] Problem statement clear and confirmed (Mode 2)
45
+ - [ ] Scope narrow enough to research in <10 queries
46
+
47
+ ---
48
+
49
+ ## Step 2: Detect project context
50
+
51
+ Detect the project's tech stack so results can be filtered for relevance.
52
+
53
+ | File | Stack |
54
+ |------|-------|
55
+ | `go.mod` | Go (note version from `go` directive) |
56
+ | `package.json` | Node.js — inspect dependencies to pick framework (NestJS / Vite+React / Remix / etc.) |
57
+ | `pubspec.yaml` | Flutter / Dart |
58
+ | `composer.json` | PHP / Laravel |
59
+ | `Cargo.toml` | Rust |
60
+ | `pyproject.toml` / `requirements.txt` | Python |
61
+
62
+ Also check `.claude/architecture/` for the architecture doc in use — this shapes which patterns are idiomatic for the project.
63
+
64
+ ### Gate
65
+ - [ ] Stack + version identified
66
+ - [ ] Architecture context noted (if any)
67
+
68
+ ---
69
+
70
+ ## Step 3: Search the internet
71
+
72
+ Use **WebSearch** and **WebFetch**.
73
+
74
+ ### Search strategy
75
+ 1. **Broad first** — overview, best practices, common approaches
76
+ 2. **Deep dive** — official docs, GitHub issues, Stack Overflow, authoritative blogs
77
+ 3. **Compare** — if multiple solutions exist, list pros / cons of each
78
+
79
+ ### Source priority
80
+ 1. Official documentation
81
+ 2. GitHub issues / release notes (quirks, known bugs)
82
+ 3. Stack Overflow (accepted answers with high scores)
83
+ 4. Authoritative blogs (Anthropic, framework authors, well-known engineers)
84
+ 5. Recent > old — prefer last 2 years unless evergreen
85
+
86
+ ### Search tips
87
+ - **Prefer English queries** — richer, more recent results
88
+ - Include library + version when version-sensitive (e.g., `nestjs 10 typeorm migrations`)
89
+ - Cross-validate across at least 2–3 independent sources
90
+ - When sources conflict, prefer most recent + most authoritative; note the conflict
91
+
92
+ ### Gate
93
+ - [ ] At least 2 independent sources for the recommendation
94
+ - [ ] Sources are < 2 years old (or "evergreen" justified)
95
+
96
+ ---
97
+
98
+ ## Step 4: Synthesize results
99
+
100
+ Present findings in this format:
101
+
102
+ ```markdown
103
+ ## Problem
104
+ {Short summary of the problem, with project context — stack, constraints, goal}
105
+
106
+ ## Solutions Found
107
+
108
+ ### Solution 1: {Name}
109
+ - **Description:** {How it works}
110
+ - **Pros:** {...}
111
+ - **Cons:** {...}
112
+ - **Fit for this project:** {High / Medium / Low — why}
113
+ - **Source:** {link}
114
+
115
+ ### Solution 2: {Name} (if applicable)
116
+ - ...
117
+
118
+ ## Recommendation
119
+ {Which solution fits best and why — reference architecture doc / stack conventions}
120
+
121
+ ## Code Example (if applicable)
122
+ {Minimal snippet showing the recommended approach, adapted to the project's stack}
123
+
124
+ ## Caveats / Known Issues
125
+ - {Gotcha 1}
126
+ - {Gotcha 2}
127
+
128
+ ## References
129
+ - {link 1} — {what this source gave us}
130
+ - {link 2} — {...}
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Hard Rules
136
+
137
+ - **Research and propose — do NOT implement.** Wait for user confirmation before touching code
138
+ - **Consider project context:** stack, architecture, conventions. A solution idiomatic in one project can be wrong in another
139
+ - **Narrow scope when too broad:** if the topic is too wide (e.g., "how to do auth"), ask the user to narrow it
140
+ - **Flag stale answers:** if top answers are 3+ years old and the library has had major versions since, mention it and check release notes
141
+ - **No hallucinated APIs:** if uncertain whether a method / option exists, verify in official docs before recommending
142
+ - **Cite sources:** every non-trivial claim should have a link
143
+
144
+ ---
145
+
146
+ ## Related Skills
147
+
148
+ | When | Use |
149
+ |------|-----|
150
+ | You want to prototype the chosen approach | `/research:spike` |
151
+ | You already know the approach and want to implement | `/feature:new` / `/fix:hotfix` |
152
+ | You're debugging a known bug (not researching options) | `/fix:root-cause` |
153
+ | You want to write the research up as a design doc | `/docs:write` |
154
+
155
+ ---
156
+
157
+ ## Recommended Agents
158
+
159
+ | Phase | Agent | Purpose |
160
+ |-------|-------|---------|
161
+ | Search | `@docs-writer` | Frame the research output as a design note |
162
+ | Synthesize | `@api-designer` | If researching API patterns |
163
+ | Synthesize | `@security-audit` | If researching anything auth / crypto / data handling |
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: architect-review
2
+ name: review-architect
3
3
  description: DDD architecture compliance review with automated checks and review loop. Use when user says "architect-review", "architecture review", "review architecture", "check architecture", "review ddd", "ddd review".
4
4
  args: "[ARCHITECTURE_NAME] [DOMAIN]"
5
5
  ---
@@ -8,12 +8,21 @@ args: "[ARCHITECTURE_NAME] [DOMAIN]"
8
8
 
9
9
  Review codebase against DDD architecture guidelines with automated checks and a review loop that keeps fixing until all checks pass.
10
10
 
11
+ ## When to use this skill
12
+
13
+ - ✅ Verify DDD compliance for a domain after `/feature:new` or `refactor`
14
+ - ✅ Periodic audit of an existing codebase
15
+ - ✅ As a quality gate before merging architectural changes
16
+ - ❌ Reviewing a PR end-to-end (code quality + arch) → use `/review:pr`
17
+ - ❌ Reviewing own branch before push → use `/review:branch`
18
+ - ❌ Looking for security bugs → use `@security-audit` agent
19
+
11
20
  ## Usage
12
21
 
13
22
  ```bash
14
- /architect-review go-backend wallet
15
- /architect-review react-frontend
16
- /architect-review
23
+ /review:architect go-backend wallet
24
+ /review:architect react-frontend
25
+ /review:architect
17
26
  ```
18
27
 
19
28
  ## Supported Architectures
@@ -346,15 +355,15 @@ LOOP:
346
355
 
347
356
  ## Calling from Other Skills
348
357
 
349
- This skill is designed to be called by `new-feature` and `refactor` skills at the end of their workflows:
358
+ This skill is designed to be called by `/feature:new` and `/feature:refactor`s at the end of their workflows:
350
359
 
351
360
  ```
352
361
  # From new-feature skill, after Phase 5 (registration):
353
- → Run /architect-review {detected_stack} {domain}
362
+ → Run /review:architect {detected_stack} {domain}
354
363
  → Review loop until score >= B
355
364
 
356
365
  # From refactor skill, after Phase 4 (cleanup):
357
- → Run /architect-review {detected_stack} {domain}
366
+ → Run /review:architect {detected_stack} {domain}
358
367
  → Review loop until score >= B
359
368
  ```
360
369
 
@@ -391,3 +400,24 @@ P: Ports EV: Events U: UseCases
391
400
  SVC: Services H: Handlers L: Listeners
392
401
  I: Infrastructure
393
402
  ```
403
+
404
+ ---
405
+
406
+ ## Related Skills
407
+
408
+ | When | Use |
409
+ |------|-----|
410
+ | Full PR review (arch + code quality + security + tests) | `/review:pr` |
411
+ | Self-review own branch before push | `/review:branch` |
412
+ | Refactor to fix violations found here | `refactor` |
413
+ | Add tests if missing | `/review:tdd` |
414
+ | Called from `/feature:new` / `refactor` review loop | (automatic — no manual invoke) |
415
+
416
+ ## Recommended Agents
417
+
418
+ | Phase | Agent | Purpose |
419
+ |-------|-------|---------|
420
+ | LOAD | `@clean-architect` | Interpret architecture rules |
421
+ | AUTOMATED CHECKS | `@devops` | Build / lint / test scripts |
422
+ | MANUAL REVIEW | `@code-reviewer` | Spot violations |
423
+ | FIX | Stack-specific dev agent | Apply fixes |
@@ -1,15 +1,24 @@
1
1
  ---
2
- name: review-changes
2
+ name: review-branch
3
3
  description: Review local branch changes for architecture compliance, conventions, and code quality before pushing/PR. Stack-aware — detects the project stack and applies the matching rules. Use when user says "review changes", "review branch", "check branch", "check changes", "review my code", "review before pr".
4
4
  args: "[BASE_BRANCH]"
5
5
  ---
6
6
 
7
7
  # Review Local Branch Changes
8
8
 
9
- Review all code changes on the current branch (vs a base branch) for **architecture compliance**, **stack conventions**, and **code quality**. Focus on changed files only — not the entire codebase. This is the pre-PR companion to `pr-review` (which reviews remote PRs).
9
+ Review all code changes on the current branch (vs a base branch) for **architecture compliance**, **stack conventions**, and **code quality**. Focus on changed files only — not the entire codebase.
10
10
 
11
11
  **ARGUMENTS:** (optional) base branch to compare against. Default: `main` (or `master` if `main` does not exist).
12
12
 
13
+ ## When to use this skill
14
+
15
+ - ✅ Before pushing your branch / opening a PR (self-review)
16
+ - ✅ Before asking a teammate to review (catch easy issues first)
17
+ - ✅ Quick sanity check on a feature you've been working on
18
+ - ❌ Reviewing someone else's PR → use `/review:pr`
19
+ - ❌ Only checking architecture compliance → use `/review:architect`
20
+ - ❌ Hunting for security issues only → use `@security-audit` agent
21
+
13
22
  ---
14
23
 
15
24
  ## Phase 0: Detect Stack & Load Architecture
@@ -302,11 +311,22 @@ If user says to fix:
302
311
 
303
312
  ---
304
313
 
305
- ## Relationship to Other Skills
314
+ ## Related Skills
306
315
 
307
316
  | Skill | When to use |
308
317
  |-------|-------------|
309
- | `review-changes` (this) | Local branch changes, pre-push / pre-PR |
310
- | `pr-review` | Remote PR review via `gh pr` — includes posting feedback to GitHub |
311
- | `architect-review` | Deep DDD architecture audit of a domain (not just changes) |
312
- | `fix-pr-comment` | Fix feedback posted on an existing PR |
318
+ | `/review:branch` (this) | Local branch changes, pre-push / pre-PR |
319
+ | `/review:pr` | Remote PR review via `gh pr` — includes posting feedback to GitHub |
320
+ | `/review:architect` | Deep DDD architecture audit of a domain (not just changes) |
321
+ | `/fix:pr-comment` | Fix feedback posted on an existing PR |
322
+ | `/fix:hotfix` | Fixing the issues found here |
323
+
324
+ ## Recommended Agents
325
+
326
+ | Phase | Agent | Purpose |
327
+ |-------|-------|---------|
328
+ | Phase 3 (architecture) | `@clean-architect` | DDD compliance |
329
+ | Phase 4 (security) | `@security-audit` | Vulnerability check |
330
+ | Phase 5 (quality) | `@code-reviewer` | Code smells |
331
+ | Phase 6 (tests) | `@test-writer` | Test coverage check |
332
+ | Phase 8 (fix) | Stack-specific dev agent | Apply fixes |
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: pr-review
2
+ name: review-pr
3
3
  description: Thorough pull request review workflow with architecture compliance checks. Use when reviewing pull requests, checking code changes, or when user says "review pr", "check pr", "review code", "pr review", "review pull request".
4
4
  ---
5
5
 
@@ -7,38 +7,18 @@ description: Thorough pull request review workflow with architecture compliance
7
7
 
8
8
  Comprehensive workflow for reviewing pull requests with architecture compliance and quality gates.
9
9
 
10
- ## IMPORTANT: Read Architecture First
10
+ ## When to use this skill
11
11
 
12
- **Before reviewing any code, you MUST read the appropriate architecture reference:**
12
+ - Reviewing someone else's open PR (`gh pr view <number>` accessible)
13
+ - ✅ Need to post structured feedback (APPROVE / REQUEST CHANGES / COMMENT)
14
+ - ✅ Want a multi-dimensional review (architecture + security + perf + tests)
15
+ - ❌ Self-review of your own branch before push → use `/review:branch`
16
+ - ❌ Only checking DDD compliance → use `/review:architect`
17
+ - ❌ Addressing comments on your own PR → use `/fix:pr-comment`
13
18
 
14
- ### Global Architecture Files
15
- ```
16
- ~/.claude/architecture/
17
- ├── clean-architecture.md # Core principles for all projects
18
- ├── flutter-mobile.md # Flutter + Riverpod
19
- ├── react-frontend.md # React + Vite + TypeScript
20
- ├── go-backend.md # Go + Gin
21
- ├── laravel-backend.md # Laravel + PHP
22
- ├── remix-fullstack.md # Remix fullstack
23
- └── monorepo.md # Monorepo structure
24
- ```
25
-
26
- ### Project-specific (if exists)
27
- ```
28
- .claude/architecture/ # Project overrides
29
- ```
30
-
31
- **Review must verify compliance with architecture patterns defined in these files.**
19
+ ## Read Architecture First
32
20
 
33
- ## Recommended Agents
34
-
35
- | Phase | Agent | Purpose |
36
- |-------|-------|---------|
37
- | ANALYZE | `@clean-architect` | Architecture compliance check |
38
- | REVIEW | `@code-reviewer` | Code quality and best practices |
39
- | REVIEW | `@security-audit` | Security vulnerabilities scan |
40
- | REVIEW | `@perf-optimizer` | Performance analysis |
41
- | REVIEW | `@test-writer` | Test coverage and quality |
21
+ Read `ddd-architecture.md` + stack-specific doc — review must verify compliance.
42
22
 
43
23
  ## Workflow Overview
44
24
 
@@ -618,3 +598,24 @@ PR review is complete when:
618
598
  4. Decision made (approve/request/comment)
619
599
  5. Review posted to GitHub
620
600
  6. Author knows exactly what to do next
601
+
602
+ ---
603
+
604
+ ## Related Skills
605
+
606
+ | When | Use |
607
+ |------|-----|
608
+ | Reviewing own branch before push | `/review:branch` |
609
+ | Only checking DDD architecture | `/review:architect` |
610
+ | Fixing comments on your own PR | `/fix:pr-comment` |
611
+ | Bug surfaced by review | `/fix:hotfix` |
612
+
613
+ ## Recommended Agents
614
+
615
+ | Phase | Agent | Purpose |
616
+ |-------|-------|---------|
617
+ | ANALYZE | `@clean-architect` | Architecture compliance |
618
+ | REVIEW | `@code-reviewer` | Code quality + best practices |
619
+ | REVIEW | `@security-audit` | Security vulnerabilities |
620
+ | REVIEW | `@perf-optimizer` | Performance analysis |
621
+ | REVIEW | `@test-writer` | Test coverage + quality |
@@ -0,0 +1,206 @@
1
+ ---
2
+ name: review-tdd
3
+ description: Test-Driven Development workflow. Use when doing TDD, writing tests first, or when user says "tdd", "test first", "test driven", "red green refactor".
4
+ ---
5
+
6
+ # Test-Driven Development (TDD) Workflow
7
+
8
+ Red-Green-Refactor cycle: write failing test → write minimal code to pass → refactor while keeping tests green.
9
+
10
+ ## When to use this skill
11
+
12
+ - ✅ Implementing logic with clear input → output behavior (parsers, validators, business rules, usecases)
13
+ - ✅ Fixing a bug — write the failing test first, then fix (regression guard)
14
+ - ✅ Refactoring critical code where you need a safety net
15
+ - ❌ UI prototyping / visual tweaks → manual is faster
16
+ - ❌ Exploratory spike → use `/research:spike` (throwaway code, no tests needed)
17
+ - ❌ One-line config change → just change it
18
+
19
+ ---
20
+
21
+ ## The TDD Cycle
22
+
23
+ ```
24
+ ┌──────┐ ┌───────┐ ┌──────────┐
25
+ ┌──▶│ RED │───▶│ GREEN │───▶│ REFACTOR │──┐
26
+ │ └──────┘ └───────┘ └──────────┘ │
27
+ │ (fail) (minimal) (cleanup) │
28
+ └──────────────────────────────────────────┘
29
+ next requirement
30
+ ```
31
+
32
+ ## Read Architecture First
33
+
34
+ Read the stack architecture doc for:
35
+ - Test file location convention (e.g., `_test.go` next to source, `__tests__/` for Jest)
36
+ - Test framework (Go testing, Jest, Pest, Flutter test)
37
+ - Mocking patterns for ports (interfaces)
38
+ - AAA (Arrange-Act-Assert) layout
39
+
40
+ ---
41
+
42
+ ## Phase 1: RED — Write a failing test
43
+
44
+ **Goal:** describe the behavior you want with a test that fails because the code doesn't exist yet.
45
+
46
+ ### Steps
47
+ 1. Pick ONE small requirement (the smallest behavior you can verify)
48
+ 2. Write the test name as a sentence describing the behavior
49
+ 3. Arrange: set up inputs and mocks
50
+ 4. Act: call the method
51
+ 5. Assert: verify the expected output / state change / event raised
52
+ 6. Run the test — it MUST fail (compile error or assertion fail). If it passes, the test is wrong.
53
+
54
+ ### Test name conventions
55
+ - `should_<expected_behavior>_when_<condition>` (snake_case for Go/Python)
56
+ - `it("returns X when Y", ...)` (Jest / Mocha)
57
+ - `test_<behavior>_<condition>` (PHPUnit)
58
+
59
+ ### AAA pattern
60
+ ```
61
+ // Arrange — set up inputs and mocks
62
+ // Act — call the function under test
63
+ // Assert — verify result / state / interactions
64
+ ```
65
+
66
+ ### Gate
67
+ - [ ] Test fails for the RIGHT reason (compile error or assertion fail, not a typo)
68
+ - [ ] Test name describes behavior, not implementation
69
+ - [ ] Only ONE behavior tested per test
70
+
71
+ ---
72
+
73
+ ## Phase 2: GREEN — Make it pass with minimal code
74
+
75
+ **Goal:** write the smallest amount of code that makes the test pass. **Resist** the urge to "do it properly" — refactor comes next.
76
+
77
+ ### Rules
78
+ - **Minimal** means: hardcode return values if the test allows it; you'll triangulate with more tests
79
+ - Don't add code not required by a test
80
+ - Don't add error handling unless a test requires it
81
+ - Don't generalize until 3+ tests force you to
82
+
83
+ ### Steps
84
+ 1. Run the failing test (confirm RED)
85
+ 2. Write just enough code to make it green
86
+ 3. Run all tests — all must pass (not just the new one)
87
+ 4. If other tests broke, you're not minimal — revert and try smaller
88
+
89
+ ### Gate
90
+ - [ ] New test passes
91
+ - [ ] All previous tests still pass
92
+ - [ ] No untested behavior added
93
+
94
+ ---
95
+
96
+ ## Phase 3: REFACTOR — Clean up while green
97
+
98
+ **Goal:** improve structure without changing behavior. Tests must stay green throughout.
99
+
100
+ ### What to refactor
101
+ - **Duplication** — extract function / method / class
102
+ - **Long methods** — split when one method does multiple things
103
+ - **Bad names** — rename to reveal intent (most underrated refactor)
104
+ - **Dead branches** — remove code no test exercises
105
+ - **Coupling** — break dependencies that make tests painful
106
+
107
+ ### Rules
108
+ - **Run tests after every change** — green is the safety net
109
+ - **One refactor at a time** — extract method, run tests, rename, run tests, …
110
+ - **No new behavior** — if a refactor needs a new test, you're not refactoring, go back to RED
111
+
112
+ ### When NOT to refactor
113
+ - Tests are flaky — fix the flakiness first
114
+ - You're under time pressure — skip refactor, leave a TODO with link to a follow-up task
115
+ - The code will be deleted soon — don't polish trash
116
+
117
+ ### Gate
118
+ - [ ] All tests still green
119
+ - [ ] No new public API added
120
+ - [ ] Code is easier to read than before
121
+
122
+ ---
123
+
124
+ ## Test patterns per layer (DDD)
125
+
126
+ | Layer | Test type | Dependencies | Example |
127
+ |-------|-----------|--------------|---------|
128
+ | Value Object | Unit (pure) | None | `Money.add()` |
129
+ | Entity | Unit (pure) | None | `Order.cancel()` raises event |
130
+ | UseCase | Unit | Mock ports | `CreateOrder` calls `OrderStore.save()` |
131
+ | Handler / Controller | Integration | Real router, mock service | `POST /orders` returns 201 |
132
+ | Infrastructure | Integration | Real DB / testcontainers | `OrderRepository.save()` persists |
133
+ | Listener | Unit | Mock infra | `on_order_created` sends email |
134
+
135
+ ### Mock vs real
136
+ - Mock **interfaces** (ports), not concrete classes
137
+ - Use real value objects and entities in tests — they're pure, no need to mock
138
+ - Use real DB in infra tests via testcontainers or in-memory variant
139
+
140
+ ---
141
+
142
+ ## Common Mistakes
143
+
144
+ | Mistake | Why it's bad | Fix |
145
+ |---------|--------------|-----|
146
+ | Writing tests AFTER the code | You'll test what's written, not what's needed | Always RED first |
147
+ | Testing implementation, not behavior | Refactor breaks tests | Assert on outputs / observable state |
148
+ | One test covers many behaviors | Fail message is unclear | One behavior per test |
149
+ | Mocking value objects | Brittle, no real benefit | Use real ones — they're pure |
150
+ | Skipping the REFACTOR phase | Tech debt accumulates | It's a phase, not optional |
151
+ | Test depends on order | Flaky | Each test sets up its own state |
152
+
153
+ ---
154
+
155
+ ## Final Report
156
+
157
+ ```markdown
158
+ ## TDD Cycle Complete: {feature}
159
+
160
+ ### Cycles Done
161
+ | # | RED behavior | GREEN | REFACTOR |
162
+ |---|-------------|-------|----------|
163
+ | 1 | {behavior} | {code added} | {what cleaned} |
164
+ | 2 | ... | ... | ... |
165
+
166
+ ### Test Coverage
167
+ - {N} tests, all passing
168
+ - Coverage: {%} (target: ≥80% for domain layer)
169
+
170
+ ### Files
171
+ - Tests: {paths}
172
+ - Code: {paths}
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Hard Rules
178
+
179
+ - **RED first, always** — never write production code without a failing test driving it
180
+ - **Minimal GREEN** — hardcode if the test allows it; triangulate later
181
+ - **REFACTOR is a phase, not optional**
182
+ - **All tests green at all times** (except briefly during RED)
183
+ - **One behavior per test**, named after the behavior
184
+
185
+ ---
186
+
187
+ ## Related Skills
188
+
189
+ | When | Use |
190
+ |------|-----|
191
+ | Building a feature from scratch (with TDD inside) | `/feature:new` + this skill |
192
+ | Adding regression test for a bug | `/fix:hotfix` or `/fix:root-cause` → then this skill |
193
+ | Refactoring untested legacy code (add tests first) | `refactor` |
194
+ | Reviewing test quality on a PR | `/review:pr` |
195
+
196
+ ---
197
+
198
+ ## Recommended Agents
199
+
200
+ | Phase | Agent | Purpose |
201
+ |-------|-------|---------|
202
+ | RED | `@test-writer` | Write failing tests first |
203
+ | GREEN | Stack-specific dev agent | Minimal implementation |
204
+ | REFACTOR | `@refactor` | Clean up patterns |
205
+ | REFACTOR | `@code-reviewer` | Review refactored code |
206
+ | REFACTOR | `@perf-optimizer` | Performance tweaks (only with benchmarks) |
package/bin/cli.js CHANGED
@@ -9,6 +9,7 @@ import { postinstallCommand } from '../dist/commands/postinstall.js';
9
9
  import { enableCommand } from '../dist/commands/enable.js';
10
10
  import { disableCommand } from '../dist/commands/disable.js';
11
11
  import { statusCommand } from '../dist/commands/status.js';
12
+ import { upgradeCommand } from '../dist/commands/upgrade.js';
12
13
 
13
14
  const require = createRequire(import.meta.url);
14
15
  const pkg = require('../package.json');
@@ -26,7 +27,7 @@ program
26
27
  .option('-g, --global', 'Install globally')
27
28
  .option('-p, --project', 'Install to current project')
28
29
  .option('-a, --all', 'Install both globally and to project')
29
- .option('-t, --target <editor>', 'Target editor (claude, cursor, windsurf, antigravity)')
30
+ .option('-t, --target <editor>', 'Target editor (claude, codex, cursor, windsurf, antigravity)')
30
31
  .option('--symlink', 'Force symlinks (default on macOS/Linux)')
31
32
  .option('--no-symlink', 'Force copy (default on Windows)')
32
33
  .action(installCommand);
@@ -37,6 +38,7 @@ program
37
38
  .option('-g, --global', 'Uninstall from ~/.claude/')
38
39
  .option('-p, --project', 'Uninstall from current project ./.claude/')
39
40
  .option('-a, --all', 'Uninstall from both locations')
41
+ .option('-t, --target <editor>', 'Target editor (claude, codex, cursor, windsurf, antigravity)')
40
42
  .action(uninstallCommand);
41
43
 
42
44
  program
@@ -44,6 +46,7 @@ program
44
46
  .description('List installed agents, commands, and skills')
45
47
  .option('-g, --global', 'List global installations')
46
48
  .option('-p, --project', 'List project installations')
49
+ .option('-t, --target <editor>', 'Target editor (claude, codex)')
47
50
  .action(listCommand);
48
51
 
49
52
  program
@@ -72,6 +75,14 @@ program
72
75
  .description('Show enabled/disabled status of all items')
73
76
  .option('-g, --global', 'Show global status')
74
77
  .option('-p, --project', 'Show project status')
78
+ .option('-t, --target <editor>', 'Target editor (claude, codex)')
75
79
  .action(statusCommand);
76
80
 
81
+ program
82
+ .command('upgrade')
83
+ .description('Upgrade moicle to the latest version from npm')
84
+ .option('-y, --yes', 'Skip confirmation prompt')
85
+ .option('--reinstall', 'Automatically re-run "moicle install" after upgrade')
86
+ .action(upgradeCommand);
87
+
77
88
  program.parse();
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAmC,MAAM,aAAa,CAAC;AA8QnF,eAAO,MAAM,cAAc,GAAU,SAAS,cAAc,KAAG,OAAO,CAAC,IAAI,CAuG1E,CAAC"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAmC,MAAM,aAAa,CAAC;AAyenF,eAAO,MAAM,cAAc,GAAU,SAAS,cAAc,KAAG,OAAO,CAAC,IAAI,CA0H1E,CAAC"}