@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.
Files changed (70) hide show
  1. package/.claude/.starter-kit/profiles/clean.md +113 -0
  2. package/.claude/.starter-kit/profiles/go.md +458 -0
  3. package/.claude/.starter-kit/profiles/node.md +429 -0
  4. package/.claude/.starter-kit/profiles/python.md +475 -0
  5. package/.claude/.starter-kit/shared/analytics-rybbit.md +55 -0
  6. package/.claude/.starter-kit/shared/claude-md-base.md +93 -0
  7. package/.claude/.starter-kit/shared/deployment-dokploy.md +158 -0
  8. package/.claude/.starter-kit/shared/feature-manifest.md +43 -0
  9. package/.claude/.starter-kit/shared/mcp-and-pooler.md +38 -0
  10. package/.claude/.starter-kit/shared/mongo-setup.md +20 -0
  11. package/.claude/.starter-kit/shared/profile-config.md +65 -0
  12. package/.claude/.starter-kit/shared/seo.md +113 -0
  13. package/.claude/.starter-kit/shared/sql-setup.md +37 -0
  14. package/.claude/commands/add-feature.md +349 -0
  15. package/.claude/commands/add-project-setup.md +156 -0
  16. package/.claude/commands/architecture.md +27 -0
  17. package/.claude/commands/commit.md +61 -0
  18. package/.claude/commands/convert-project-to-starter-kit.md +508 -0
  19. package/.claude/commands/create-api.md +385 -0
  20. package/.claude/commands/create-e2e.md +230 -0
  21. package/.claude/commands/diagram.md +301 -0
  22. package/.claude/commands/help.md +120 -0
  23. package/.claude/commands/install-global.md +145 -0
  24. package/.claude/commands/new-project.md +244 -0
  25. package/.claude/commands/optimize-docker.md +352 -0
  26. package/.claude/commands/progress.md +61 -0
  27. package/.claude/commands/projects-created.md +79 -0
  28. package/.claude/commands/quickstart.md +105 -0
  29. package/.claude/commands/refactor.md +267 -0
  30. package/.claude/commands/remove-project.md +95 -0
  31. package/.claude/commands/review.md +59 -0
  32. package/.claude/commands/security-check.md +77 -0
  33. package/.claude/commands/set-project-profile-default.md +79 -0
  34. package/.claude/commands/setup.md +337 -0
  35. package/.claude/commands/show-user-guide.md +58 -0
  36. package/.claude/commands/starter-kit.md +90 -0
  37. package/.claude/commands/test-plan.md +118 -0
  38. package/.claude/commands/update-project.md +413 -0
  39. package/.claude/commands/what-is-my-ai-doing.md +42 -0
  40. package/.claude/commands/worktree.md +124 -0
  41. package/.claude/hooks/block-dangerous-bash.py +55 -0
  42. package/.claude/hooks/check-branch.sh +116 -0
  43. package/.claude/hooks/check-e2e.sh +71 -0
  44. package/.claude/hooks/check-env-sync.sh +41 -0
  45. package/.claude/hooks/check-file-length.py +47 -0
  46. package/.claude/hooks/check-ports.sh +59 -0
  47. package/.claude/hooks/check-rulecatch.sh +33 -0
  48. package/.claude/hooks/check-rybbit.sh +63 -0
  49. package/.claude/hooks/lint-on-save.sh +59 -0
  50. package/.claude/hooks/verify-no-secrets.sh +80 -0
  51. package/.claude/settings.json +34 -0
  52. package/.claude/skills/api-conventions/SKILL.md +34 -0
  53. package/.claude/skills/code-review/SKILL.md +87 -0
  54. package/.claude/skills/code-review/references/mongodb-checks.md +25 -0
  55. package/.claude/skills/code-review/references/project-checks.md +38 -0
  56. package/.claude/skills/create-service/SKILL.md +222 -0
  57. package/.claude/skills/debugger/SKILL.md +39 -0
  58. package/.claude/skills/dependency-vetting/SKILL.md +46 -0
  59. package/.claude/skills/design-review/SKILL.md +50 -0
  60. package/.claude/skills/mcp-builder/SKILL.md +57 -0
  61. package/.claude/skills/mongodb-rules/SKILL.md +62 -0
  62. package/.claude/skills/terminal-tui/SKILL.md +106 -0
  63. package/.claude/skills/test-writer/SKILL.md +78 -0
  64. package/LICENSE +21 -0
  65. package/README.md +2152 -0
  66. package/bin/cli.js +205 -0
  67. package/claude-mastery-project.conf +220 -0
  68. package/global-claude-md/CLAUDE.md +212 -0
  69. package/global-claude-md/settings.json +3 -0
  70. package/package.json +81 -0
