@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,301 @@
1
+ ---
2
+ description: Generate or update project diagrams by scanning actual code — architecture, API, database, infrastructure
3
+ scope: project
4
+ argument-hint: <type> [--update]
5
+ allowed-tools: Read, Write, Edit, Grep, Glob, Bash
6
+ ---
7
+
8
+ # Generate Diagram
9
+
10
+ Scan the actual project and generate/update diagrams based on what exists in code.
11
+
12
+ **Type:** $ARGUMENTS
13
+
14
+ Available types:
15
+ - `architecture` — System overview: services, connections, data flow → updates `project-docs/ARCHITECTURE.md`
16
+ - `api` — API routes map: all endpoints grouped by resource → updates `project-docs/ARCHITECTURE.md`
17
+ - `database` — Database schema: collections, indexes, relationships → updates `project-docs/ARCHITECTURE.md`
18
+ - `infrastructure` — Deployment topology: servers, containers, regions → updates `project-docs/INFRASTRUCTURE.md`
19
+ - `all` — Generate all diagram types
20
+
21
+ If `--update` is passed, replace existing diagrams in-place. Otherwise, show the diagram and ask before writing.
22
+
23
+ ## Diagram Format
24
+
25
+ **ALL diagrams use ASCII box-drawing characters.** No Mermaid, no SVG, no external tools. ASCII works in every terminal, every markdown renderer, every code review.
26
+
27
+ ```
28
+ Box characters: ┌ ┐ └ ┘ │ ─ ├ ┤ ┬ ┴ ┼
29
+ Arrows: → ← ↑ ↓ ──> <── ───>
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Type: `architecture`
35
+
36
+ Scan the project and generate a system overview diagram.
37
+
38
+ ### What to scan:
39
+
40
+ 1. **`src/` directory structure** — identify services, handlers, adapters
41
+ ```bash
42
+ find src/ -name "*.ts" -o -name "*.tsx" 2>/dev/null | head -50
43
+ ```
44
+
45
+ 2. **Entry points** — find all server/app files
46
+ ```bash
47
+ grep -rl "app.listen\|createServer\|express()\|fastify()\|Hono()" src/ 2>/dev/null
48
+ ```
49
+
50
+ 3. **Route definitions** — find where endpoints are defined
51
+ ```bash
52
+ grep -rn "app\.\(get\|post\|put\|delete\|patch\)\|router\.\(get\|post\|put\|delete\|patch\)" src/ 2>/dev/null
53
+ ```
54
+
55
+ 4. **Database usage** — find which services access the database
56
+ ```bash
57
+ grep -rl "queryOne\|queryMany\|insertOne\|updateOne\|bulkOps\|batch\|StrictDB\|MongoClient\|PrismaClient" src/ 2>/dev/null
58
+ ```
59
+
60
+ 5. **External service calls** — find adapters and API calls
61
+ ```bash
62
+ grep -rl "fetch(\|axios\|got(" src/ 2>/dev/null
63
+ ```
64
+
65
+ 6. **Package.json** — check for framework indicators
66
+ - `next` → Next.js app
67
+ - `express` → Express API
68
+ - `fastify` → Fastify API
69
+ - `hono` → Hono API
70
+
71
+ ### Generate the diagram:
72
+
73
+ ```
74
+ ┌─────────────────────────────────────────────────────────────┐
75
+ │ YOUR SYSTEM │
76
+ │ │
77
+ │ ┌───────────┐ HTTP ┌───────────┐ │
78
+ │ │ Client │────────────>│ Website │ │
79
+ │ │ Browser │ │ :3000 │ │
80
+ │ └───────────┘ └───────────┘ │
81
+ │ │ │
82
+ │ │ API calls ┌───────────┐ │
83
+ │ └──────────────────>│ API │ │
84
+ │ │ :3001 │ │
85
+ │ └─────┬─────┘ │
86
+ │ │ │
87
+ │ read/write│ │
88
+ │ ▼ │
89
+ │ ┌───────────┐ │
90
+ │ │ MongoDB │ │
91
+ │ │ (StrictDB)│ │
92
+ │ └───────────┘ │
93
+ │ │
94
+ │ ┌───────────┐ reads ┌───────────┐ │
95
+ │ │ Dashboard │────────────>│ API │ │
96
+ │ │ :3002 │ │ :3001 │ │
97
+ │ └───────────┘ └───────────┘ │
98
+ │ │
99
+ └─────────────────────────────────────────────────────────────┘
100
+ ```
101
+
102
+ **Adapt this to what ACTUALLY exists.** Don't include services that don't exist. Don't guess — only diagram what you found in code.
103
+
104
+ ### Where to write:
105
+
106
+ Replace the `## System Overview` diagram section in `project-docs/ARCHITECTURE.md`.
107
+ Also update `## Service Responsibilities` table and `## Data Flow` section based on findings.
108
+
109
+ ---
110
+
111
+ ## Type: `api`
112
+
113
+ Scan all route definitions and generate an API routes map.
114
+
115
+ ### What to scan:
116
+
117
+ ```bash
118
+ # Express/Fastify routes
119
+ grep -rn "app\.\(get\|post\|put\|delete\|patch\)\|router\.\(get\|post\|put\|delete\|patch\)" src/ 2>/dev/null
120
+
121
+ # Next.js API routes (file-based)
122
+ find src/app/api -name "route.ts" -o -name "route.tsx" 2>/dev/null
123
+ find src/pages/api -name "*.ts" -o -name "*.tsx" 2>/dev/null
124
+ ```
125
+
126
+ ### Generate the diagram:
127
+
128
+ ```
129
+ API Routes Map
130
+ ==============
131
+
132
+ /api/v1/
133
+ ├── auth/
134
+ │ ├── POST /login → handlers/auth.ts:handleLogin
135
+ │ ├── POST /signup → handlers/auth.ts:handleSignup
136
+ │ └── POST /logout → handlers/auth.ts:handleLogout
137
+ ├── users/
138
+ │ ├── GET / → handlers/users.ts:listUsers
139
+ │ ├── GET /:id → handlers/users.ts:getUser
140
+ │ ├── PUT /:id → handlers/users.ts:updateUser
141
+ │ └── DELETE /:id → handlers/users.ts:deleteUser
142
+ └── health/
143
+ └── GET / → server.ts (inline)
144
+ ```
145
+
146
+ ### Where to write:
147
+
148
+ Add/update an `## API Routes` section in `project-docs/ARCHITECTURE.md`.
149
+
150
+ ---
151
+
152
+ ## Type: `database`
153
+
154
+ Scan database queries, models, and index registrations to map the schema.
155
+
156
+ ### What to scan:
157
+
158
+ ```bash
159
+ # Collections used in queries
160
+ grep -rn "queryOne\|queryMany\|insertOne\|updateOne\|bulkOps\|deleteOne\|count(" src/ 2>/dev/null
161
+
162
+ # Index registrations
163
+ grep -rn "registerIndex\|createIndex\|ensureIndex" src/ scripts/ 2>/dev/null
164
+
165
+ # Type definitions that map to collections
166
+ grep -rn "interface.*{" src/types/ 2>/dev/null
167
+ ```
168
+
169
+ ### Generate the diagram:
170
+
171
+ ```
172
+ Database Schema
173
+ ===============
174
+
175
+ ┌─────────────────────────┐ ┌─────────────────────────┐
176
+ │ users │ │ sessions │
177
+ ├─────────────────────────┤ ├─────────────────────────┤
178
+ │ _id ObjectId │──┐ │ _id ObjectId │
179
+ │ email string [U] │ │ │ userId ObjectId │──┐
180
+ │ name string │ │ │ token string [U] │ │
181
+ │ apiKey string [U,S]│ │ │ expiresAt Date [TTL]│ │
182
+ │ createdAt Date │ │ │ createdAt Date │ │
183
+ └─────────────────────────┘ │ └─────────────────────────┘ │
184
+ │ │
185
+ └─── userId references users._id ─┘
186
+
187
+ Indexes:
188
+ users.email — unique
189
+ users.apiKey — unique, sparse
190
+ sessions.userId — compound (userId, startedAt DESC)
191
+ sessions.expiresAt — TTL (auto-delete)
192
+
193
+ [U] = unique [S] = sparse [TTL] = auto-expiring
194
+ ```
195
+
196
+ ### Where to write:
197
+
198
+ Add/update a `## Database Schema` section in `project-docs/ARCHITECTURE.md`.
199
+
200
+ ---
201
+
202
+ ## Type: `infrastructure`
203
+
204
+ Scan deployment config to generate infrastructure topology.
205
+
206
+ ### What to scan:
207
+
208
+ 1. **`.env` / `.env.example`** — region variables, ports, hosts
209
+ 2. **`Dockerfile`** — what's containerized
210
+ 3. **`docker-compose.yml`** — service orchestration
211
+ 4. **`claude-mastery-project.conf`** — multi-region config
212
+ 5. **`package.json`** — deployment scripts
213
+
214
+ ```bash
215
+ # Check for multi-region
216
+ grep -n "_US\|_EU\|REGION" .env.example .env 2>/dev/null
217
+
218
+ # Check for Docker
219
+ ls Dockerfile docker-compose.yml 2>/dev/null
220
+
221
+ # Check for deployment config
222
+ grep -n "DOKPLOY\|HOSTINGER\|VERCEL\|VPS" .env.example .env 2>/dev/null
223
+ ```
224
+
225
+ ### Generate the diagram:
226
+
227
+ **Single region:**
228
+ ```
229
+ Infrastructure
230
+ ==============
231
+
232
+ ┌──────────────── Production ────────────────┐
233
+ │ │
234
+ │ ┌─────────────┐ ┌─────────────┐ │
235
+ │ │ Docker │ │ MongoDB │ │
236
+ │ │ :3001 │────>│ Atlas │ │
237
+ │ │ (API) │ │ │ │
238
+ │ └─────────────┘ └─────────────┘ │
239
+ │ │ │
240
+ │ Dokploy on Hostinger VPS │
241
+ │ IP: (from .env) │
242
+ │ │
243
+ └─────────────────────────────────────────────┘
244
+ ```
245
+
246
+ **Multi-region:**
247
+ ```
248
+ Infrastructure — Multi-Region
249
+ ==============================
250
+
251
+ ┌────────── US Region ──────────┐ ┌────────── EU Region ──────────┐
252
+ │ │ │ │
253
+ │ ┌──────────┐ ┌──────────┐ │ │ ┌──────────┐ ┌──────────┐ │
254
+ │ │ Docker │ │ MongoDB │ │ │ │ Docker │ │ MongoDB │ │
255
+ │ │ :latest │─>│ Atlas US │ │ │ │ :eu │─>│ Atlas EU │ │
256
+ │ └──────────┘ └──────────┘ │ │ └──────────┘ └──────────┘ │
257
+ │ │ │ │
258
+ │ VPS: (US IP) │ │ VPS: (EU IP) │
259
+ │ Dokploy US │ │ Dokploy EU │
260
+ │ │ │ │
261
+ └────────────────────────────────┘ └────────────────────────────────┘
262
+
263
+ US containers → US database ONLY
264
+ EU containers → EU database ONLY
265
+ NEVER cross-connect regions
266
+ ```
267
+
268
+ ### Where to write:
269
+
270
+ Replace the `## Environment Overview` diagram in `project-docs/INFRASTRUCTURE.md`.
271
+
272
+ ---
273
+
274
+ ## Type: `all`
275
+
276
+ Run all four types in sequence: architecture → api → database → infrastructure.
277
+
278
+ ---
279
+
280
+ ## After Generating
281
+
282
+ 1. Show the generated diagram(s) to the user
283
+ 2. If `--update` was passed: write directly to the docs
284
+ 3. If not: ask "Write this to project-docs/ARCHITECTURE.md?" before writing
285
+ 4. Add a changelog entry with today's date:
286
+ ```
287
+ | (today) | Updated [type] diagram from code scan |
288
+ ```
289
+ 5. Report what was generated:
290
+ ```
291
+ Diagrams Generated
292
+ ==================
293
+ ✓ Architecture — 3 services found (Website, API, Dashboard)
294
+ ✓ API Routes — 12 endpoints across 4 resources
295
+ ✓ Database — 5 collections, 8 indexes
296
+ ✓ Infrastructure — multi-region (US + EU)
297
+
298
+ Written to:
299
+ project-docs/ARCHITECTURE.md (architecture, api, database)
300
+ project-docs/INFRASTRUCTURE.md (infrastructure)
301
+ ```
@@ -0,0 +1,120 @@
1
+ ---
2
+ description: List all available commands and skills
3
+ scope: project
4
+ allowed-tools: Read, Glob
5
+ ---
6
+
7
+ # Help — All Available Commands
8
+
9
+ Display the complete list of commands and skills available in this project.
10
+
11
+ ## Step 1 — Detect Context
12
+
13
+ Determine if we're running inside the starter kit or a scaffolded project:
14
+
15
+ 1. Check if BOTH `claude-mastery-project.conf` AND `.claude/commands/new-project.md` exist in the project root
16
+ - **Yes** → This is the **starter kit**. Show ALL commands (both `scope: project` and `scope: starter-kit`), grouped with a "KIT MANAGEMENT" section.
17
+ - **No** → This is a **scaffolded project**. Show only the commands present in `.claude/commands/`.
18
+
19
+ ## Step 2 — Enumerate Commands
20
+
21
+ 1. Glob `.claude/commands/*.md` to find all command files
22
+ 2. For each file, read the YAML frontmatter to extract:
23
+ - `description` — the command description
24
+ - `scope` — `project` or `starter-kit` (if present)
25
+ 3. Build the command list dynamically from what's actually installed
26
+
27
+ ## Step 3 — Display
28
+
29
+ Format the output as a grouped reference. Use the categories below for organization.
30
+
31
+ ### If Starter Kit (show all commands with KIT MANAGEMENT section):
32
+
33
+ ```
34
+ === Claude Code Starter Kit — Command Reference ({N} commands) ===
35
+
36
+ GETTING STARTED
37
+ /help List all commands and skills (this screen)
38
+ /quickstart Interactive first-run walkthrough for new users
39
+ /install-global Install/merge global Claude config into ~/.claude/
40
+ /setup Interactive .env configuration — GitHub, database, Docker, analytics
41
+ /setup --reset Re-configure everything from scratch
42
+ /show-user-guide Open the comprehensive User Guide in your browser
43
+
44
+ KIT MANAGEMENT (starter kit only — not copied to projects)
45
+ /new-project Scaffold a new project from a profile (clean, default, api, go, vue, python-api, etc.)
46
+ /set-project-profile-default Set the default profile for /new-project (any profile name)
47
+ /add-project-setup Interactive wizard to create a named profile in claude-mastery-project.conf
48
+ /projects-created List all projects created by the starter kit with creation dates
49
+ /remove-project Remove a project from the registry and optionally delete it from disk
50
+ /convert-project-to-starter-kit Merge starter kit into an existing project (non-destructive)
51
+ /update-project Update a starter-kit project with the latest commands, hooks, and rules
52
+ /update-project --clean Remove starter-kit-scoped commands from a project
53
+
54
+ CODE QUALITY
55
+ /review Systematic code review against 7-point checklist
56
+ /refactor <file> Audit + refactor a file against all CLAUDE.md rules
57
+ /security-check Scan project for secrets, vulnerabilities, and .gitignore gaps
58
+ /commit Smart commit with conventional commit format
59
+
60
+ DEVELOPMENT
61
+ /create-api <res> Scaffold a full API endpoint — route, handler, types, tests
62
+ /create-e2e <feat> Generate Playwright E2E test with explicit success criteria
63
+ /test-plan Generate a structured test plan for a feature
64
+ /progress Check project status — files, tests, git activity, next actions
65
+
66
+ INFRASTRUCTURE
67
+ /diagram <type> Generate diagrams from code: architecture, api, database, infrastructure, all
68
+ /architecture Display system architecture and data flow
69
+ /optimize-docker Audit Dockerfile against 12 production best practices
70
+ /worktree <name> Create isolated branch + worktree for a task
71
+
72
+ MONITORING
73
+ /what-is-my-ai-doing Live monitor of AI activity — tokens, cost, violations
74
+ ```
75
+
76
+ ### If Scaffolded Project (show only installed commands):
77
+
78
+ ```
79
+ === Command Reference ({N} commands) ===
80
+ ```
81
+
82
+ Group installed commands into the same categories (GETTING STARTED, CODE QUALITY, DEVELOPMENT, INFRASTRUCTURE, MONITORING). Skip any category that has no installed commands. Use the descriptions from the frontmatter.
83
+
84
+ ### Always append (both contexts):
85
+
86
+ ```
87
+ === Skills ===
88
+
89
+ Auto-activate when Claude detects the work — no command needed:
90
+
91
+ API Conventions Triggers: writing routes, handlers, or adapters
92
+ Service structure — routing, layering, where code lives
93
+ MongoDB Rules Triggers: queries, aggregations, indexes, connections, schema
94
+ Driver, StrictDB, and data-modeling rules for MongoDB
95
+ Code Review Triggers: "review", "audit", "check code", "security review"
96
+ Systematic review with severity-rated, cited findings (read-only)
97
+ Debugger Triggers: "crash", "stack trace", "fails in prod", "root cause"
98
+ Diagnoses failures by root cause, not symptom (read-only)
99
+ Design Review Triggers: "review UI", "layout", "accessibility", "does this look right"
100
+ Critiques UI/UX for usability, accessibility, distinctiveness (read-only)
101
+ Test Writer Triggers: "write tests", "add a test", "cover this"
102
+ Writes tests that catch bugs, with explicit assertions
103
+ Dependency Vetting Triggers: "is this package safe", "should I add", "can I trust"
104
+ Vets a package for supply-chain risk before you install it (read-only)
105
+
106
+ Invoke explicitly (they write files):
107
+
108
+ Create Service Triggers: "create service", "new service", "scaffold service"
109
+ Scaffolds a microservice with server/handlers/adapters pattern
110
+ MCP Builder Triggers: "MCP server", "expose as tools", "wrap this API"
111
+ Builds an MCP server with well-designed tools and evals
112
+
113
+ === Tips ===
114
+
115
+ For detailed help on any command: ask "How do I use /command-name?"
116
+ First time here? Run /quickstart for a guided walkthrough.
117
+ Use /help anytime to see this list again.
118
+ ```
119
+
120
+ **Note:** Only show the Skills section if `.claude/skills/` exists and contains files.
@@ -0,0 +1,145 @@
1
+ ---
2
+ description: Install global Claude config — merges into existing ~/.claude/ without overwriting
3
+ scope: starter-kit
4
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion
5
+ ---
6
+
7
+ # Install Global Config
8
+
9
+ **$ARGUMENTS**
10
+
11
+ Install the starter kit's global Claude configuration into `~/.claude/`. This is a one-time setup that gives you security rules, hooks, and settings across ALL projects.
12
+
13
+ **Smart merge:** If you already have a global config, this merges new content — it never overwrites your existing rules.
14
+
15
+ ## Step 1 — Check What Exists
16
+
17
+ ```bash
18
+ # Check if global claude directory exists
19
+ ls -la ~/.claude/ 2>/dev/null || echo "NO_GLOBAL_DIR"
20
+
21
+ # Check for existing files
22
+ [ -f ~/.claude/CLAUDE.md ] && echo "EXISTING_CLAUDE_MD" || echo "NO_CLAUDE_MD"
23
+ [ -f ~/.claude/settings.json ] && echo "EXISTING_SETTINGS" || echo "NO_SETTINGS"
24
+ [ -d ~/.claude/hooks ] && echo "EXISTING_HOOKS" || echo "NO_HOOKS"
25
+ ```
26
+
27
+ ## Step 2 — Handle Each File
28
+
29
+ ### 2A. ~/.claude/CLAUDE.md
30
+
31
+ **If NO existing file:**
32
+ - Copy `global-claude-md/CLAUDE.md` directly to `~/.claude/CLAUDE.md`
33
+ - Report: "Installed global CLAUDE.md (fresh install)"
34
+
35
+ **If existing file found:**
36
+ 1. Read BOTH files:
37
+ - The existing `~/.claude/CLAUDE.md`
38
+ - The starter kit's `global-claude-md/CLAUDE.md`
39
+ 2. Compare section by section. The starter kit has these sections:
40
+ - `## Identity`
41
+ - `## NEVER EVER DO`
42
+ - `## New Project Setup`
43
+ - `## Coding Standards (All Projects)`
44
+ - `## Workflow`
45
+ 3. For each section:
46
+ - If the section header **already exists** in the user's file → **SKIP** (don't overwrite their version)
47
+ - If the section header **does NOT exist** → **APPEND** it to the end of the user's file
48
+ 4. Report exactly what was added and what was skipped:
49
+ ```
50
+ Global CLAUDE.md merge:
51
+ ✓ Identity — already exists, skipped
52
+ ✓ NEVER EVER DO — already exists, skipped
53
+ + New Project Setup — added
54
+ + Coding Standards — added
55
+ ✓ Workflow — already exists, skipped
56
+ ```
57
+
58
+ **IMPORTANT:** NEVER delete or overwrite existing content. Only append missing sections.
59
+
60
+ ### 2B. ~/.claude/settings.json
61
+
62
+ **If NO existing file:**
63
+ - Copy `global-claude-md/settings.json` directly to `~/.claude/settings.json`
64
+ - Report: "Installed global settings.json (fresh install)"
65
+
66
+ **If existing file found:**
67
+ 1. Read both settings files as JSON
68
+ 2. Merge the `permissions.deny` array — add any entries from the starter kit that aren't already present
69
+ 3. Merge the `hooks` object:
70
+ - For `PreToolUse`: add hooks that aren't already present (match by `command` string)
71
+ - For `Stop`: add hooks that aren't already present (match by `command` string)
72
+ 4. Write the merged result back
73
+ 5. Report what was added:
74
+ ```
75
+ Global settings.json merge:
76
+ + Added deny rule: Read(.env.production)
77
+ ✓ Hook verify-no-secrets.sh — already present, skipped
78
+ + Added Stop hook: verify-no-secrets.sh
79
+ ```
80
+
81
+ **IMPORTANT:** NEVER remove existing permissions or hooks. Only add missing ones.
82
+
83
+ ### 2C. ~/.claude/hooks/
84
+
85
+ 1. Create `~/.claude/hooks/` if it doesn't exist:
86
+ ```bash
87
+ mkdir -p ~/.claude/hooks
88
+ ```
89
+
90
+ 2. Check if the project has hooks to install:
91
+ ```bash
92
+ ls .claude/hooks/ 2>/dev/null
93
+ ```
94
+
95
+ 3. For each hook file in the project's `.claude/hooks/`:
96
+ - If the file **already exists** at `~/.claude/hooks/` → **SKIP** (don't overwrite)
97
+ - If the file **does NOT exist** → **COPY** it
98
+ - Make all hooks executable: `chmod +x ~/.claude/hooks/*`
99
+
100
+ 4. Report:
101
+ ```
102
+ Global hooks:
103
+ + verify-no-secrets.sh — installed
104
+ ✓ verify-no-secrets.sh — already exists, skipped
105
+ + lint-on-save.sh — installed
106
+ ```
107
+
108
+ ## Step 4 — Verify Installation
109
+
110
+ After all merges, verify:
111
+
112
+ ```bash
113
+ echo "=== Global CLAUDE.md ==="
114
+ [ -f ~/.claude/CLAUDE.md ] && echo "✓ exists" || echo "✗ MISSING"
115
+
116
+ echo "=== Global settings.json ==="
117
+ [ -f ~/.claude/settings.json ] && echo "✓ exists" || echo "✗ MISSING"
118
+
119
+ echo "=== Global hooks ==="
120
+ ls ~/.claude/hooks/ 2>/dev/null || echo "✗ NO HOOKS"
121
+ ```
122
+
123
+ ## Step 5 — Report
124
+
125
+ ```
126
+ Global Config Installation Complete
127
+ ====================================
128
+
129
+ ~/.claude/CLAUDE.md:
130
+ [fresh install / merged X new sections / already up to date]
131
+
132
+ ~/.claude/settings.json:
133
+ [fresh install / merged X new rules / already up to date]
134
+
135
+ ~/.claude/hooks/:
136
+ [X hooks installed / X already existed]
137
+
138
+ Your existing rules were NOT overwritten.
139
+ New sections were appended. Review ~/.claude/CLAUDE.md to customize.
140
+
141
+ TIP: Update the Identity section with your GitHub username:
142
+ ~/.claude/CLAUDE.md → ## Identity
143
+
144
+ Next: /new-project my-app clean — scaffold your first project
145
+ ```