@claude-code-mastery/starter-kit 1.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.
- package/.claude/.starter-kit/profiles/clean.md +113 -0
- package/.claude/.starter-kit/profiles/go.md +458 -0
- package/.claude/.starter-kit/profiles/node.md +429 -0
- package/.claude/.starter-kit/profiles/python.md +475 -0
- package/.claude/.starter-kit/shared/analytics-rybbit.md +55 -0
- package/.claude/.starter-kit/shared/claude-md-base.md +93 -0
- package/.claude/.starter-kit/shared/deployment-dokploy.md +158 -0
- package/.claude/.starter-kit/shared/feature-manifest.md +43 -0
- package/.claude/.starter-kit/shared/mcp-and-pooler.md +38 -0
- package/.claude/.starter-kit/shared/mongo-setup.md +20 -0
- package/.claude/.starter-kit/shared/profile-config.md +65 -0
- package/.claude/.starter-kit/shared/seo.md +113 -0
- package/.claude/.starter-kit/shared/sql-setup.md +37 -0
- package/.claude/commands/add-feature.md +349 -0
- package/.claude/commands/add-project-setup.md +156 -0
- package/.claude/commands/architecture.md +27 -0
- package/.claude/commands/commit.md +61 -0
- package/.claude/commands/convert-project-to-starter-kit.md +508 -0
- package/.claude/commands/create-api.md +385 -0
- package/.claude/commands/create-e2e.md +230 -0
- package/.claude/commands/diagram.md +301 -0
- package/.claude/commands/help.md +120 -0
- package/.claude/commands/install-global.md +145 -0
- package/.claude/commands/new-project.md +244 -0
- package/.claude/commands/optimize-docker.md +352 -0
- package/.claude/commands/progress.md +61 -0
- package/.claude/commands/projects-created.md +79 -0
- package/.claude/commands/quickstart.md +105 -0
- package/.claude/commands/refactor.md +267 -0
- package/.claude/commands/remove-project.md +95 -0
- package/.claude/commands/review.md +59 -0
- package/.claude/commands/security-check.md +77 -0
- package/.claude/commands/set-project-profile-default.md +79 -0
- package/.claude/commands/setup.md +337 -0
- package/.claude/commands/show-user-guide.md +58 -0
- package/.claude/commands/starter-kit.md +90 -0
- package/.claude/commands/test-plan.md +118 -0
- package/.claude/commands/update-project.md +413 -0
- package/.claude/commands/what-is-my-ai-doing.md +42 -0
- package/.claude/commands/worktree.md +124 -0
- package/.claude/hooks/block-dangerous-bash.py +55 -0
- package/.claude/hooks/check-branch.sh +116 -0
- package/.claude/hooks/check-e2e.sh +71 -0
- package/.claude/hooks/check-env-sync.sh +41 -0
- package/.claude/hooks/check-file-length.py +47 -0
- package/.claude/hooks/check-ports.sh +59 -0
- package/.claude/hooks/check-rulecatch.sh +33 -0
- package/.claude/hooks/check-rybbit.sh +63 -0
- package/.claude/hooks/lint-on-save.sh +59 -0
- package/.claude/hooks/verify-no-secrets.sh +80 -0
- package/.claude/settings.json +34 -0
- package/.claude/skills/api-conventions/SKILL.md +34 -0
- package/.claude/skills/code-review/SKILL.md +87 -0
- package/.claude/skills/code-review/references/mongodb-checks.md +25 -0
- package/.claude/skills/code-review/references/project-checks.md +38 -0
- package/.claude/skills/create-service/SKILL.md +222 -0
- package/.claude/skills/debugger/SKILL.md +39 -0
- package/.claude/skills/dependency-vetting/SKILL.md +46 -0
- package/.claude/skills/design-review/SKILL.md +50 -0
- package/.claude/skills/mcp-builder/SKILL.md +57 -0
- package/.claude/skills/mongodb-rules/SKILL.md +62 -0
- package/.claude/skills/terminal-tui/SKILL.md +106 -0
- package/.claude/skills/test-writer/SKILL.md +78 -0
- package/LICENSE +21 -0
- package/README.md +2152 -0
- package/bin/cli.js +205 -0
- package/claude-mastery-project.conf +220 -0
- package/global-claude-md/CLAUDE.md +212 -0
- package/global-claude-md/settings.json +3 -0
- package/package.json +81 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Update a starter-kit project with the latest commands, hooks, skills, and rules
|
|
3
|
+
scope: starter-kit
|
|
4
|
+
argument-hint: [--force | --clean]
|
|
5
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Update Starter Kit Project
|
|
9
|
+
|
|
10
|
+
Update an existing starter-kit project with the latest commands, hooks, skills, and rules from the current starter kit source. Smart merge — replaces starter kit files with newer versions while preserving any custom files the user created themselves.
|
|
11
|
+
|
|
12
|
+
**Arguments:** $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Step 0 — Resolve Source (Starter Kit)
|
|
17
|
+
|
|
18
|
+
Find the starter kit source directory:
|
|
19
|
+
|
|
20
|
+
1. If CWD has BOTH `claude-mastery-project.conf` AND `.claude/commands/new-project.md` → use CWD as `$SOURCE`
|
|
21
|
+
2. Else read `~/.claude/starter-kit-source-path` → verify it still has both files
|
|
22
|
+
3. Else ask via AskUserQuestion: "Where is the starter kit cloned?" with a text input
|
|
23
|
+
|
|
24
|
+
Store as `$SOURCE`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Step 1 — Registry Picker (Select Target)
|
|
29
|
+
|
|
30
|
+
1. Read `~/.claude/starter-kit-projects.json`
|
|
31
|
+
- If file doesn't exist or empty → error: "No projects found. Use `/new-project` to create one first."
|
|
32
|
+
- If file is invalid JSON → error: "Project registry is corrupted. Check `~/.claude/starter-kit-projects.json`."
|
|
33
|
+
|
|
34
|
+
2. Filter to projects whose `path` directory still exists on disk
|
|
35
|
+
|
|
36
|
+
3. If no valid projects remain → error: "No registered projects found on disk. Use `/new-project` to create one."
|
|
37
|
+
|
|
38
|
+
4. Display list with AskUserQuestion:
|
|
39
|
+
- "Which project do you want to update?"
|
|
40
|
+
- Options: up to 4 most recent projects (by `createdAt`), each showing: `name — language/framework — path`
|
|
41
|
+
- If more than 4: the 4th option should be "Other (type a path)"
|
|
42
|
+
|
|
43
|
+
5. Store selected path as `$TARGET`
|
|
44
|
+
|
|
45
|
+
### Validations (all must pass — stop with clear error if any fail)
|
|
46
|
+
|
|
47
|
+
1. `$TARGET` directory exists → if not: "Directory not found: $TARGET"
|
|
48
|
+
2. `$TARGET` is a git repo → run: `git -C "$TARGET" rev-parse --is-inside-work-tree 2>/dev/null`
|
|
49
|
+
- If not a git repo: "This project must be a git repo. Run `git init && git commit --allow-empty -m 'init'` first."
|
|
50
|
+
3. `$TARGET` is NOT the starter kit itself (compare resolved paths of `$SOURCE` and `$TARGET`)
|
|
51
|
+
- If same: "Cannot update the starter kit itself."
|
|
52
|
+
4. `$TARGET` is registered in `~/.claude/starter-kit-projects.json`
|
|
53
|
+
- If not registered: "This project isn't in the registry. Use `/convert-project-to-starter-kit` instead."
|
|
54
|
+
|
|
55
|
+
Parse flags from `$ARGUMENTS`:
|
|
56
|
+
- `--force` → set `$FORCE=true` (skips confirmation prompts)
|
|
57
|
+
- `--clean` → set `$CLEAN=true` (skip normal update, jump to **Clean Mode** section below)
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Step 2 — Safety Commit
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
cd "$TARGET"
|
|
65
|
+
git status --porcelain
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- **If uncommitted changes exist** (git status --porcelain has output):
|
|
69
|
+
```bash
|
|
70
|
+
cd "$TARGET" && git add -A && git commit -m "chore: pre-update snapshot (before starter kit update)"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- **If clean** (no uncommitted changes):
|
|
74
|
+
```bash
|
|
75
|
+
cd "$TARGET" && git commit --allow-empty -m "chore: pre-update marker (before starter kit update)"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Store the hash: `PRE_UPDATE_HASH=$(git -C "$TARGET" rev-parse HEAD)`
|
|
79
|
+
|
|
80
|
+
**STOP if git fails** (except "nothing to commit" which is fine — treat as clean).
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Step 3 — Inventory & Diff
|
|
85
|
+
|
|
86
|
+
Build a manifest of what the starter kit currently has vs what the target has.
|
|
87
|
+
|
|
88
|
+
### Categories to compare
|
|
89
|
+
|
|
90
|
+
| Category | Source Location | Target Location |
|
|
91
|
+
|----------|----------------|-----------------|
|
|
92
|
+
| Commands | `$SOURCE/.claude/commands/*.md` (scope: project only) | `$TARGET/.claude/commands/*.md` |
|
|
93
|
+
| Hooks | `$SOURCE/.claude/hooks/*.{sh,py}` | `$TARGET/.claude/hooks/*.{sh,py}` |
|
|
94
|
+
| Skills | `$SOURCE/.claude/skills/*/SKILL.md` | `$TARGET/.claude/skills/*/SKILL.md` |
|
|
95
|
+
|
|
96
|
+
**Command scope filtering:** Only include source commands that have `scope: project` in their YAML frontmatter. Commands with `scope: starter-kit` are kit-management commands and should never be copied to projects. If the target already has a starter-kit-scoped command (e.g., from a previous version), classify it as **CUSTOM** (user-created) — never overwrite or remove it.
|
|
97
|
+
|
|
98
|
+
### For each file, classify as:
|
|
99
|
+
|
|
100
|
+
- **NEW** — exists in source, not in target → will be added
|
|
101
|
+
- **UPDATED** — exists in both, content differs (compare with `diff -q`) → will be replaced
|
|
102
|
+
- **UNCHANGED** — exists in both, content is identical → skip
|
|
103
|
+
- **CUSTOM** — exists in target only, not in source → never touched (user-created)
|
|
104
|
+
|
|
105
|
+
### Display the diff report
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
=== Starter Kit Update Report ===
|
|
109
|
+
|
|
110
|
+
Target: $TARGET
|
|
111
|
+
Source: $SOURCE
|
|
112
|
+
|
|
113
|
+
Commands:
|
|
114
|
+
+ NEW: update-project.md, show-user-guide.md
|
|
115
|
+
↻ UPDATED: commit.md, review.md (starter kit versions changed)
|
|
116
|
+
= UNCHANGED: help.md, progress.md, ... (12 files)
|
|
117
|
+
○ CUSTOM: my-custom-command.md (yours, not touched)
|
|
118
|
+
|
|
119
|
+
Hooks:
|
|
120
|
+
+ NEW: (none)
|
|
121
|
+
↻ UPDATED: check-branch.sh
|
|
122
|
+
= UNCHANGED: lint-on-save.sh, verify-no-secrets.sh, ...
|
|
123
|
+
○ CUSTOM: (none)
|
|
124
|
+
|
|
125
|
+
Skills: (all unchanged)
|
|
126
|
+
Agents: (all unchanged)
|
|
127
|
+
|
|
128
|
+
settings.json: hooks will be deep-merged
|
|
129
|
+
CLAUDE.md: 3 new sections will be appended
|
|
130
|
+
Infrastructure: .gitignore (2 lines to add), .env.example (1 key to add)
|
|
131
|
+
|
|
132
|
+
Total: N files to add, N files to update, N unchanged, N custom (untouched)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Step 3b — Feature File Inventory
|
|
138
|
+
|
|
139
|
+
After the infrastructure diff above, also check for feature source files to update.
|
|
140
|
+
|
|
141
|
+
1. Read `$TARGET/.claude/features.json`
|
|
142
|
+
2. **If exists:** extract the list of installed features from `features` object
|
|
143
|
+
3. **If missing (legacy project):** auto-detect features from file presence:
|
|
144
|
+
- `strictdb` in `package.json` dependencies → feature `mongo` (or `postgres` — StrictDB handles both)
|
|
145
|
+
- `vitest.config.ts` exists → feature `vitest`
|
|
146
|
+
- `playwright.config.ts` exists → feature `playwright`
|
|
147
|
+
- `scripts/build-content.ts` exists → feature `content`
|
|
148
|
+
- `Dockerfile` exists → feature `docker`
|
|
149
|
+
- If any features detected, ask: "Detected features: [list]. Write manifest for future updates?" via AskUserQuestion
|
|
150
|
+
- **Yes, write manifest** (Recommended) → create `.claude/features.json` with detected features
|
|
151
|
+
- **No, skip** → continue without manifest
|
|
152
|
+
|
|
153
|
+
4. For each installed feature, read the feature definitions from `$SOURCE/.claude/commands/add-feature.md` (the Feature Definitions table)
|
|
154
|
+
|
|
155
|
+
5. For each file listed in the feature definition, compare `$SOURCE/<file>` vs `$TARGET/<file>`:
|
|
156
|
+
- File exists in both, content differs → **UPDATED**
|
|
157
|
+
- File exists in both, content identical → **UNCHANGED**
|
|
158
|
+
- File exists in source only → **NEW** (file was added to the feature since installation)
|
|
159
|
+
- File exists in target only → **CUSTOM** (user added it, don't touch)
|
|
160
|
+
|
|
161
|
+
6. Append feature file status to the diff report:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
Feature Files:
|
|
165
|
+
mongo:
|
|
166
|
+
↻ UPDATED: scripts/db-query.ts
|
|
167
|
+
= UNCHANGED: scripts/db-query.ts, scripts/queries/*
|
|
168
|
+
vitest:
|
|
169
|
+
= UNCHANGED: vitest.config.ts
|
|
170
|
+
(N features, N files updated, N unchanged)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
If no features installed or no feature files changed, show:
|
|
174
|
+
```
|
|
175
|
+
Feature Files: (none installed or all unchanged)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Step 4 — Confirm (unless --force)
|
|
181
|
+
|
|
182
|
+
If not `$FORCE`, ask via AskUserQuestion:
|
|
183
|
+
|
|
184
|
+
"Apply these updates? N new files, N updated files. Your custom files won't be touched."
|
|
185
|
+
- **Yes, update** (Recommended)
|
|
186
|
+
- **Show me the diffs first** — for each UPDATED file, show `diff` output between source and target, then ask again
|
|
187
|
+
- **No, cancel**
|
|
188
|
+
|
|
189
|
+
If user selects "No, cancel" → stop immediately with: "Update cancelled. No changes made."
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Step 5 — Apply Updates
|
|
194
|
+
|
|
195
|
+
### 5a. Commands, Hooks, Skills, Agents
|
|
196
|
+
|
|
197
|
+
For each **NEW** file: copy from source to target.
|
|
198
|
+
For each **UPDATED** file: overwrite target with source version.
|
|
199
|
+
For **CUSTOM** and **UNCHANGED**: skip entirely.
|
|
200
|
+
|
|
201
|
+
For skills: copy the entire skill directory (e.g., `$SOURCE/.claude/skills/code-review/` → `$TARGET/.claude/skills/code-review/`).
|
|
202
|
+
|
|
203
|
+
> Never copy `.starter-kit/` into a project. It is kit-internal scaffolding for `/new-project` and has no role in a scaffolded project.
|
|
204
|
+
|
|
205
|
+
Make hooks executable:
|
|
206
|
+
```bash
|
|
207
|
+
chmod +x "$TARGET/.claude/hooks/"*.sh 2>/dev/null
|
|
208
|
+
chmod +x "$TARGET/.claude/hooks/"*.py 2>/dev/null
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 5b. settings.json — Deep Merge
|
|
212
|
+
|
|
213
|
+
Same merge logic as `/convert-project-to-starter-kit`:
|
|
214
|
+
|
|
215
|
+
1. Read both `$SOURCE/.claude/settings.json` and `$TARGET/.claude/settings.json` as JSON
|
|
216
|
+
2. `permissions.deny`: merge arrays, deduplicate by value
|
|
217
|
+
3. For each hook event type (`PreToolUse`, `PostToolUse`, `Stop`):
|
|
218
|
+
- For each matcher entry in source: check if target already has same matcher string
|
|
219
|
+
- Same matcher → merge the `hooks` arrays (deduplicate by `command` string)
|
|
220
|
+
- New matcher → add entire entry to target
|
|
221
|
+
4. NEVER remove existing entries from target
|
|
222
|
+
5. Write merged result to `$TARGET/.claude/settings.json`
|
|
223
|
+
|
|
224
|
+
If target has no `.claude/settings.json`: copy from source directly.
|
|
225
|
+
|
|
226
|
+
### 5c. CLAUDE.md — Section Merge
|
|
227
|
+
|
|
228
|
+
Same as `/convert-project-to-starter-kit`:
|
|
229
|
+
|
|
230
|
+
1. Parse both by `## ` (h2) headers
|
|
231
|
+
2. For each section in source not in target → append at end of target CLAUDE.md
|
|
232
|
+
3. For Critical Rules: sub-merge by `### ` (h3) numbered rules — add missing rules, keep existing
|
|
233
|
+
4. NEVER remove or replace existing sections
|
|
234
|
+
|
|
235
|
+
If target has no `CLAUDE.md`: skip (don't create — the project should already have one from initial creation).
|
|
236
|
+
|
|
237
|
+
### 5d. Feature File Updates
|
|
238
|
+
|
|
239
|
+
If Step 3b identified any **UPDATED** or **NEW** feature files:
|
|
240
|
+
|
|
241
|
+
- For each **NEW** file: create directories and copy from source
|
|
242
|
+
- For each **UPDATED** file: overwrite target with source version
|
|
243
|
+
- For **UNCHANGED** and **CUSTOM** files: skip
|
|
244
|
+
|
|
245
|
+
After copying, update the manifest `$TARGET/.claude/features.json`:
|
|
246
|
+
- For each affected feature, set `updatedAt` to current ISO timestamp
|
|
247
|
+
- Add any new files to the feature's `files` array
|
|
248
|
+
|
|
249
|
+
If no feature files were changed, skip this step entirely.
|
|
250
|
+
|
|
251
|
+
### 5e. Infrastructure Files
|
|
252
|
+
|
|
253
|
+
| File | If Missing in Target | If Exists in Target |
|
|
254
|
+
|------|---------------------|---------------------|
|
|
255
|
+
| `CLAUDE.local.md` | Copy from source | Skip |
|
|
256
|
+
| `claude-mastery-project.conf` | Copy from source | Skip |
|
|
257
|
+
| `project-docs/ARCHITECTURE.md` | Create `project-docs/` dir, copy | Skip |
|
|
258
|
+
| `project-docs/INFRASTRUCTURE.md` | Copy | Skip |
|
|
259
|
+
| `project-docs/DECISIONS.md` | Copy | Skip |
|
|
260
|
+
| `.env.example` | Copy from source | Merge: read both, add lines from source whose key name (before `=`) doesn't exist in target. Append missing lines at end. |
|
|
261
|
+
| `.gitignore` | Copy from source | Merge: add lines from source that don't exist in target. Ensure `.env`, `CLAUDE.local.md`, `_ai_temp/` are present. |
|
|
262
|
+
| `.dockerignore` | Copy from source | Merge: add lines from source that don't exist in target. |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Step 6 — Update Registry
|
|
267
|
+
|
|
268
|
+
1. Read `~/.claude/starter-kit-projects.json`
|
|
269
|
+
2. Find the project entry by `path` matching `$TARGET`
|
|
270
|
+
3. Add or update `updatedAt` field with current ISO timestamp
|
|
271
|
+
4. Increment `updateCount` field (start at 1 if missing, increment if exists)
|
|
272
|
+
5. Write updated registry back to `~/.claude/starter-kit-projects.json`
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Step 7 — Commit + Summary
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
cd "$TARGET"
|
|
280
|
+
git add -A
|
|
281
|
+
git commit -m "chore: update Claude Code Starter Kit infrastructure"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Store: `UPDATE_HASH=$(git -C "$TARGET" rev-parse HEAD)`
|
|
285
|
+
|
|
286
|
+
**If nothing to commit** (all files unchanged): skip the commit, note "Already up to date."
|
|
287
|
+
|
|
288
|
+
### Display summary
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
=== Starter Kit Update Complete ===
|
|
292
|
+
|
|
293
|
+
Target: $TARGET
|
|
294
|
+
|
|
295
|
+
Commands: N added, N updated, N unchanged, N custom
|
|
296
|
+
Hooks: N added, N updated, N unchanged, N custom
|
|
297
|
+
Skills: N added, N updated, N unchanged, N custom
|
|
298
|
+
Agents: N added, N updated, N unchanged, N custom
|
|
299
|
+
Feature Files: N updated, N unchanged (across N features)
|
|
300
|
+
settings.json: deep merged (N new hooks added) / unchanged / copied
|
|
301
|
+
CLAUDE.md: N sections added, N skipped (exists)
|
|
302
|
+
Infrastructure: N files added, N merged, N skipped
|
|
303
|
+
|
|
304
|
+
Pre-update commit: $PRE_UPDATE_HASH
|
|
305
|
+
Update commit: $UPDATE_HASH
|
|
306
|
+
|
|
307
|
+
To undo: git revert HEAD
|
|
308
|
+
To review: git diff $PRE_UPDATE_HASH..HEAD
|
|
309
|
+
|
|
310
|
+
Next: Run /help to see any new commands.
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Edge Cases
|
|
316
|
+
|
|
317
|
+
1. **Already up to date** — If all files are UNCHANGED and no infrastructure changes needed, report "Already up to date — no changes needed." and skip the update commit.
|
|
318
|
+
|
|
319
|
+
2. **Target has no .claude/ directory** — This shouldn't happen for registered projects, but if it does, create the directories and treat all files as NEW.
|
|
320
|
+
|
|
321
|
+
3. **Git fails** — If any git operation fails (commit, add), stop with a clear error. Never leave the project in a half-updated state.
|
|
322
|
+
|
|
323
|
+
4. **Custom files with same name as starter kit** — If a user happened to create a file with the same name as a starter kit file (e.g., `help.md`), it will show as UPDATED (content differs). The diff report makes this visible before applying.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Clean Mode — `--clean`
|
|
328
|
+
|
|
329
|
+
**If `$CLEAN` is true, skip Steps 2-7 entirely and run this flow instead.**
|
|
330
|
+
|
|
331
|
+
Clean mode scans a project for commands that have `scope: starter-kit` in their frontmatter — these are kit-management commands that should NOT be in scaffolded projects. Older versions of the starter kit copied all commands without filtering, so existing projects may have them.
|
|
332
|
+
|
|
333
|
+
### Clean Step 1 — Scan for starter-kit commands
|
|
334
|
+
|
|
335
|
+
Read every `.md` file in `$TARGET/.claude/commands/`. For each file, parse the YAML frontmatter and check for `scope: starter-kit`.
|
|
336
|
+
|
|
337
|
+
Build a list of files to remove.
|
|
338
|
+
|
|
339
|
+
### Clean Step 2 — Display findings
|
|
340
|
+
|
|
341
|
+
If no `scope: starter-kit` commands found:
|
|
342
|
+
```
|
|
343
|
+
No cleanup needed — this project has no starter-kit-scoped commands.
|
|
344
|
+
```
|
|
345
|
+
Stop here.
|
|
346
|
+
|
|
347
|
+
If found, display the list:
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
=== Clean: Starter-Kit Commands Found ===
|
|
351
|
+
|
|
352
|
+
These commands are kit-management tools that don't belong in project repos:
|
|
353
|
+
|
|
354
|
+
1. new-project.md — Create a new project with all scaffolding rules applied
|
|
355
|
+
2. update-project.md — Update a starter-kit project with the latest commands, hooks, skills, and rules
|
|
356
|
+
3. install-global.md — Install global Claude config
|
|
357
|
+
4. convert-project-to-starter-kit.md — Merge starter kit into an existing project
|
|
358
|
+
5. quickstart.md — Interactive first-run walkthrough for new users
|
|
359
|
+
6. projects-created.md — List all projects created by the starter kit
|
|
360
|
+
7. remove-project.md — Remove a project from the registry
|
|
361
|
+
8. set-project-profile-default.md — Set the default profile for /new-project
|
|
362
|
+
9. add-project-setup.md — Create a named project profile
|
|
363
|
+
10. add-feature.md — Add capabilities to an existing project
|
|
364
|
+
|
|
365
|
+
Found N starter-kit commands that should be removed.
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Clean Step 3 — Ask what to remove
|
|
369
|
+
|
|
370
|
+
Use AskUserQuestion:
|
|
371
|
+
|
|
372
|
+
"Which commands do you want to remove?"
|
|
373
|
+
- **Remove all N** (Recommended) — Delete all starter-kit-scoped commands
|
|
374
|
+
- **Let me pick** — Show each file and ask individually
|
|
375
|
+
|
|
376
|
+
**If "Remove all":** delete all listed files.
|
|
377
|
+
|
|
378
|
+
**If "Let me pick":** for each file, ask via AskUserQuestion (batch up to 4 at a time):
|
|
379
|
+
- "Remove `<filename>`? (<description>)"
|
|
380
|
+
- Yes, remove it
|
|
381
|
+
- No, keep it
|
|
382
|
+
|
|
383
|
+
### Clean Step 4 — Execute removal
|
|
384
|
+
|
|
385
|
+
For each file to remove:
|
|
386
|
+
```bash
|
|
387
|
+
rm "$TARGET/.claude/commands/<filename>"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Clean Step 5 — Commit + Summary
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
cd "$TARGET"
|
|
394
|
+
git add -A
|
|
395
|
+
git commit -m "chore: remove starter-kit-scoped commands (clean)"
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Display summary:
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
=== Clean Complete ===
|
|
402
|
+
|
|
403
|
+
Removed N starter-kit commands:
|
|
404
|
+
- new-project.md
|
|
405
|
+
- update-project.md
|
|
406
|
+
- ...
|
|
407
|
+
|
|
408
|
+
Kept N project commands.
|
|
409
|
+
|
|
410
|
+
To undo: git revert HEAD
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
**If nothing was removed** (user said "no" to everything): skip the commit, note "No changes made."
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Live monitor of everything your AI is doing — tokens, cost, violations, tool usage
|
|
3
|
+
scope: project
|
|
4
|
+
argument-hint: [--json]
|
|
5
|
+
allowed-tools: Bash, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# What Is My AI Doing?
|
|
9
|
+
|
|
10
|
+
Launch the RuleCatch AI-Pooler live monitor to see everything your AI is doing in real time.
|
|
11
|
+
|
|
12
|
+
**Arguments:** $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
## Step 1 — Launch the Free Monitor
|
|
15
|
+
|
|
16
|
+
Tell the user:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
The AI-Pooler monitor runs in a SEPARATE terminal window.
|
|
20
|
+
Open a new terminal and run:
|
|
21
|
+
|
|
22
|
+
npx @rulecatch/ai-pooler@latest monitor --no-api-key
|
|
23
|
+
|
|
24
|
+
This is free monitor mode — no API key, no account, no setup.
|
|
25
|
+
It shows you a live view of:
|
|
26
|
+
• Every tool call Claude makes (Read, Write, Edit, Bash, etc.)
|
|
27
|
+
• Token usage per turn
|
|
28
|
+
• Cost per session
|
|
29
|
+
• Which files are being accessed
|
|
30
|
+
|
|
31
|
+
Press Ctrl+C to stop the monitor.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Step 2 — Remind
|
|
35
|
+
|
|
36
|
+
After providing the instructions, remind the user:
|
|
37
|
+
|
|
38
|
+
- The monitor runs **outside** Claude's context — zero token overhead
|
|
39
|
+
- It watches ALL Claude sessions, not just this one
|
|
40
|
+
- This is the free preview — it shows what's happening but doesn't persist data
|
|
41
|
+
- **Want violation tracking, dashboards, and alerts?** Sign up at https://rulecatch.ai for a 7-day free trial, then run `npx @rulecatch/ai-pooler init --api-key=dc_your_key --region=us` to unlock the full experience
|
|
42
|
+
- With an API key, you also get the RuleCatch MCP server — Claude can query its own violations: "RuleCatch, what was violated today?"
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a git worktree + branch for an isolated task
|
|
3
|
+
scope: project
|
|
4
|
+
argument-hint: <branch-name> [base-branch]
|
|
5
|
+
allowed-tools: Bash, Read, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Git Worktree — Isolated Task Branch
|
|
9
|
+
|
|
10
|
+
Create a new git worktree so this task runs on its own branch in its own directory. Main stays untouched. If anything goes wrong, delete the branch — zero risk.
|
|
11
|
+
|
|
12
|
+
**Arguments:** $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
## Step 0 — Parse Arguments
|
|
15
|
+
|
|
16
|
+
- **First argument:** branch name (required). If not provided, ASK the user.
|
|
17
|
+
- **Second argument:** base branch to branch from (optional, defaults to `main` or `master`)
|
|
18
|
+
|
|
19
|
+
Branch naming convention: `task/<descriptive-name>`
|
|
20
|
+
- If the user provides just a name like `auth-fix`, prefix it: `task/auth-fix`
|
|
21
|
+
- If they already include a prefix like `feat/login`, use as-is
|
|
22
|
+
|
|
23
|
+
## Step 1 — Verify Git State
|
|
24
|
+
|
|
25
|
+
Before creating anything, verify:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Must be in a git repo
|
|
29
|
+
git rev-parse --git-dir
|
|
30
|
+
|
|
31
|
+
# Check for uncommitted changes on current branch
|
|
32
|
+
git status --porcelain
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**If there are uncommitted changes:** WARN the user. Ask if they want to:
|
|
36
|
+
- Stash changes first (`git stash`)
|
|
37
|
+
- Commit changes first
|
|
38
|
+
- Abort
|
|
39
|
+
|
|
40
|
+
**NEVER create a worktree with dirty state** — changes could bleed between worktrees.
|
|
41
|
+
|
|
42
|
+
## Step 2 — Determine Base Branch
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Find the default branch (main or master)
|
|
46
|
+
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If no remote, fall back to checking if `main` or `master` exists locally.
|
|
50
|
+
|
|
51
|
+
Use the second argument if provided, otherwise use the detected default branch.
|
|
52
|
+
|
|
53
|
+
## Step 3 — Create Branch + Worktree
|
|
54
|
+
|
|
55
|
+
The worktree directory goes next to the current repo as `../<repo-name>--<branch-name>`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Example: if repo is at ~/projects/my-app and branch is task/auth-fix
|
|
59
|
+
# Worktree goes to ~/projects/my-app--task-auth-fix
|
|
60
|
+
|
|
61
|
+
REPO_NAME=$(basename "$(git rev-parse --show-toplevel)")
|
|
62
|
+
BRANCH_NAME="$1"
|
|
63
|
+
WORKTREE_DIR="../${REPO_NAME}--${BRANCH_NAME//\//-}"
|
|
64
|
+
|
|
65
|
+
# Create the branch and worktree in one step
|
|
66
|
+
git worktree add -b "$BRANCH_NAME" "$WORKTREE_DIR" "$BASE_BRANCH"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Step 4 — Verify
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# List all worktrees to confirm
|
|
73
|
+
git worktree list
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Step 5 — Report
|
|
77
|
+
|
|
78
|
+
Output a summary:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Git Worktree Created
|
|
82
|
+
====================
|
|
83
|
+
Branch: task/auth-fix
|
|
84
|
+
Base: main
|
|
85
|
+
Directory: ~/projects/my-app--task-auth-fix
|
|
86
|
+
Main repo: ~/projects/my-app (untouched)
|
|
87
|
+
|
|
88
|
+
Next steps:
|
|
89
|
+
cd ~/projects/my-app--task-auth-fix
|
|
90
|
+
claude # start a new Claude session here
|
|
91
|
+
|
|
92
|
+
When done:
|
|
93
|
+
cd ~/projects/my-app
|
|
94
|
+
git merge task/auth-fix # merge into main (or open a PR)
|
|
95
|
+
git worktree remove ../my-app--task-auth-fix
|
|
96
|
+
git branch -d task/auth-fix
|
|
97
|
+
|
|
98
|
+
If something went wrong:
|
|
99
|
+
git worktree remove ../my-app--task-auth-fix --force
|
|
100
|
+
git branch -D task/auth-fix # main was never touched
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## When the Task Is Done
|
|
104
|
+
|
|
105
|
+
When the user says they're done with work on a worktree branch, ALWAYS:
|
|
106
|
+
|
|
107
|
+
1. **Review the diff** — show `git diff main...HEAD` summary (files changed, insertions, deletions)
|
|
108
|
+
2. **Ask about RuleCatch** — "Do you want RuleCatch to check if any violations happened on this branch?"
|
|
109
|
+
- If yes AND the RuleCatch MCP server is available: query it for violations on this branch's files
|
|
110
|
+
- If yes but no MCP: suggest `npx @rulecatch/ai-pooler check` or checking the RuleCatch dashboard
|
|
111
|
+
- If no: skip and proceed to merge/PR
|
|
112
|
+
3. **Ask about merge** — "Ready to merge into main, or do you want to open a PR?"
|
|
113
|
+
|
|
114
|
+
This ensures every branch gets a quality check before it touches main.
|
|
115
|
+
|
|
116
|
+
## Quick Reference — Worktree Management
|
|
117
|
+
|
|
118
|
+
These commands manage ALL worktrees from the main repo:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git worktree list # see all active worktrees
|
|
122
|
+
git worktree remove ../my-app--branch-name # clean up finished task
|
|
123
|
+
git worktree prune # remove stale entries
|
|
124
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""PreToolUse (Bash) — block destructive or unsafe shell commands.
|
|
3
|
+
|
|
4
|
+
Covers the gaps the other Bash hooks don't: rm -rf, curl|sh (the remote-script-
|
|
5
|
+
into-a-shell pattern), force-pushing to main/master, chmod 777, and database
|
|
6
|
+
drops. Secrets at commit time are handled by verify-no-secrets.sh, and direct
|
|
7
|
+
commits to main by check-branch.sh, so this stays focused on irreversible damage.
|
|
8
|
+
Exit 2 blocks; run it yourself if you truly mean it.
|
|
9
|
+
"""
|
|
10
|
+
import json
|
|
11
|
+
import re
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
DANGER = [
|
|
15
|
+
(re.compile(r"\brm\s+.*-[a-z]*r[a-z]*f", re.I), "rm -rf (recursive force-remove)"),
|
|
16
|
+
(re.compile(r"\brm\s+.*-[a-z]*f[a-z]*r", re.I), "rm -fr (recursive force-remove)"),
|
|
17
|
+
(re.compile(r"\b(curl|wget)\b[^|]*\|\s*(sudo\s+)?(ba)?sh\b", re.I),
|
|
18
|
+
"piping a remote script straight into a shell (curl | sh)"),
|
|
19
|
+
(re.compile(r"\bgit\s+push\b.*--force(-with-lease)?\b.*\b(main|master)\b", re.I),
|
|
20
|
+
"force-pushing to main/master"),
|
|
21
|
+
(re.compile(r"\bgit\s+push\b.*\b(main|master)\b.*--force", re.I),
|
|
22
|
+
"force-pushing to main/master"),
|
|
23
|
+
(re.compile(r"\bchmod\s+-?R?\s*777\b", re.I), "chmod 777"),
|
|
24
|
+
(re.compile(r"\bDROP\s+(DATABASE|TABLE|COLLECTION)\b", re.I),
|
|
25
|
+
"a destructive database drop"),
|
|
26
|
+
(re.compile(r"\.drop(Database)?\(\s*\)", re.I), "dropping a MongoDB database/collection"),
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def main():
|
|
31
|
+
try:
|
|
32
|
+
data = json.load(sys.stdin)
|
|
33
|
+
except Exception:
|
|
34
|
+
sys.exit(0)
|
|
35
|
+
|
|
36
|
+
if data.get("tool_name") != "Bash":
|
|
37
|
+
sys.exit(0)
|
|
38
|
+
|
|
39
|
+
cmd = (data.get("tool_input", {}) or {}).get("command", "") or ""
|
|
40
|
+
if not cmd:
|
|
41
|
+
sys.exit(0)
|
|
42
|
+
|
|
43
|
+
for rx, label in DANGER:
|
|
44
|
+
if rx.search(cmd):
|
|
45
|
+
sys.stderr.write(
|
|
46
|
+
"Blocked: " + label + " is not allowed by the kit's safety hook. "
|
|
47
|
+
"If this is genuinely intended, run it yourself outside the agent.\n"
|
|
48
|
+
)
|
|
49
|
+
sys.exit(2)
|
|
50
|
+
|
|
51
|
+
sys.exit(0)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
main()
|