@@ -0,0 +1,508 @@
1
+ ---
2
+ description: Convert an existing project to use the Claude Code Starter Kit — non-destructive merge
3
+ scope: starter-kit
4
+ argument-hint: <project-path> [--force]
5
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion
6
+ ---
7
+
8
+ # Convert Existing Project to Starter Kit
9
+
10
+ Merge all Claude Code Starter Kit infrastructure (commands, hooks, skills, CLAUDE.md rules, project-docs templates) into an existing project. Non-destructive — preserves everything the user already has.
11
+
12
+ **Arguments:** $ARGUMENTS
13
+
14
+ ---
15
+
16
+ ## Step 0 — Resolve Source and Target
17
+
18
+ ### Source (starter kit location)
19
+
20
+ Find the starter kit source directory:
21
+
22
+ 1. If CWD has BOTH `claude-mastery-project.conf` AND `.claude/commands/new-project.md` → use CWD as source
23
+ 2. Else read `~/.claude/starter-kit-source-path` → verify it still has both files
24
+ 3. Else ask via AskUserQuestion: "Where is the starter kit cloned?" with a text input
25
+
26
+ Store as `$SOURCE`.
27
+
28
+ ### Target (existing project)
29
+
30
+ Parse `$ARGUMENTS` for a path (everything that is not `--force`). Handle `~` expansion and `./` relative paths.
31
+
32
+ - If a path argument is provided → resolve to absolute path, store as `$TARGET`
33
+ - If no path AND CWD is NOT the starter kit (no `claude-mastery-project.conf` in CWD) → use CWD as `$TARGET`
34
+ - If no path AND CWD IS the starter kit → ask via AskUserQuestion: "Which project do you want to convert? Provide the full path."
35
+
36
+ Check for `--force` flag in `$ARGUMENTS`. If present, set `$FORCE=true` (skips conflict prompts — uses "keep existing, add missing" for everything).
37
+
38
+ ### Validations (all must pass — stop with clear error if any fail)
39
+
40
+ 1. `$TARGET` directory exists → if not: "Directory not found: $TARGET"
41
+ 2. `$TARGET` is a git repo → run: `git -C "$TARGET" rev-parse --is-inside-work-tree 2>/dev/null`
42
+ - If not a git repo: "This project must be a git repo. Run `git init && git commit --allow-empty -m 'init'` first."
43
+ 3. `$TARGET` is NOT the starter kit itself (compare resolved paths of `$SOURCE` and `$TARGET`)
44
+ - If same: "Cannot convert the starter kit itself. Provide the path to an existing project."
45
+ 4. `$SOURCE` has expected starter kit files (`claude-mastery-project.conf` + `.claude/commands/new-project.md`)
46
+ - If not: "Starter kit source is incomplete. Expected claude-mastery-project.conf and .claude/commands/new-project.md"
47
+
48
+ ---
49
+
50
+ ## Step 1 — Safety Commit (MANDATORY)
51
+
52
+ ```bash
53
+ cd "$TARGET"
54
+ git status --porcelain
55
+ ```
56
+
57
+ **Check commit count first:**
58
+ ```bash
59
+ git -C "$TARGET" rev-list --count HEAD 2>/dev/null
60
+ ```
61
+
62
+ - **If zero commits (fresh repo):** Warn the user: "This repo has no commits. We can't create a safety snapshot. Continue anyway?" via AskUserQuestion. If they say no, stop.
63
+
64
+ - **If uncommitted changes exist** (git status --porcelain has output):
65
+ ```bash
66
+ cd "$TARGET" && git add -A && git commit -m "chore: pre-conversion snapshot (before starter kit merge)"
67
+ ```
68
+
69
+ - **If clean with history** (no uncommitted changes, has commits):
70
+ ```bash
71
+ cd "$TARGET" && git commit --allow-empty -m "chore: pre-conversion marker (before starter kit merge)"
72
+ ```
73
+
74
+ Store the hash: `PRE_CONVERT_HASH=$(git -C "$TARGET" rev-parse HEAD)`
75
+
76
+ **STOP if git fails** (except "nothing to commit" which is fine — treat as clean).
77
+
78
+ ---
79
+
80
+ ## Step 2 — Detect Existing Setup
81
+
82
+ Scan the target project. Run these checks in parallel:
83
+
84
+ ### Language detection
85
+
86
+ - `package.json` in `$TARGET` → Node.js
87
+ - `go.mod` in `$TARGET` → Go
88
+ - `pyproject.toml` OR `requirements.txt` in `$TARGET` → Python
89
+ - Multiple detected → ask which is primary via AskUserQuestion
90
+ - None → "unknown"
91
+
92
+ Store as `$LANGUAGE`.
93
+
94
+ ### Existing Claude infrastructure
95
+
96
+ Count and report:
97
+
98
+ - `.claude/commands/*.md` files → `$EXISTING_COMMANDS` count
99
+ - `.claude/hooks/*.sh` + `.claude/hooks/*.py` files → `$EXISTING_HOOKS` count
100
+ - `.claude/skills/*/` directories → `$EXISTING_SKILLS` count
101
+ - Check existence of: `.claude/settings.json`, `CLAUDE.md`, `CLAUDE.local.md`, `claude-mastery-project.conf`
102
+
103
+ ### Existing project infrastructure
104
+
105
+ Check existence of: `project-docs/`, `.env.example`, `.gitignore`, `.dockerignore`
106
+
107
+ ### Display detection report
108
+
109
+ ```
110
+ === Project Detection Report ===
111
+
112
+ Target: $TARGET
113
+ Language: $LANGUAGE
114
+
115
+ Claude Infrastructure:
116
+ Commands: $EXISTING_COMMANDS files
117
+ Hooks: $EXISTING_HOOKS files
118
+ Skills: $EXISTING_SKILLS directories
119
+ Agents: $EXISTING_AGENTS files
120
+ settings.json: exists / missing
121
+ CLAUDE.md: exists / missing
122
+ CLAUDE.local.md: exists / missing
123
+ claude-mastery-project.conf: exists / missing
124
+
125
+ Project Infrastructure:
126
+ project-docs/: exists / missing
127
+ .env.example: exists / missing
128
+ .gitignore: exists / missing
129
+ .dockerignore: exists / missing
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Step 3 — Conflict Resolution
135
+
136
+ **Skip this entire step if `$FORCE` is true.** When `--force` is set, use "keep existing, add missing" for everything.
137
+
138
+ Only ask about categories where the target has existing files. Use AskUserQuestion for each applicable question. Ask at most 4 questions at a time (AskUserQuestion limit).
139
+
140
+ **Batch 1 (if applicable):**
141
+
142
+ **Q1: Commands** (only if `$EXISTING_COMMANDS > 0`)
143
+ - "How should we handle your existing slash commands?"
144
+ - Keep all mine, add only missing starter kit commands (Recommended)
145
+ - Replace all with starter kit versions
146
+ - Let me choose file by file
147
+
148
+ **Q2: Hooks** (only if `$EXISTING_HOOKS > 0`)
149
+ - "How should we handle your existing hooks?"
150
+ - Keep all mine, add only missing starter kit hooks (Recommended)
151
+ - Replace all with starter kit versions
152
+ - Let me choose file by file
153
+
154
+ **Q3: Skills** (only if `$EXISTING_SKILLS > 0`)
155
+ - "How should we handle your existing skills?"
156
+ - Keep all mine, add only missing starter kit skills (Recommended)
157
+ - Replace all with starter kit versions
158
+
159
+ **Q4: Agents** (only if `$EXISTING_AGENTS > 0`)
160
+ - Replace all with starter kit versions
161
+
162
+ **Batch 2 (if applicable):**
163
+
164
+ **Q5: CLAUDE.md** (only if target has existing CLAUDE.md)
165
+ - "Your project has a CLAUDE.md. Merge starter kit sections into it?"
166
+ - Yes, merge section by section — adds missing sections, keeps yours (Recommended)
167
+ - No, leave my CLAUDE.md untouched
168
+
169
+ **Q6: settings.json** (only if target has existing `.claude/settings.json`)
170
+ - "Your project has a .claude/settings.json. Merge starter kit hooks into it?"
171
+ - Yes, add missing hooks — keeps yours (Recommended)
172
+ - No, leave it untouched
173
+
174
+ **Q7: Language-specific** (based on `$LANGUAGE`)
175
+ - Node.js: "Want StrictDB (database layer)? Test configs (vitest, playwright)? Merge scripts into package.json?"
176
+ - Yes, add StrictDB + test configs + merge scripts (Recommended)
177
+ - Just merge scripts into package.json
178
+ - No, skip language-specific files
179
+ - Go: "Want Go-specific coding standards added to CLAUDE.md?"
180
+ - Yes (Recommended)
181
+ - No
182
+ - Python: "Want Python-specific coding standards added to CLAUDE.md?"
183
+ - Yes (Recommended)
184
+ - No
185
+
186
+ Store each answer. Default for `--force`: "keep mine, add missing" for all categories, "yes merge" for CLAUDE.md and settings.json, "yes" for language-specific.
187
+
188
+ ---
189
+
190
+ ## Step 4 — Merge .claude/ Directory
191
+
192
+ ### Create directories
193
+
194
+ ```bash
195
+ mkdir -p "$TARGET/.claude/commands"
196
+ mkdir -p "$TARGET/.claude/hooks"
197
+ mkdir -p "$TARGET/.claude/skills"
198
+ ```
199
+
200
+ ### Copy files per category
201
+
202
+ For each category (commands, hooks, skills), iterate through the source files:
203
+
204
+ > Do not merge `.starter-kit/` into the target. It is kit-internal scaffolding used only by `/new-project` inside the starter kit itself.
205
+
206
+ **For commands:** List all `$SOURCE/.claude/commands/*.md` files that have `scope: project` in their YAML frontmatter. Skip any commands with `scope: starter-kit` — those are kit-management commands that don't belong in project repos.
207
+ **For hooks:** List all `$SOURCE/.claude/hooks/*.sh` and `$SOURCE/.claude/hooks/*.py` files.
208
+ **For skills:** List all `$SOURCE/.claude/skills/*/` directories (copy entire directory).
209
+
210
+ For each file/directory:
211
+
212
+ - File does NOT exist in target → **COPY** it. Increment `$ADDED`.
213
+ - File EXISTS + strategy is "keep mine, add missing" → **SKIP**. Increment `$SKIPPED`.
214
+ - File EXISTS + strategy is "replace all" → **OVERWRITE** (copy with force). Increment `$REPLACED`.
215
+ - File EXISTS + strategy is "choose file by file" → Show the filename and ask via AskUserQuestion: "File `<name>` exists in both. Keep yours or use starter kit version?" Options: Keep mine / Use starter kit. Act accordingly.
216
+
217
+ ### Make hooks executable
218
+
219
+ ```bash
220
+ chmod +x "$TARGET/.claude/hooks/"*.sh 2>/dev/null
221
+ chmod +x "$TARGET/.claude/hooks/"*.py 2>/dev/null
222
+ ```
223
+
224
+ ### Merge settings.json
225
+
226
+ **If target has no `.claude/settings.json`:** Copy `$SOURCE/.claude/settings.json` directly.
227
+
228
+ **If target has `.claude/settings.json` and user said "yes, merge":**
229
+
230
+ 1. Read both files as JSON
231
+ 2. For `permissions.deny`: merge arrays — add entries from source that are missing in target (deduplicate by value)
232
+ 3. For each hook event type (`PreToolUse`, `PostToolUse`, `Stop`):
233
+ - For each matcher entry in source: check if target already has same matcher string
234
+ - Same matcher → merge the `hooks` arrays (deduplicate by `command` string)
235
+ - New matcher → add entire entry to target
236
+ 4. NEVER remove existing entries from target
237
+ 5. Write the merged result to `$TARGET/.claude/settings.json`
238
+
239
+ **If user said "no, leave untouched":** Skip.
240
+
241
+ Track and display counts: `ADDED`, `SKIPPED`, `REPLACED` per category.
242
+
243
+ ---
244
+
245
+ ## Step 5 — Merge CLAUDE.md
246
+
247
+ ### If target has no CLAUDE.md
248
+
249
+ Create a minimal CLAUDE.md with security-only rules (safe for any project type):
250
+
251
+ ```markdown
252
+ # CLAUDE.md — Project Instructions
253
+
254
+ ---
255
+
256
+ ## Critical Rules
257
+
258
+ ### 0. NEVER Publish Sensitive Data
259
+
260
+ - NEVER commit passwords, API keys, tokens, or secrets to git/npm/docker
261
+ - NEVER commit `.env` files — ALWAYS verify `.env` is in `.gitignore`
262
+ - Before ANY commit: verify no secrets are included
263
+ - NEVER output secrets in suggestions, logs, or responses
264
+
265
+ ### 5. NEVER Hardcode Credentials
266
+
267
+ - ALWAYS use environment variables for secrets
268
+ - NEVER put API keys, passwords, or tokens directly in code
269
+ - NEVER hardcode connection strings — use STRICTDB_URI from .env
270
+
271
+ ### 6. ALWAYS Ask Before Deploying
272
+
273
+ - NEVER auto-deploy, even if the fix seems simple
274
+ - NEVER assume approval — wait for explicit "yes, deploy"
275
+ - ALWAYS ask before deploying to production
276
+
277
+ ---
278
+
279
+ ## Workflow Preferences
280
+
281
+ - Quality over speed — if unsure, ask before executing
282
+ - Plan first, code second — use plan mode for non-trivial tasks
283
+ - One task, one chat — `/clear` between unrelated tasks
284
+ ```
285
+
286
+ Report: `+ CLAUDE.md created (security-only rules)`
287
+
288
+ ### If target has CLAUDE.md and user said "yes, merge"
289
+
290
+ Parse the starter kit CLAUDE.md and the target CLAUDE.md by `## ` (h2) section headers.
291
+
292
+ The starter kit CLAUDE.md sections to check:
293
+ - `Quick Reference — Scripts`
294
+ - `Critical Rules`
295
+ - `When Something Seems Wrong`
296
+ - `Windows Users`
297
+ - `Service Ports`
298
+ - `Project Structure`
299
+ - `Project Documentation`
300
+ - `Coding Standards`
301
+ - `Naming — NEVER Rename Mid-Project`
302
+ - `Plan Mode — Plan First, Code Second`
303
+ - `Documentation Sync`
304
+ - `CLAUDE.md Is Team Memory`
305
+ - `Workflow Preferences`
306
+
307
+ For each section:
308
+ - Normalize comparison: lowercase, strip dashes/extra spaces
309
+ - If a section with similar header exists in target → **SKIP**
310
+ - If missing → **APPEND** the entire section to the end of target's CLAUDE.md
311
+
312
+ **Special: Critical Rules sub-merge:**
313
+ If the target already has a "Critical Rules" section, parse both by `### ` (h3) sub-headers. For each numbered rule in the starter kit (Rule 0 through Rule 10):
314
+ - If the target has a sub-section with the same rule number → **SKIP**
315
+ - If missing → **APPEND** that rule sub-section inside the existing Critical Rules section
316
+
317
+ Report each section: `skipped (exists)` or `+ added`
318
+
319
+ ### If user said "no, leave untouched"
320
+
321
+ Skip entirely.
322
+
323
+ ---
324
+
325
+ ## Step 6 — Infrastructure Files
326
+
327
+ Copy infrastructure files from source to target:
328
+
329
+ | File | If Missing in Target | If Exists in Target |
330
+ |------|---------------------|---------------------|
331
+ | `CLAUDE.local.md` | Copy from source | Skip |
332
+ | `claude-mastery-project.conf` | Copy from source | Skip |
333
+ | `project-docs/ARCHITECTURE.md` | Create `project-docs/` dir, copy | Skip |
334
+ | `project-docs/INFRASTRUCTURE.md` | Copy | Skip |
335
+ | `project-docs/DECISIONS.md` | Copy | Skip |
336
+ | `.env.example` | Copy from source | Merge: read both line by line, add lines from source whose key name (before `=`) doesn't exist in target. Append missing lines at end. |
337
+ | `.gitignore` | Copy from source | Merge: add lines from source that don't exist in target. Ensure `.env`, `CLAUDE.local.md`, `_ai_temp/` are present. |
338
+ | `.dockerignore` | Copy from source | Merge: add lines from source that don't exist in target. |
339
+
340
+ Create `project-docs/` directory if it doesn't exist before copying.
341
+
342
+ Report each file: `+ copied`, `merged (N lines added)`, or `skipped (exists)`
343
+
344
+ ---
345
+
346
+ ## Step 7 — Language-Specific (if user opted in)
347
+
348
+ ### Node.js (if `$LANGUAGE` is Node.js and user opted in)
349
+
350
+ **StrictDB** (if user chose "yes, add StrictDB"):
351
+ - Install StrictDB as a dependency: `cd "$TARGET" && npm install strictdb@^0.1.0`
352
+
353
+ **Test configs** (if user chose "yes"):
354
+ - Copy `$SOURCE/vitest.config.ts` if missing in target
355
+ - Copy `$SOURCE/playwright.config.ts` if missing in target
356
+
357
+ **Package.json scripts** (if user chose "yes" or "just merge scripts"):
358
+ - Read both `package.json` files
359
+ - For each script name in source's `scripts`: if target doesn't have that script name → add it
360
+ - NEVER modify existing scripts in target
361
+ - NEVER touch `dependencies` or `devDependencies`
362
+ - Write updated target `package.json`
363
+
364
+ **DB query system** (if user chose "yes"):
365
+ - Create `$TARGET/scripts/queries/` directory
366
+ - Copy `$SOURCE/scripts/db-query.ts` if missing
367
+ - Copy all files from `$SOURCE/scripts/queries/` if the directory was empty/missing
368
+
369
+ ### Go (if `$LANGUAGE` is Go and user opted in)
370
+
371
+ - Check if target CLAUDE.md has a Go coding standards section (search for "Go" + "golangci" or "go.mod")
372
+ - If missing → append the Go coding standards section from the starter kit CLAUDE.md
373
+
374
+ ### Python (if `$LANGUAGE` is Python and user opted in)
375
+
376
+ - Check if target CLAUDE.md has a Python coding standards section (search for "Python" + "pytest" or "pyproject")
377
+ - If missing → append the Python coding standards section from the starter kit CLAUDE.md
378
+
379
+ ---
380
+
381
+ ## Step 7b — Generate Feature Manifest
382
+
383
+ After language-specific files are copied, auto-detect which features were installed and write a manifest.
384
+
385
+ 1. Check which feature-related files now exist in `$TARGET`:
386
+ - `strictdb` in `package.json` dependencies → feature `mongo` (or `postgres` — StrictDB handles both)
387
+ - `vitest.config.ts` → feature `vitest`
388
+ - `playwright.config.ts` → feature `playwright`
389
+ - `scripts/build-content.ts` → feature `content`
390
+ - `Dockerfile` → feature `docker`
391
+
392
+ 2. For each detected feature, build a feature entry with the list of files that were actually copied.
393
+
394
+ 3. Write `$TARGET/.claude/features.json`:
395
+
396
+ ```json
397
+ {
398
+ "schemaVersion": 1,
399
+ "installedBy": "claude-code-mastery-starter-kit",
400
+ "language": "<$LANGUAGE>",
401
+ "features": {
402
+ "<detected-feature>": {
403
+ "version": "1.0.0",
404
+ "installedAt": "<current-ISO-timestamp>",
405
+ "updatedAt": null,
406
+ "files": ["<list-of-files-that-exist>"]
407
+ }
408
+ }
409
+ }
410
+ ```
411
+
412
+ If no feature files were copied (user opted out of language-specific files), write an empty manifest:
413
+ ```json
414
+ {
415
+ "schemaVersion": 1,
416
+ "installedBy": "claude-code-mastery-starter-kit",
417
+ "language": "<$LANGUAGE>",
418
+ "features": {}
419
+ }
420
+ ```
421
+
422
+ ---
423
+
424
+ ## Step 8 — Register in Project Registry
425
+
426
+ 1. Read `~/.claude/starter-kit-projects.json`
427
+ - If file doesn't exist → create with `{"projects":[]}`
428
+ - If file exists but is invalid JSON → create fresh
429
+
430
+ 2. Check if a project with the same `path` already exists in the `projects` array:
431
+ - **Yes** → Update the existing entry: set `profile` to `"converted"`, update `convertedAt` to current ISO timestamp
432
+ - **No** → Add a new entry
433
+
434
+ 3. Entry format:
435
+ ```json
436
+ {
437
+ "name": "<directory-name-of-target>",
438
+ "path": "<absolute-path-to-target>",
439
+ "profile": "converted",
440
+ "language": "<detected-language>",
441
+ "framework": "unknown",
442
+ "database": "unknown",
443
+ "createdAt": "<current-ISO-timestamp>"
444
+ }
445
+ ```
446
+
447
+ 4. Write updated registry to `~/.claude/starter-kit-projects.json`
448
+
449
+ 5. Save starter kit source path for future use:
450
+ Write `$SOURCE` to `~/.claude/starter-kit-source-path`
451
+
452
+ ---
453
+
454
+ ## Step 9 — Final Commit + Summary
455
+
456
+ ### Commit the conversion
457
+
458
+ ```bash
459
+ cd "$TARGET"
460
+ git add -A
461
+ git commit -m "chore: merge Claude Code Starter Kit infrastructure"
462
+ ```
463
+
464
+ Store: `CONVERT_HASH=$(git -C "$TARGET" rev-parse HEAD)`
465
+
466
+ ### Display summary
467
+
468
+ ```
469
+ === Starter Kit Conversion Complete ===
470
+
471
+ Target: $TARGET
472
+ Language: $LANGUAGE (detected)
473
+
474
+ Commands: N added, N skipped, N replaced
475
+ Hooks: N added, N skipped, N replaced
476
+ Skills: N added, N skipped, N replaced
477
+ Agents: N added, N skipped, N replaced
478
+ CLAUDE.md: N sections added, N skipped (or: created with security rules)
479
+ settings.json: deep merged / copied / skipped
480
+ Infrastructure: N files added, N merged, N skipped
481
+
482
+ Pre-conversion commit: $PRE_CONVERT_HASH
483
+ Conversion commit: $CONVERT_HASH
484
+
485
+ To undo: git revert HEAD
486
+ To review: git diff $PRE_CONVERT_HASH..HEAD
487
+
488
+ Registered in project registry. View with /projects-created.
489
+
490
+ Next steps:
491
+ 1. Run /setup to configure environment variables
492
+ 2. Run /help to see all available commands
493
+ 3. Review CLAUDE.md and customize rules for your project
494
+ ```
495
+
496
+ ---
497
+
498
+ ## Edge Cases
499
+
500
+ 1. **Already converted** — Check registry for matching path with `profile: "converted"`. If found, ask: "This project was already converted. Re-merge to pick up new starter kit updates?" via AskUserQuestion. If yes, proceed normally (will add any new files that are missing). If no, stop.
501
+
502
+ 2. **No git repo** — Block with clear error in Step 0 validation.
503
+
504
+ 3. **Target IS the starter kit** — Block with clear error in Step 0 validation.
505
+
506
+ 4. **Fresh repo (0 commits)** — Warn in Step 1, ask to continue.
507
+
508
+ 5. **Binary/large files** — Only copy text files (`.md`, `.sh`, `.py`, `.ts`, `.json`, `.conf`). Never copy node_modules, dist, or binary artifacts.