moicle 3.0.2 → 3.0.3
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.
- package/README.md +9 -3
- package/assets/skills/challenge/SKILL.md +70 -35
- package/assets/skills/cleanup/SKILL.md +121 -0
- package/package.json +1 -1
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
|
-
- **
|
|
19
|
+
- **11 Skills** - Mode-based, auto-triggered workflows for the full SDLC (feature, bug, review, research, docs, marketing) plus standalone `/challenge` (self-critique) and `/cleanup` (dead-code/duplicate)
|
|
20
20
|
- **9 Architecture References** - DDD + Hexagonal + stack-specific patterns
|
|
21
21
|
|
|
22
22
|
|
|
@@ -124,9 +124,9 @@ 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 (
|
|
127
|
+
### Skills (11)
|
|
128
128
|
|
|
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).
|
|
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). Two skills — `/challenge` and `/cleanup` — are intentionally standalone (no group prefix).
|
|
130
130
|
|
|
131
131
|
**`/feature-*` — Build & Change**
|
|
132
132
|
|
|
@@ -173,6 +173,12 @@ Skills are grouped by a `<group>-` prefix. Type `/<group>-` then `Tab` in Claude
|
|
|
173
173
|
|-------|-------|-------------|
|
|
174
174
|
| `/challenge` | — | A quick skeptical re-examination of what you just did (or selected code): simpler? duplicated? optimal? edge cases? — reports honest findings without self-congratulating. Lighter than `/review-code` SELF. |
|
|
175
175
|
|
|
176
|
+
**`/cleanup` — Dead Code & Duplicate** (standalone, no group)
|
|
177
|
+
|
|
178
|
+
| Skill | Modes | When to use |
|
|
179
|
+
|-------|-------|-------------|
|
|
180
|
+
| `/cleanup` | DEAD-CODE · DUPLICATE | Safely remove dead code / consolidate duplicates. Detects with stack tools, **verifies each hit with grep**, then classifies DELETE (true dead) vs KEEP (reusable utils/scopes/helpers — asks when unsure). Removes per-group with build+test each. |
|
|
181
|
+
|
|
176
182
|
### Skill decision matrix
|
|
177
183
|
|
|
178
184
|
When more than one skill / mode could fit, use this matrix:
|
|
@@ -1,57 +1,92 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: challenge
|
|
3
|
-
description:
|
|
3
|
+
description: Pause before committing to the current solution. Challenge your own reasoning, assumptions, and design. Look for a better approach before proceeding.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Challenge
|
|
6
|
+
# Challenge
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
You are no longer defending the current solution.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Become its strongest critic.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Assume there may be a simpler, safer, or more correct approach.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
2. **The change you just made** — otherwise, critique the code you produced or edited most recently in this session (check the working diff if unsure).
|
|
14
|
+
Your goal is not to find flaws at all costs.
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
Your goal is to determine whether the current direction is truly the best one.
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Re-evaluate
|
|
21
|
+
|
|
22
|
+
Ask yourself:
|
|
23
|
+
|
|
24
|
+
### Did I understand the problem correctly?
|
|
25
|
+
|
|
26
|
+
- Am I solving the actual problem?
|
|
27
|
+
- Did I silently assume requirements?
|
|
28
|
+
- Did I optimize for something the user never asked for?
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### Is there a simpler solution?
|
|
33
|
+
|
|
34
|
+
- Can I delete code instead of adding code?
|
|
35
|
+
- Can an existing abstraction be reused?
|
|
36
|
+
- Am I introducing flexibility that isn't needed?
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### Am I overengineering?
|
|
41
|
+
|
|
42
|
+
- Extra layers?
|
|
43
|
+
- Extra configuration?
|
|
44
|
+
- Generic framework for a single use case?
|
|
45
|
+
- Future-proofing without evidence?
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### What would I do if starting from scratch?
|
|
50
|
+
|
|
51
|
+
Ignore the current implementation.
|
|
52
|
+
|
|
53
|
+
Would I build it the same way?
|
|
54
|
+
|
|
55
|
+
If not, why?
|
|
56
|
+
|
|
57
|
+
---
|
|
20
58
|
|
|
21
|
-
|
|
59
|
+
### What's the weakest assumption?
|
|
22
60
|
|
|
23
|
-
|
|
61
|
+
Identify the assumption most likely to be wrong.
|
|
24
62
|
|
|
25
|
-
|
|
63
|
+
Explain how it could fail.
|
|
26
64
|
|
|
27
|
-
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### Explore one alternative
|
|
68
|
+
|
|
69
|
+
Briefly describe one different approach.
|
|
70
|
+
|
|
71
|
+
Do not choose it automatically.
|
|
72
|
+
|
|
73
|
+
State its main tradeoff.
|
|
74
|
+
|
|
75
|
+
---
|
|
28
76
|
|
|
29
|
-
|
|
30
|
-
|------|-----|
|
|
31
|
-
| **Simpler** | Is there a shorter / more direct way? Am I solving a problem I don't have? Any premature abstraction, needless layer, config, or generality? |
|
|
32
|
-
| **Duplication (DRY)** | Is this logic already implemented elsewhere in the codebase? Did I repeat a block that should be one helper? (Search before claiming "no dup".) |
|
|
33
|
-
| **Optimal** | Redundant work, N+1, re-fetch, re-compute in a loop, unnecessary allocation? Is the data structure the right one? |
|
|
34
|
-
| **Correctness edges** | Null / empty / boundary / large input / concurrent access / partial failure — which path did I not handle? |
|
|
35
|
-
| **Error handling** | Any swallowed error (empty catch, ignored return)? Failures must surface clearly and be logged, not muffled. |
|
|
36
|
-
| **Naming & footprint** | Misleading names? Did I rename/move things I didn't need to? Is any file getting too big / doing too much? |
|
|
37
|
-
| **Tests** | Is the risky path actually covered, or just the happy one? |
|
|
77
|
+
## Decision
|
|
38
78
|
|
|
39
|
-
|
|
79
|
+
Finish with one of:
|
|
40
80
|
|
|
41
|
-
Keep
|
|
81
|
+
### Keep current approach
|
|
42
82
|
|
|
43
|
-
|
|
44
|
-
⚠️ <one-line problem> · <file:line>
|
|
45
|
-
→ <concrete fix>
|
|
46
|
-
```
|
|
83
|
+
Explain *why* the alternatives are not better.
|
|
47
84
|
|
|
48
|
-
|
|
85
|
+
or
|
|
49
86
|
|
|
50
|
-
|
|
51
|
-
- **Genuinely nothing** → "Đã soi <các lens> trên <scope>, không thấy vấn đề thực sự. Điểm cần lưu ý nếu mở rộng sau: <1 dòng, nếu có>." State what you searched so the "clean" verdict is earned, not assumed.
|
|
87
|
+
### Better direction found
|
|
52
88
|
|
|
53
|
-
|
|
89
|
+
Explain what should change and why.
|
|
54
90
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- ❌ Actually implementing the fixes now → this skill *proposes*; apply only after the user says go.
|
|
91
|
+
Never change the code automatically.
|
|
92
|
+
Never fabricate issues.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cleanup
|
|
3
|
+
description: Safely remove dead code and consolidate duplicates. Two modes — DEAD-CODE (remove unreachable/unused code) and DUPLICATE (merge copy-paste into one canonical). Detect with stack-appropriate tools, VERIFY every hit with grep, then classify DELETE (true dead) vs KEEP (reusable utilities/helpers/scopes — never delete on a tool signal alone). Stack-aware. Use when the user says "cleanup", "clean up codebase", "dead code", "remove dead code", "remove unused code", "find unused code", "unused code", "declutter", "tech debt", "duplicate code", "consolidate duplicates", "copy-paste code".
|
|
4
|
+
args: "[MODE]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Cleanup Workflow
|
|
8
|
+
|
|
9
|
+
Remove rot **without deleting things worth keeping**. Tools only propose candidates — grep and judgment decide what actually goes. The classic failure is trusting a dead-code tool blindly and deleting reusable helpers, which turns a "cleanup" into a rejected mess.
|
|
10
|
+
|
|
11
|
+
## Pick your mode
|
|
12
|
+
|
|
13
|
+
| Situation | Mode | Jump to |
|
|
14
|
+
|-----------|------|---------|
|
|
15
|
+
| Remove unreachable / unused code | **DEAD-CODE** | [Mode DEAD-CODE](#mode-dead-code) |
|
|
16
|
+
| Consolidate copy-paste into one canonical | **DUPLICATE** | [Mode DUPLICATE](#mode-duplicate) |
|
|
17
|
+
|
|
18
|
+
Run either, or both in sequence. If scope is unclear, ask one line: *"Whole repo or just `<module>`? Delete directly, or report for review first?"* then proceed.
|
|
19
|
+
|
|
20
|
+
- ❌ Reformatting / renaming / restructuring working code → use `@refactor`.
|
|
21
|
+
- ❌ Reviewing a branch/PR for quality → use `/review-code`.
|
|
22
|
+
- ❌ A bug surfaced during cleanup → use `/fix-bug`.
|
|
23
|
+
|
|
24
|
+
## ⛔ Rule #1 — Keep reusable, delete only true dead (both modes)
|
|
25
|
+
|
|
26
|
+
> A tool reporting "unused / unreachable" is **not enough** to delete. Classify every candidate:
|
|
27
|
+
|
|
28
|
+
| | **DELETE** (true dead) | **KEEP** (reusable — ask if unsure) |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| What | Leftover of a removed feature · orphaned unit after a refactor · a real duplicate · an unreachable business flow | Generic utility / formatter / parser / query-scope helper · value-object accessors · intended public API surface · "might need it later" generic code |
|
|
31
|
+
| Tell | Tied to one specific dead feature/flow; deleting it, nobody rebuilds it | General-purpose helper not tied to any feature; deleting it means rewriting it later |
|
|
32
|
+
| Action | Delete | **Keep.** If unsure, list it and ask the user — do not auto-delete |
|
|
33
|
+
|
|
34
|
+
When torn between the two columns, **default to KEEP and ask**. A leftover helper is cheaper than deleting something the team meant to use.
|
|
35
|
+
|
|
36
|
+
## Read stack first (both modes)
|
|
37
|
+
|
|
38
|
+
Detect the stack via `~/.claude/architecture/_shared/stack-detection.md`, then use the matching tools. These only produce *candidates*; install if missing (tell the user).
|
|
39
|
+
|
|
40
|
+
| Stack | Dead code | Duplicate | Unused deps |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| **Go** | `deadcode -test ./...` (whole-program) + `staticcheck -checks U1000 ./...` (unexported/const/type/field) | `dupl` | `go mod tidy` (diff) |
|
|
43
|
+
| **TS/JS** | `knip` · `ts-prune` | `jscpd` | `depcheck` · `knip` |
|
|
44
|
+
| **Python** | `vulture` | `pylint --enable=duplicate-code` | `deptry` |
|
|
45
|
+
| **Dart/Flutter** | `dart analyze` | `dart_code_metrics` | `dart pub deps` |
|
|
46
|
+
| **Any** | — | — | LSP "no references" / editor find-usages |
|
|
47
|
+
|
|
48
|
+
> ⚠️ **Multiple entry points** (API + worker + cron/CLI): make **all** of them roots for the whole-program analysis. Otherwise code used only by one entry point is reported dead by mistake.
|
|
49
|
+
|
|
50
|
+
<a id="mode-dead-code"></a>
|
|
51
|
+
## Mode DEAD-CODE
|
|
52
|
+
|
|
53
|
+
### 1. Detect
|
|
54
|
+
Run the stack's dead-code tools to get the candidate list.
|
|
55
|
+
|
|
56
|
+
### 2. Verify each candidate with grep — don't trust the tool
|
|
57
|
+
Confirm **zero real references** before touching anything. Tools miss these cases:
|
|
58
|
+
|
|
59
|
+
- **Same name in different packages/modules** — a naive count matches the wrong symbol. Confirm the exact definition (path + namespace).
|
|
60
|
+
- **Interface / polymorphism** — several same-named constructors/handlers are separate *implementations of one contract* (one per adapter/driver). That is **not duplication — never merge them**; merging breaks the abstraction.
|
|
61
|
+
- **Reflection / registered-by-name** — event listeners, queue/cron tasks registered by string, ORM callbacks, test-suite methods. Whole-program tools can't see these → false "dead".
|
|
62
|
+
- **Test-only usage** — a helper only tests call: decide by policy (usually keep while tests use it).
|
|
63
|
+
|
|
64
|
+
### 3. Classify
|
|
65
|
+
Sort each verified candidate into **DELETE · KEEP · ASK · BACKLOG** (BACKLOG = dead but touches security/business semantics → don't decide alone; write it to a doc for the user).
|
|
66
|
+
|
|
67
|
+
### 4. Remove safely
|
|
68
|
+
1. **One commit per group** (by layer or by file); message states *what* and *why it's dead*.
|
|
69
|
+
2. After each group, clean orphaned imports, then **build + test + lint must stay green**.
|
|
70
|
+
3. Re-run the dead-code tool: removed symbols are gone, and **no new dead code appeared** (if deleting A orphaned B, handle B or stop and reassess).
|
|
71
|
+
4. **Check for orphaned flows**: if you removed a producer, is a listener/handler left dangling? If you removed an enqueue helper, does a scheduler still enqueue that task another way? Confirm the real flow still lives.
|
|
72
|
+
|
|
73
|
+
### 5. (Optional) Prevent regrowth
|
|
74
|
+
Propose wiring the unused-code check into the project's existing lint/CI so dead code can't silently regrow. Keep any intentional-keep items (BACKLOG) **informational**, not a hard gate.
|
|
75
|
+
|
|
76
|
+
<a id="mode-duplicate"></a>
|
|
77
|
+
## Mode DUPLICATE
|
|
78
|
+
|
|
79
|
+
### 1. Detect
|
|
80
|
+
Run the duplicate detector to find copy-paste blocks.
|
|
81
|
+
|
|
82
|
+
### 2. Confirm it's a REAL duplicate
|
|
83
|
+
Diff the two versions. It's only a duplicate if the **logic and behavior are identical**.
|
|
84
|
+
|
|
85
|
+
> **Never merge when semantics differ** — e.g. `""→nil` vs `""→pointer-to-empty`, `"1.000"` vs `"1,000"` formatting, two different normalization algorithms. Merging changes behavior = a bug. Write it to backlog instead of merging blindly.
|
|
86
|
+
|
|
87
|
+
### 3. Choose one canonical
|
|
88
|
+
Pick the correct home for the shared version, respecting the project's existing import/dependency direction (a helper used by lower-level code must live where that code can import it). Do **not** create a god `utils` package.
|
|
89
|
+
|
|
90
|
+
### 4. Redirect and remove
|
|
91
|
+
Point all call sites at the canonical, delete the extra copies, then build + test green.
|
|
92
|
+
|
|
93
|
+
## Output
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
## Cleanup: <mode> — <scope>
|
|
97
|
+
|
|
98
|
+
### Delete (verified 0 refs)
|
|
99
|
+
- <file:symbol> — <why dead: leftover / orphan / true duplicate>
|
|
100
|
+
|
|
101
|
+
### Keep (reusable — untouched)
|
|
102
|
+
- <file:symbol> — <why kept>
|
|
103
|
+
|
|
104
|
+
### Ask
|
|
105
|
+
- <file:symbol> — dead, but <reason for doubt>
|
|
106
|
+
|
|
107
|
+
### Backlog (dead, touches security/business)
|
|
108
|
+
- <file:symbol> — <decision needed>
|
|
109
|
+
|
|
110
|
+
### Verify: build ✅ · test ✅ · tool before→after: N → M
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If deleting: one commit per group; do **not** commit / push / open a PR unless the user asks.
|
|
114
|
+
|
|
115
|
+
## Boundaries
|
|
116
|
+
|
|
117
|
+
- ❌ Do not delete a reusable helper/scope/utility just because a tool flags it unused → **KEEP or ASK**.
|
|
118
|
+
- ❌ Do not merge functions with different semantics, and do not merge same-name interface implementations.
|
|
119
|
+
- ❌ Do not drop DB tables/columns/migrations during cleanup — that needs a separate explicit confirmation.
|
|
120
|
+
- ❌ Do not commit/push/open a PR unless the user explicitly asks.
|
|
121
|
+
- ✅ When in doubt, default to KEEP and ask.
|