@claude-code-mastery/starter-kit 1.1.0 → 1.2.1

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.
@@ -74,7 +74,13 @@ project/
74
74
  2. **Run the batch scaffold script** — this replaces all individual file creation with a single command:
75
75
 
76
76
  ```bash
77
- bash "$(pwd)/scripts/scaffold-clean.sh" "$PROJECT_PATH" "$PROJECT_NAME" "$(pwd)"
77
+ # Resolve the kit source: npm global install takes priority over CWD
78
+ if [ -f ~/.claude/starter-kit-source-path ]; then
79
+ KIT=$(cat ~/.claude/starter-kit-source-path)
80
+ else
81
+ KIT="$(pwd)"
82
+ fi
83
+ bash "$KIT/scripts/scaffold-clean.sh" "$PROJECT_PATH" "$PROJECT_NAME" "$KIT"
78
84
  ```
79
85
 
80
86
  The script handles ALL of the following in one execution (~100ms) with a progress indicator:
@@ -394,7 +394,7 @@ When creating a Go project, the CLAUDE.md MUST include these Go-specific rules:
394
394
  8. Create `Dockerfile` (multi-stage with scratch, using template above)
395
395
  9. Create `.golangci.yml` (using template above)
396
396
  10. Create Go-specific `CLAUDE.md` (with Go rules above + universal security rules)
397
- 11. Copy `.claude/` contents from starter kit only commands with `scope: project` in frontmatter (skills, hooks, settings.json copied in full)
397
+ 11. **If NOT using npm global install** (`~/.claude/starter-kit-source-path` does not exist): Copy `.claude/` contents from starter kit - only commands with `scope: project` in frontmatter (skills, hooks, settings.json copied in full). **If npm global install is active**: skip this step - commands/skills/hooks already live in `~/.claude/` globally.
398
398
  12. Create `project-docs/` templates (ARCHITECTURE.md, INFRASTRUCTURE.md, DECISIONS.md)
399
399
  13. Create `.env`, `.env.example`, `.gitignore` (Go-specific), `.dockerignore`
400
400
  14. Create `CLAUDE.local.md` template
@@ -81,13 +81,22 @@ Based on answers, scaffold the project.
81
81
  **If the resolved choices exactly match the default profile** (fullstack + next + mongo + tailwind + docker + pnpm), use the batch scaffold script for maximum speed:
82
82
 
83
83
  ```bash
84
- bash "$(pwd)/scripts/scaffold-default.sh" "$PROJECT_PATH" "$PROJECT_NAME" "$(pwd)"
84
+ # Resolve the kit source: npm global install takes priority over CWD
85
+ if [ -f ~/.claude/starter-kit-source-path ]; then
86
+ KIT=$(cat ~/.claude/starter-kit-source-path)
87
+ else
88
+ KIT="$(pwd)"
89
+ fi
90
+ bash "$KIT/scripts/scaffold-default.sh" "$PROJECT_PATH" "$PROJECT_NAME" "$KIT"
85
91
  ```
86
92
 
87
93
  The script handles ALL of the following in one execution with progress indicators:
88
- - Creates all directories (src/, .claude/, project-docs/, tests/, scripts/, .github/)
89
- - Copies project-scoped commands, all skills, and all hooks
90
- - Writes settings.json (full 9-hook config)
94
+ - Creates all directories (src/, project-docs/, tests/, scripts/, .github/)
95
+ - For clone users: copies project-scoped commands, all skills, and all hooks into the project's .claude/
96
+ - For npm users: skips local .claude/ copy (commands/skills/hooks already live globally in ~/.claude/)
97
+ - Writes settings.json (10-hook config) for clone users only
98
+ - Installs StrictDB (npm package) + query system
99
+ - Creates Next.js app structure (layout, page, API health route, instrumentation)
91
100
  - Installs StrictDB (npm package) + query system
92
101
  - Creates Next.js app structure (layout, page, API health route, instrumentation)
93
102
  - Creates TypeScript, Next.js, Tailwind, PostCSS, Vitest, Playwright configs
@@ -415,7 +415,7 @@ When creating a Python project, the CLAUDE.md MUST include these Python-specific
415
415
  10. Create `Makefile` with dev, test, lint, format, run targets
416
416
  11. Create `Dockerfile` (multi-stage with python:3.12-slim)
417
417
  12. Create Python-specific CLAUDE.md (with Python rules + universal security rules)
418
- 13. Copy `.claude/` contents from starter kit only commands with `scope: project` in frontmatter (skills, hooks, settings.json copied in full)
418
+ 13. **If NOT using npm global install** (`~/.claude/starter-kit-source-path` does not exist): Copy `.claude/` contents from starter kit - only commands with `scope: project` in frontmatter (skills, hooks, settings.json copied in full). **If npm global install is active**: skip this step - commands/skills/hooks already live in `~/.claude/` globally.
419
419
  14. Create `project-docs/` templates (ARCHITECTURE.md, INFRASTRUCTURE.md, DECISIONS.md)
420
420
  15. Create `.env`, `.env.example`, `.gitignore` (Python-specific), `.dockerignore`
421
421
  16. Create `CLAUDE.local.md` template
@@ -59,4 +59,7 @@ Non-negotiable for this codebase. From production, not preference.
59
59
 
60
60
  ## Schema
61
61
 
62
- - **Collections enforce no structure by default.** Add a `$jsonSchema` validator as a collection stabilizes and more code depends on its shape. Roll out safely: `validationAction: "warn"` to observe first, then `error`; `validationLevel: "moderate"` to spare existing nonconforming documents.
62
+ Collections enforce no structure by default, so validate in two layers.
63
+
64
+ - **Parse before every write.** Validate each document against its Zod schema right before it hits the database, so a malformed shape never lands. The schema itself isn't Mongo-specific, it's the same contract the API and frontend use, see the `schema-source-of-truth` skill for defining it once and deriving every layer from one base.
65
+ - **Keep a `$jsonSchema` collection validator as the floor.** Zod only guards writes that go through your app, so the DB validator is the last line that also catches mongosh, scripts, and other services. Add it as a collection stabilizes and more code depends on its shape. Roll out safely: `validationAction: "warn"` to observe first, then `error`; `validationLevel: "moderate"` to spare existing nonconforming documents.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: schema-source-of-truth
3
+ description: One canonical Zod schema per entity, reused across the stack instead of redeclared at each layer. Use whenever defining or changing a data shape, a TypeScript type or interface for an entity, an API request/response validator, an Express body/query/params check, a frontend form validator, or a DB document shape. Catches the same-entity-defined-four-times drift. TypeScript-first, derive types and per-layer variants from one base instead of hand-writing parallel copies.
4
+ when_to_use: |
5
+ - Defining or editing an entity's shape (a User, Order, etc.) in types, an API, a form, or the DB
6
+ - Writing API request/response validation or Express middleware that checks req.body / query / params
7
+ - Writing a frontend form validator, or a TypeScript interface/type for data that also lives on the backend
8
+ - Any moment you're about to write a second definition of a shape that already exists somewhere
9
+ - Do NOT use for one-off internal types with no cross-layer counterpart
10
+ ---
11
+
12
+ # Schema as a Single Source of Truth
13
+
14
+ A data entity should be defined once, as a Zod schema, and everything else derived from it. The failure pattern to kill: declaring the same entity separately at each layer, a frontend `interface User`, a backend `interface User`, a hand-written API validator, and a manual Mongo `$jsonSchema`. Four shapes for one entity, kept in sync by hand, guaranteed to drift the first time a field is added or renamed.
15
+
16
+ ## One schema per entity, derive the rest
17
+
18
+ Define the canonical schema once and generate every other representation from it:
19
+
20
+ - **TypeScript type:** `type User = z.infer<typeof UserSchema>`. Never hand-write an `interface` that parallels a schema, infer it so it can't fall out of sync.
21
+ - **API validation:** parse `req.body` / `req.query` / `req.params` through the schema in middleware. `safeParse` and return 400 on failure, no field-by-field `if` checks.
22
+ - **Frontend forms:** the same schema drives form validation (`zodResolver` with react-hook-form), so client and server reject the same inputs by the same rules.
23
+ - **Pre-write guard:** parse before writing to the DB. See the `mongodb-rules` skill for the Mongo-specific parse-before-write and `$jsonSchema` floor.
24
+ - **OpenAPI and `$jsonSchema`:** generate them from the schema (`zod-to-openapi`, `zod-to-json-schema`) rather than maintaining them by hand.
25
+
26
+ Zod is TypeScript-first with zero runtime dependencies, so this costs one small library and removes every duplicated definition.
27
+
28
+ ## One base, many variants (they are not identical)
29
+
30
+ "Same schema everywhere" is the goal, but a create payload is not the stored document and a response is not the request, so don't pretend they're one object. Model it honestly: one base schema, with per-layer variants derived from it, sharing a single origin while differing where they genuinely must.
31
+
32
+ ```typescript
33
+ const UserSchema = z.object({
34
+ _id: z.string(),
35
+ email: z.string().email(),
36
+ name: z.string().min(1),
37
+ createdAt: z.date(),
38
+ });
39
+
40
+ const CreateUser = UserSchema.omit({ _id: true, createdAt: true }); // POST body
41
+ const UpdateUser = CreateUser.partial(); // PATCH body
42
+ const UserResponse = UserSchema.extend({ displayName: z.string() }); // adds computed field
43
+ type User = z.infer<typeof UserSchema>;
44
+ ```
45
+
46
+ Derive variants with `.omit()`, `.partial()`, `.pick()`, `.extend()`. When the base gains a field, every variant inherits it automatically, which is the entire point. A hand-copied variant is just the drift problem at smaller scale.
47
+
48
+ ## Make it physically shared
49
+
50
+ Single source of truth only holds if there is literally one file. Put entity schemas in a shared module both sides import, a `packages/schemas` workspace, or a shared `src/schemas/` reachable by frontend and backend. If each side keeps its own copy, they diverge no matter how disciplined the intent. The shared import is the enforcement, not the convention.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @claude-code-mastery/starter-kit
2
2
 
3
- A Claude Code toolkit that installs 27 commands, 10 skills, 10 hooks, and scaffolding templates into Claude Code globally - so every project you open already has them available.
3
+ A Claude Code toolkit that installs 27 commands, 11 skills, 10 hooks, and scaffolding templates into Claude Code globally - so every project you open already has them available.
4
4
 
5
5
  **Requires:** Node.js 20+ and [Claude Code](https://claude.ai/code)
6
6
 
@@ -25,7 +25,7 @@ After `init`, your `~/.claude/` directory looks like this:
25
25
  ├── starter-kit/ <- package files live here (single source of truth)
26
26
  │ ├── commands/ <- 27 slash commands
27
27
  │ ├── hooks/ <- 10 lifecycle hooks
28
- │ ├── skills/ <- 10 skill files
28
+ │ ├── skills/ <- 11 skill files
29
29
  │ └── .starter-kit/ <- scaffolding templates for /new-project
30
30
  ├── commands/
31
31
  │ ├── new-project.md -> (symlink to starter-kit/commands/new-project.md)
@@ -84,6 +84,7 @@ Skills are expertise files Claude loads when relevant. These install automatical
84
84
  - `create-service` - scaffolding patterns for new services
85
85
  - `mcp-builder` - MCP server development patterns
86
86
  - `terminal-tui` - Ink + React TUI patterns, resize handling
87
+ - `schema-source-of-truth` - one canonical Zod schema per entity, derived across all layers; catches the same shape defined four times drift
87
88
 
88
89
  ---
89
90
 
package/README.npm.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @claude-code-mastery/starter-kit
2
2
 
3
- A Claude Code toolkit that installs 27 commands, 10 skills, 10 hooks, and scaffolding templates into Claude Code globally - so every project you open already has them available.
3
+ A Claude Code toolkit that installs 27 commands, 11 skills, 10 hooks, and scaffolding templates into Claude Code globally - so every project you open already has them available.
4
4
 
5
5
  **Requires:** Node.js 20+ and [Claude Code](https://claude.ai/code)
6
6
 
@@ -25,7 +25,7 @@ After `init`, your `~/.claude/` directory looks like this:
25
25
  ├── starter-kit/ <- package files live here (single source of truth)
26
26
  │ ├── commands/ <- 27 slash commands
27
27
  │ ├── hooks/ <- 10 lifecycle hooks
28
- │ ├── skills/ <- 10 skill files
28
+ │ ├── skills/ <- 11 skill files
29
29
  │ └── .starter-kit/ <- scaffolding templates for /new-project
30
30
  ├── commands/
31
31
  │ ├── new-project.md -> (symlink to starter-kit/commands/new-project.md)
@@ -84,6 +84,7 @@ Skills are expertise files Claude loads when relevant. These install automatical
84
84
  - `create-service` - scaffolding patterns for new services
85
85
  - `mcp-builder` - MCP server development patterns
86
86
  - `terminal-tui` - Ink + React TUI patterns, resize handling
87
+ - `schema-source-of-truth` - one canonical Zod schema per entity, derived across all layers; catches the same shape defined four times drift
87
88
 
88
89
  ---
89
90
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-code-mastery/starter-kit",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Production-ready Claude Code starter kit — commands, hooks, skills, and agents for AI-assisted development",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -14,6 +14,18 @@ PROJECT_NAME="$2"
14
14
  STARTER_KIT="$3"
15
15
  REGISTRY="${HOME}/.claude/starter-kit-projects.json"
16
16
 
17
+ # ── Global install detection ───────────────────────────────────────────────────
18
+ # npm users: copyPackageFiles flattens .claude/* into ~/.claude/starter-kit/ directly,
19
+ # so commands are at $STARTER_KIT/commands/ (no extra .claude/ level).
20
+ # Clone users: content lives under $STARTER_KIT/.claude/.
21
+ if [ -f "${HOME}/.claude/starter-kit-source-path" ]; then
22
+ GLOBAL_INSTALLED=true
23
+ CLAUDE_DIR="$STARTER_KIT"
24
+ else
25
+ GLOBAL_INSTALLED=false
26
+ CLAUDE_DIR="$STARTER_KIT/.claude"
27
+ fi
28
+
17
29
  # ── Validation ─────────────────────────────────────────────────────────────────
18
30
  if [ -d "$PROJECT_PATH" ]; then
19
31
  echo "ERROR: Directory already exists: $PROJECT_PATH"
@@ -21,7 +33,7 @@ if [ -d "$PROJECT_PATH" ]; then
21
33
  exit 1
22
34
  fi
23
35
 
24
- if [ ! -d "$STARTER_KIT/.claude/commands" ]; then
36
+ if [ ! -d "$CLAUDE_DIR/commands" ]; then
25
37
  echo "ERROR: Starter kit not found at: $STARTER_KIT"
26
38
  exit 1
27
39
  fi
@@ -75,40 +87,42 @@ echo ""
75
87
 
76
88
  # ── Step 1: Create directories ─────────────────────────────────────────────────
77
89
  progress "Creating directory structure..."
78
- mkdir -p "$PROJECT_PATH"/.claude/{commands,skills,agents,hooks}
90
+ if [ "$GLOBAL_INSTALLED" = "false" ]; then
91
+ mkdir -p "$PROJECT_PATH"/.claude/{commands,skills,agents,hooks}
92
+ fi
79
93
  mkdir -p "$PROJECT_PATH"/project-docs
80
94
  mkdir -p "$PROJECT_PATH"/tests
81
95
 
82
- # ── Step 2: Copy 16 project-scoped commands ────────────────────────────────────
83
- progress "Copying 16 project commands..."
84
- for cmd in architecture commit create-api create-e2e diagram help \
85
- optimize-docker progress refactor review security-check \
86
- setup show-user-guide test-plan what-is-my-ai-doing worktree; do
87
- cp "$STARTER_KIT/.claude/commands/${cmd}.md" "$PROJECT_PATH/.claude/commands/"
88
- done
89
-
90
- # ── Step 3: Copy skills, agents, hooks ─────────────────────────────────────────
91
- progress "Copying skills, agents, hooks..."
92
- cp -r "$STARTER_KIT/.claude/skills/code-review" "$PROJECT_PATH/.claude/skills/"
93
- cp -r "$STARTER_KIT/.claude/skills/create-service" "$PROJECT_PATH/.claude/skills/"
94
- cp "$STARTER_KIT/.claude/agents/code-reviewer.md" "$PROJECT_PATH/.claude/agents/"
95
- cp "$STARTER_KIT/.claude/agents/test-writer.md" "$PROJECT_PATH/.claude/agents/"
96
- cp "$STARTER_KIT/.claude/hooks/block-secrets.py" "$PROJECT_PATH/.claude/hooks/"
97
- cp "$STARTER_KIT/.claude/hooks/lint-on-save.sh" "$PROJECT_PATH/.claude/hooks/"
98
- cp "$STARTER_KIT/.claude/hooks/verify-no-secrets.sh" "$PROJECT_PATH/.claude/hooks/"
99
-
100
- # ── Step 4: Write settings.json (clean mode — 3 hooks only) ───────────────────
101
- progress "Writing settings.json..."
102
- cat > "$PROJECT_PATH/.claude/settings.json" << 'SETTINGS_EOF'
96
+ # ── Steps 2-4: Copy Claude infrastructure (clone users only) ──────────────────
97
+ # npm users already have commands/skills/hooks installed globally in ~/.claude/
98
+ if [ "$GLOBAL_INSTALLED" = "false" ]; then
99
+ progress "Copying 16 project commands..."
100
+ for cmd in architecture commit create-api create-e2e diagram help \
101
+ optimize-docker progress refactor review security-check \
102
+ setup show-user-guide test-plan what-is-my-ai-doing worktree; do
103
+ cp "$CLAUDE_DIR/commands/${cmd}.md" "$PROJECT_PATH/.claude/commands/"
104
+ done
105
+
106
+ progress "Copying skills, agents, hooks..."
107
+ cp -r "$CLAUDE_DIR/skills/code-review" "$PROJECT_PATH/.claude/skills/"
108
+ cp -r "$CLAUDE_DIR/skills/create-service" "$PROJECT_PATH/.claude/skills/"
109
+ cp "$CLAUDE_DIR/agents/code-reviewer.md" "$PROJECT_PATH/.claude/agents/"
110
+ cp "$CLAUDE_DIR/agents/test-writer.md" "$PROJECT_PATH/.claude/agents/"
111
+ cp "$CLAUDE_DIR/hooks/block-dangerous-bash.py" "$PROJECT_PATH/.claude/hooks/"
112
+ cp "$CLAUDE_DIR/hooks/lint-on-save.sh" "$PROJECT_PATH/.claude/hooks/"
113
+ cp "$CLAUDE_DIR/hooks/verify-no-secrets.sh" "$PROJECT_PATH/.claude/hooks/"
114
+
115
+ progress "Writing settings.json..."
116
+ cat > "$PROJECT_PATH/.claude/settings.json" << 'SETTINGS_EOF'
103
117
  {
104
118
  "hooks": {
105
119
  "PreToolUse": [
106
120
  {
107
- "matcher": "Read|Edit|Write",
121
+ "matcher": "Bash",
108
122
  "hooks": [
109
123
  {
110
124
  "type": "command",
111
- "command": "python3 .claude/hooks/block-secrets.py"
125
+ "command": "python3 .claude/hooks/block-dangerous-bash.py"
112
126
  }
113
127
  ]
114
128
  }
@@ -137,6 +151,12 @@ cat > "$PROJECT_PATH/.claude/settings.json" << 'SETTINGS_EOF'
137
151
  }
138
152
  }
139
153
  SETTINGS_EOF
154
+ else
155
+ # Skip counts for npm users — 3 steps replaced by one message
156
+ progress "Skipping local .claude/ copy (commands/skills/hooks live globally)"
157
+ progress "Skipping local .claude/ copy (commands/skills/hooks live globally)"
158
+ progress "Skipping local .claude/ copy (commands/skills/hooks live globally)"
159
+ fi
140
160
 
141
161
  # ── Step 4b: Create features.json (empty manifest for clean mode) ─────────────
142
162
  cat > "$PROJECT_PATH/.claude/features.json" << 'FEATURES_EOF'
@@ -15,6 +15,15 @@ PROJECT_NAME="$2"
15
15
  STARTER_KIT="$3"
16
16
  REGISTRY="${HOME}/.claude/starter-kit-projects.json"
17
17
 
18
+ # ── Global install detection ───────────────────────────────────────────────────
19
+ if [ -f "${HOME}/.claude/starter-kit-source-path" ]; then
20
+ GLOBAL_INSTALLED=true
21
+ CLAUDE_DIR="$STARTER_KIT"
22
+ else
23
+ GLOBAL_INSTALLED=false
24
+ CLAUDE_DIR="$STARTER_KIT/.claude"
25
+ fi
26
+
18
27
  # ── Validation ─────────────────────────────────────────────────────────────────
19
28
  if [ -d "$PROJECT_PATH" ]; then
20
29
  echo "ERROR: Directory already exists: $PROJECT_PATH"
@@ -22,7 +31,7 @@ if [ -d "$PROJECT_PATH" ]; then
22
31
  exit 1
23
32
  fi
24
33
 
25
- if [ ! -d "$STARTER_KIT/.claude/commands" ]; then
34
+ if [ ! -d "$CLAUDE_DIR/commands" ]; then
26
35
  echo "ERROR: Starter kit not found at: $STARTER_KIT"
27
36
  exit 1
28
37
  fi
@@ -77,7 +86,9 @@ echo ""
77
86
 
78
87
  # ── Step 1: Create directory structure ─────────────────────────────────────────
79
88
  progress "Creating directory structure..."
80
- mkdir -p "$PROJECT_PATH"/.claude/{commands,skills,agents,hooks}
89
+ if [ "$GLOBAL_INSTALLED" = "false" ]; then
90
+ mkdir -p "$PROJECT_PATH"/.claude/{commands,skills,agents,hooks}
91
+ fi
81
92
  mkdir -p "$PROJECT_PATH"/project-docs
82
93
  mkdir -p "$PROJECT_PATH"/src/app/api/v1/health
83
94
  mkdir -p "$PROJECT_PATH"/src/handlers
@@ -89,46 +100,41 @@ mkdir -p "$PROJECT_PATH"/content
89
100
  mkdir -p "$PROJECT_PATH"/.github/workflows
90
101
  mkdir -p "$PROJECT_PATH"/public
91
102
 
92
- # ── Step 2: Copy 16 project-scoped commands ────────────────────────────────────
93
- progress "Copying 16 project commands..."
94
- for cmd in architecture commit create-api create-e2e diagram help \
95
- optimize-docker progress refactor review security-check \
96
- setup show-user-guide test-plan what-is-my-ai-doing worktree; do
97
- cp "$STARTER_KIT/.claude/commands/${cmd}.md" "$PROJECT_PATH/.claude/commands/"
98
- done
99
-
100
- # ── Step 3: Copy skills, agents, ALL 9 hooks ──────────────────────────────────
101
- progress "Copying skills, agents, 9 hooks..."
102
- cp -r "$STARTER_KIT/.claude/skills/code-review" "$PROJECT_PATH/.claude/skills/"
103
- cp -r "$STARTER_KIT/.claude/skills/create-service" "$PROJECT_PATH/.claude/skills/"
104
- cp "$STARTER_KIT/.claude/agents/code-reviewer.md" "$PROJECT_PATH/.claude/agents/"
105
- cp "$STARTER_KIT/.claude/agents/test-writer.md" "$PROJECT_PATH/.claude/agents/"
106
- for hook in block-secrets.py lint-on-save.sh verify-no-secrets.sh \
107
- check-rybbit.sh check-branch.sh check-ports.sh \
108
- check-e2e.sh check-rulecatch.sh check-env-sync.sh; do
109
- cp "$STARTER_KIT/.claude/hooks/${hook}" "$PROJECT_PATH/.claude/hooks/"
110
- done
111
- chmod +x "$PROJECT_PATH/.claude/hooks/"*.sh 2>/dev/null
112
- chmod +x "$PROJECT_PATH/.claude/hooks/"*.py 2>/dev/null
113
-
114
- # ── Step 4: Write settings.json (full 9-hook config) ──────────────────────────
115
- progress "Writing settings.json (9 hooks)..."
116
- cat > "$PROJECT_PATH/.claude/settings.json" << 'SETTINGS_EOF'
103
+ # ── Steps 2-4: Copy Claude infrastructure (clone users only) ──────────────────
104
+ # npm users already have commands/skills/hooks installed globally in ~/.claude/
105
+ if [ "$GLOBAL_INSTALLED" = "false" ]; then
106
+ progress "Copying 16 project commands..."
107
+ for cmd in architecture commit create-api create-e2e diagram help \
108
+ optimize-docker progress refactor review security-check \
109
+ setup show-user-guide test-plan what-is-my-ai-doing worktree; do
110
+ cp "$CLAUDE_DIR/commands/${cmd}.md" "$PROJECT_PATH/.claude/commands/"
111
+ done
112
+
113
+ progress "Copying skills, agents, 10 hooks..."
114
+ cp -r "$CLAUDE_DIR/skills/code-review" "$PROJECT_PATH/.claude/skills/"
115
+ cp -r "$CLAUDE_DIR/skills/create-service" "$PROJECT_PATH/.claude/skills/"
116
+ cp "$CLAUDE_DIR/agents/code-reviewer.md" "$PROJECT_PATH/.claude/agents/"
117
+ cp "$CLAUDE_DIR/agents/test-writer.md" "$PROJECT_PATH/.claude/agents/"
118
+ for hook in block-dangerous-bash.py check-file-length.py lint-on-save.sh \
119
+ verify-no-secrets.sh check-rybbit.sh check-branch.sh \
120
+ check-ports.sh check-e2e.sh check-rulecatch.sh check-env-sync.sh; do
121
+ cp "$CLAUDE_DIR/hooks/${hook}" "$PROJECT_PATH/.claude/hooks/"
122
+ done
123
+ chmod +x "$PROJECT_PATH/.claude/hooks/"*.sh 2>/dev/null
124
+ chmod +x "$PROJECT_PATH/.claude/hooks/"*.py 2>/dev/null
125
+
126
+ progress "Writing settings.json (10 hooks)..."
127
+ cat > "$PROJECT_PATH/.claude/settings.json" << 'SETTINGS_EOF'
117
128
  {
118
129
  "hooks": {
119
130
  "PreToolUse": [
120
131
  {
121
- "matcher": "Read|Edit|Write",
132
+ "matcher": "Bash",
122
133
  "hooks": [
123
134
  {
124
135
  "type": "command",
125
- "command": "python3 .claude/hooks/block-secrets.py"
126
- }
127
- ]
128
- },
129
- {
130
- "matcher": "Bash",
131
- "hooks": [
136
+ "command": "python3 .claude/hooks/block-dangerous-bash.py"
137
+ },
132
138
  {
133
139
  "type": "command",
134
140
  "command": "bash .claude/hooks/check-rybbit.sh"
@@ -150,8 +156,12 @@ cat > "$PROJECT_PATH/.claude/settings.json" << 'SETTINGS_EOF'
150
156
  ],
151
157
  "PostToolUse": [
152
158
  {
153
- "matcher": "Write",
159
+ "matcher": "Write|Edit",
154
160
  "hooks": [
161
+ {
162
+ "type": "command",
163
+ "command": "python3 .claude/hooks/check-file-length.py"
164
+ },
155
165
  {
156
166
  "type": "command",
157
167
  "command": "bash .claude/hooks/lint-on-save.sh"
@@ -180,6 +190,11 @@ cat > "$PROJECT_PATH/.claude/settings.json" << 'SETTINGS_EOF'
180
190
  }
181
191
  }
182
192
  SETTINGS_EOF
193
+ else
194
+ progress "Skipping local .claude/ copy (commands/skills/hooks live globally)"
195
+ progress "Skipping local .claude/ copy (commands/skills/hooks live globally)"
196
+ progress "Skipping local .claude/ copy (commands/skills/hooks live globally)"
197
+ fi
183
198
 
184
199
  # ── Step 4b: Create features.json (populated manifest) ────────────────────────
185
200
  CREATED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ")