@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,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: List all projects created by the starter kit
|
|
3
|
+
scope: starter-kit
|
|
4
|
+
allowed-tools: Read, Bash(ls:*), Bash(date:*), Bash(stat:*), Bash(wc:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Projects Created — Starter Kit Project Registry
|
|
8
|
+
|
|
9
|
+
List every project that was scaffolded by `/new-project`, with creation date, profile used, and location.
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
### 1. Read the registry
|
|
14
|
+
|
|
15
|
+
Read `~/.claude/starter-kit-projects.json`. If the file does not exist, tell the user:
|
|
16
|
+
|
|
17
|
+
> No projects have been created yet. Use `/new-project my-app` to scaffold your first project.
|
|
18
|
+
|
|
19
|
+
And stop.
|
|
20
|
+
|
|
21
|
+
### 2. Parse and validate
|
|
22
|
+
|
|
23
|
+
The registry format is:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"projects": [
|
|
28
|
+
{
|
|
29
|
+
"name": "my-app",
|
|
30
|
+
"path": "/home/user/projects/my-app",
|
|
31
|
+
"profile": "default",
|
|
32
|
+
"language": "node",
|
|
33
|
+
"framework": "next",
|
|
34
|
+
"database": "mongo",
|
|
35
|
+
"createdAt": "2025-01-15T10:30:00Z"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. Check which projects still exist on disk
|
|
42
|
+
|
|
43
|
+
For each project in the registry, check if the directory still exists:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
ls -d /path/to/project 2>/dev/null
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Mark projects whose directory no longer exists as `(missing)`.
|
|
50
|
+
|
|
51
|
+
### 4. Display the table
|
|
52
|
+
|
|
53
|
+
Print a formatted table sorted by creation date (newest first):
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
=== Projects Created by Starter Kit ===
|
|
57
|
+
|
|
58
|
+
# Name Profile Language Framework Database Created Path
|
|
59
|
+
1 my-app default node next mongo 2025-01-15 ~/projects/my-app
|
|
60
|
+
2 my-api python-api python fastapi postgres 2025-01-14 ~/projects/my-api
|
|
61
|
+
3 old-project go go gin mongo 2025-01-10 ~/projects/old-project (missing)
|
|
62
|
+
|
|
63
|
+
Total: 3 projects (2 active, 1 missing)
|
|
64
|
+
|
|
65
|
+
Tip: Use /remove-project <name> to remove a project and its registry entry.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 5. Handle empty registry
|
|
69
|
+
|
|
70
|
+
If the registry exists but has zero projects:
|
|
71
|
+
|
|
72
|
+
> No projects in the registry. Use `/new-project my-app` to scaffold a project.
|
|
73
|
+
|
|
74
|
+
### Notes
|
|
75
|
+
|
|
76
|
+
- The registry is stored at `~/.claude/starter-kit-projects.json` (global — shared across all starter kit instances)
|
|
77
|
+
- Projects are registered automatically by `/new-project` after successful scaffolding
|
|
78
|
+
- Missing projects still appear in the list — use `/remove-project` to clean them up
|
|
79
|
+
- The registry file is NEVER committed to git (it's in `~/.claude/`)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactive first-run walkthrough for new users
|
|
3
|
+
scope: starter-kit
|
|
4
|
+
allowed-tools: Bash(ls:*), Bash(cat:*), AskUserQuestion, Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Quickstart — First-Run Walkthrough
|
|
8
|
+
|
|
9
|
+
Guide the user through their first experience with the Claude Code Starter Kit. This is an interactive walkthrough — ask questions, check state, and give personalized next steps.
|
|
10
|
+
|
|
11
|
+
## Step 1 — Check Global Config
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ls ~/.claude/CLAUDE.md 2>/dev/null && echo "GLOBAL_CONFIG=installed" || echo "GLOBAL_CONFIG=missing"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If `GLOBAL_CONFIG=missing`:
|
|
18
|
+
|
|
19
|
+
Tell the user:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Your global Claude config isn't installed yet. This is a one-time setup that adds
|
|
23
|
+
security rules and hooks across ALL your projects.
|
|
24
|
+
|
|
25
|
+
Run: /install-global
|
|
26
|
+
|
|
27
|
+
This smart-merges into your existing ~/.claude/ config — it never overwrites.
|
|
28
|
+
Come back to /quickstart after it's done.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Stop here if global config is missing.** Don't proceed until they install it.
|
|
32
|
+
|
|
33
|
+
If `GLOBAL_CONFIG=installed`, continue to Step 2.
|
|
34
|
+
|
|
35
|
+
## Step 2 — Ask Project Details
|
|
36
|
+
|
|
37
|
+
Ask the user:
|
|
38
|
+
|
|
39
|
+
**Question 1:** "What do you want to name your project?"
|
|
40
|
+
|
|
41
|
+
Validate: lowercase letters, numbers, and hyphens only. No spaces, no uppercase. Show an example: `my-awesome-app`
|
|
42
|
+
|
|
43
|
+
**Question 2:** "Which profile do you want to use?"
|
|
44
|
+
|
|
45
|
+
Options:
|
|
46
|
+
- **clean** — All Claude AI tools (commands, hooks, skills) with zero coding opinions. You pick your own language, framework, and structure. Best for: experienced developers who want Claude's tooling without opinionated scaffolding.
|
|
47
|
+
- **default** — Full opinionated stack: Next.js, TypeScript, MongoDB, Tailwind, Docker, CI, Rybbit analytics, Playwright tests. Best for: new projects that want everything pre-configured.
|
|
48
|
+
- **go** — Go project with standard layout (cmd/internal/), Gin router, golangci-lint, Makefile builds, and multi-stage Docker. Best for: developers who prefer Go over Node.js.
|
|
49
|
+
- **vue** — Vue 3 SPA with Composition API, Tailwind, Vite. Best for: Vue developers building SPAs.
|
|
50
|
+
- **nuxt** — Nuxt full-stack with auto-imports, SSR, MongoDB, Docker. Best for: Vue developers who need SSR.
|
|
51
|
+
- **svelte** — Svelte SPA with Tailwind, Vite. Best for: developers who prefer compiled frameworks.
|
|
52
|
+
- **sveltekit** — SvelteKit full-stack with SSR, MongoDB, Docker. Best for: Svelte developers who need SSR + API routes.
|
|
53
|
+
- **angular** — Angular standalone components with Tailwind. Best for: enterprise Angular teams.
|
|
54
|
+
- **python-api** — FastAPI with PostgreSQL, Docker. Best for: Python API developers.
|
|
55
|
+
- **django** — Django full-stack with PostgreSQL, Docker. Best for: Python web developers.
|
|
56
|
+
- **flask** — Flask API with PostgreSQL, Docker. Best for: lightweight Python APIs.
|
|
57
|
+
|
|
58
|
+
## Step 3 — Tell Them to Scaffold
|
|
59
|
+
|
|
60
|
+
Based on their answers, tell the user:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Great! Here's your next step:
|
|
64
|
+
|
|
65
|
+
/new-project $NAME $PROFILE
|
|
66
|
+
|
|
67
|
+
This creates ~/projects/$NAME with everything wired up.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Do NOT run `/new-project` for them.** Tell them to run it themselves — it's a separate command with its own interactive flow.
|
|
71
|
+
|
|
72
|
+
## Step 4 — Show Next Steps
|
|
73
|
+
|
|
74
|
+
After they understand the scaffolding command, show:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
After scaffolding, here's your first 5 minutes:
|
|
78
|
+
|
|
79
|
+
1. cd ~/projects/$NAME
|
|
80
|
+
2. /setup Configure .env (database, GitHub, Docker, analytics)
|
|
81
|
+
3. pnpm install Install dependencies
|
|
82
|
+
4. pnpm dev Start the dev server
|
|
83
|
+
5. Make a change Edit any file
|
|
84
|
+
6. /review Run a code review on your changes
|
|
85
|
+
7. /commit Smart commit with conventional format
|
|
86
|
+
|
|
87
|
+
Available commands (run /help for the full list):
|
|
88
|
+
/diagram all Generate architecture diagrams from your actual code
|
|
89
|
+
/test-plan Create a structured test plan for a feature
|
|
90
|
+
/create-api users Scaffold a full API endpoint with types, handler, route, tests
|
|
91
|
+
/create-e2e login Generate a Playwright E2E test with explicit assertions
|
|
92
|
+
/progress Check project status and prioritized next actions
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Step 5 — Offer Docs
|
|
96
|
+
|
|
97
|
+
Ask: "Want me to open the full documentation?"
|
|
98
|
+
|
|
99
|
+
If yes, tell them:
|
|
100
|
+
```
|
|
101
|
+
Full interactive guide: https://thedecipherist.github.io/claude-code-mastery-project-starter-kit/
|
|
102
|
+
Source guides: https://github.com/TheDecipherist/claude-code-mastery
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If no, say: "You're all set! Run `/help` anytime to see all available commands."
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Refactor a file following all project best practices — split, type, extract, clean
|
|
3
|
+
scope: project
|
|
4
|
+
argument-hint: <file-path> [--dry-run]
|
|
5
|
+
allowed-tools: Read, Write, Edit, Grep, Glob, Bash, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Refactor — Best Practices Enforcement
|
|
9
|
+
|
|
10
|
+
Refactor the target file following every rule in this project's CLAUDE.md.
|
|
11
|
+
|
|
12
|
+
**Target:** $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
If `--dry-run` is passed, report what WOULD change without modifying any files.
|
|
15
|
+
|
|
16
|
+
## Step 0 — Auto-Branch (if on main)
|
|
17
|
+
|
|
18
|
+
Before making any changes, check the current branch:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git branch --show-current
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Default behavior** (`auto_branch = true` in `claude-mastery-project.conf`):
|
|
25
|
+
- If on `main` or `master`: automatically create a feature branch and switch to it:
|
|
26
|
+
```bash
|
|
27
|
+
git checkout -b refactor/<filename-without-extension>
|
|
28
|
+
```
|
|
29
|
+
Report: "Created branch `refactor/<name>` — main stays untouched."
|
|
30
|
+
- If already on a feature branch: proceed
|
|
31
|
+
- If not a git repo: skip this check
|
|
32
|
+
|
|
33
|
+
**To disable:** Set `auto_branch = false` in `claude-mastery-project.conf`. When disabled, warn and ask the user before proceeding on main.
|
|
34
|
+
|
|
35
|
+
## Step 0.5 — Read Before Touching
|
|
36
|
+
|
|
37
|
+
**NEVER refactor blind.** Read these files first:
|
|
38
|
+
|
|
39
|
+
1. The target file (fully — every line)
|
|
40
|
+
2. `CLAUDE.md` — to know the current project rules
|
|
41
|
+
3. `project-docs/ARCHITECTURE.md` — to understand where things belong (if it exists)
|
|
42
|
+
4. `tsconfig.json` — to check TypeScript strict mode settings (if it exists)
|
|
43
|
+
|
|
44
|
+
Also check:
|
|
45
|
+
```bash
|
|
46
|
+
# What imports this file? (understand the blast radius)
|
|
47
|
+
# Search for the filename in all source files
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Report: "This file is imported by X other files. Changes here affect: [list]"
|
|
51
|
+
|
|
52
|
+
## Step 1 — Audit the File
|
|
53
|
+
|
|
54
|
+
Run through EVERY check below. For each violation found, note the line number, what's wrong, and what the fix is.
|
|
55
|
+
|
|
56
|
+
### 1A. File Size (Rule 7: Quality Gates)
|
|
57
|
+
|
|
58
|
+
- **> 300 lines = MUST split.** No exceptions.
|
|
59
|
+
- Identify logical sections that can become their own files
|
|
60
|
+
- Group by: types, constants, helpers/utilities, main logic, exports
|
|
61
|
+
|
|
62
|
+
### 1B. Function Size (Rule 7: Quality Gates)
|
|
63
|
+
|
|
64
|
+
- **> 50 lines = MUST extract.** No exceptions.
|
|
65
|
+
- Identify functions that do multiple things — each "thing" becomes its own function
|
|
66
|
+
- Name extracted functions by what they DO, not where they came from
|
|
67
|
+
|
|
68
|
+
### 1C. TypeScript Compliance (Rule 1: TypeScript Always)
|
|
69
|
+
|
|
70
|
+
- If the file is `.js` or `.jsx` → **convert to `.ts` / `.tsx`**
|
|
71
|
+
- Find ALL `any` types → replace with proper types or `unknown`
|
|
72
|
+
- Check for missing return types on exported functions
|
|
73
|
+
- Check for missing parameter types
|
|
74
|
+
- Check for implicit `any` (TypeScript should catch these in strict mode)
|
|
75
|
+
- Check for `@ts-ignore` or `@ts-expect-error` — remove if possible, document if necessary
|
|
76
|
+
|
|
77
|
+
### 1D. Import Hygiene (Coding Standards)
|
|
78
|
+
|
|
79
|
+
- No barrel imports (`import * as everything from`)
|
|
80
|
+
- No circular imports (A imports B, B imports A)
|
|
81
|
+
- Types should use `import type { }` not `import { }`
|
|
82
|
+
- Unused imports → remove
|
|
83
|
+
- Sort: external packages first, then internal, then types
|
|
84
|
+
|
|
85
|
+
### 1E. Error Handling (Coding Standards)
|
|
86
|
+
|
|
87
|
+
- No swallowed errors (`catch { return null }`)
|
|
88
|
+
- No empty catch blocks
|
|
89
|
+
- Errors must be logged with context (what was being attempted, relevant IDs)
|
|
90
|
+
- User-facing errors must have clear messages
|
|
91
|
+
|
|
92
|
+
### 1F. Database Access (Rule 3)
|
|
93
|
+
|
|
94
|
+
- No direct `MongoClient`, `pg`, `mysql2`, or other database driver imports — use StrictDB
|
|
95
|
+
- All queries go through StrictDB (`queryOne`, `queryMany`, `insertOne`, etc.)
|
|
96
|
+
- No `find()` or `findOne()` — use StrictDB's query API
|
|
97
|
+
- Counters use `$inc` not read-modify-write
|
|
98
|
+
|
|
99
|
+
### 1G. API Routes (Rule 2)
|
|
100
|
+
|
|
101
|
+
- All endpoints use `/api/v1/` prefix
|
|
102
|
+
- No business logic in route handlers — extract to `handlers/`
|
|
103
|
+
|
|
104
|
+
### 1H. Independent Awaits (Rule 8)
|
|
105
|
+
|
|
106
|
+
- Find sequential `await` calls that don't depend on each other
|
|
107
|
+
- Wrap in `Promise.all`
|
|
108
|
+
|
|
109
|
+
### 1I. Security (Rule 0 + Rule 5)
|
|
110
|
+
|
|
111
|
+
- No hardcoded secrets, API keys, tokens, or connection strings
|
|
112
|
+
- No SQL/NoSQL injection vulnerabilities
|
|
113
|
+
- Input validation on external data
|
|
114
|
+
|
|
115
|
+
### 1J. Dead Code
|
|
116
|
+
|
|
117
|
+
- Unused functions → remove entirely (don't comment out)
|
|
118
|
+
- Unused variables → remove
|
|
119
|
+
- Unreachable code → remove
|
|
120
|
+
- Commented-out code blocks → remove (that's what git history is for)
|
|
121
|
+
|
|
122
|
+
## Step 2 — Plan the Refactor
|
|
123
|
+
|
|
124
|
+
Before changing ANYTHING, present the plan to the user:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
Refactor Plan for: src/handlers/users.ts (347 lines)
|
|
128
|
+
=====================================================
|
|
129
|
+
|
|
130
|
+
File size: 347 lines → SPLIT REQUIRED (max 300)
|
|
131
|
+
|
|
132
|
+
Split into:
|
|
133
|
+
1. src/handlers/users.ts — main handler (route logic, ~120 lines)
|
|
134
|
+
2. src/handlers/user-validation.ts — input validation helpers (~80 lines)
|
|
135
|
+
3. src/handlers/user-transforms.ts — data transformation functions (~60 lines)
|
|
136
|
+
4. src/types/user.ts — User, CreateUserInput, UserResponse types (~40 lines)
|
|
137
|
+
|
|
138
|
+
Function extraction:
|
|
139
|
+
- processUserSignup() (73 lines) → split into validateSignupInput() + createUserRecord() + sendWelcomeEmail()
|
|
140
|
+
- getUserDashboard() (62 lines) → split into fetchDashboardData() + formatDashboardResponse()
|
|
141
|
+
|
|
142
|
+
TypeScript fixes:
|
|
143
|
+
- Line 45: `any` → `CreateUserInput`
|
|
144
|
+
- Line 89: missing return type → `Promise<UserResponse>`
|
|
145
|
+
- Line 134: `@ts-ignore` → proper null check
|
|
146
|
+
|
|
147
|
+
Other fixes:
|
|
148
|
+
- Lines 23-25: sequential awaits → Promise.all (independent)
|
|
149
|
+
- Line 67: swallowed error → proper logging + rethrow
|
|
150
|
+
- Line 112: direct database driver import → use StrictDB
|
|
151
|
+
- Lines 200-215: dead code (commented out old auth) → remove
|
|
152
|
+
|
|
153
|
+
Blast radius: imported by 3 files (server.ts, user-routes.ts, admin.ts)
|
|
154
|
+
- Imports will be updated to point to new file locations
|
|
155
|
+
|
|
156
|
+
Proceed? (yes / no / modify plan)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**WAIT for user approval before making any changes.**
|
|
160
|
+
|
|
161
|
+
Use named steps (Step 1, Step 2, etc.) so the user can say "skip Step 3" or "change Step 2 to keep validation inline."
|
|
162
|
+
|
|
163
|
+
## Step 3 — Execute the Refactor
|
|
164
|
+
|
|
165
|
+
After approval, make changes in this order:
|
|
166
|
+
|
|
167
|
+
1. **Create new files first** (types, helpers, utilities)
|
|
168
|
+
2. **Move code** from the original file to new files
|
|
169
|
+
3. **Update imports** in the original file to reference new files
|
|
170
|
+
4. **Update imports** in ALL files that imported from the original
|
|
171
|
+
5. **Fix TypeScript** (types, return types, remove `any`)
|
|
172
|
+
6. **Fix patterns** (Promise.all, error handling, dead code)
|
|
173
|
+
7. **Verify TypeScript compiles:**
|
|
174
|
+
```bash
|
|
175
|
+
npx tsc --noEmit 2>&1 | head -30
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Splitting Rules
|
|
179
|
+
|
|
180
|
+
When splitting a file into multiple files:
|
|
181
|
+
|
|
182
|
+
- **Types** → `src/types/<domain>.ts` (or colocated `<name>.types.ts`)
|
|
183
|
+
- **Constants** → colocated `<name>.constants.ts` or `src/constants/`
|
|
184
|
+
- **Helpers/Utilities** → colocated `<name>.utils.ts` or `src/utils/`
|
|
185
|
+
- **Validation** → colocated `<name>.validation.ts`
|
|
186
|
+
- **The original file** keeps the main logic and imports from the new files
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// BEFORE: one massive file
|
|
190
|
+
// src/handlers/users.ts (347 lines — types, validation, helpers, handlers all mixed)
|
|
191
|
+
|
|
192
|
+
// AFTER: clean separation
|
|
193
|
+
// src/types/user.ts — User, CreateUserInput, UserResponse
|
|
194
|
+
// src/handlers/user-validation.ts — validateEmail(), validatePassword()
|
|
195
|
+
// src/handlers/user-transforms.ts — formatUserResponse(), sanitizeInput()
|
|
196
|
+
// src/handlers/users.ts — handler functions only, imports from above
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Import Updates
|
|
200
|
+
|
|
201
|
+
After splitting, update EVERY file that imported from the original:
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
// BEFORE
|
|
205
|
+
import { User, getUserById, validateEmail } from './handlers/users.js';
|
|
206
|
+
|
|
207
|
+
// AFTER
|
|
208
|
+
import type { User } from '../types/user.js';
|
|
209
|
+
import { getUserById } from './handlers/users.js';
|
|
210
|
+
import { validateEmail } from './handlers/user-validation.js';
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Step 4 — Verify
|
|
214
|
+
|
|
215
|
+
After all changes:
|
|
216
|
+
|
|
217
|
+
1. **TypeScript compiles clean:**
|
|
218
|
+
```bash
|
|
219
|
+
npx tsc --noEmit
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
2. **No broken imports** — search for any import referencing moved/renamed exports:
|
|
223
|
+
```bash
|
|
224
|
+
# Check for compilation errors
|
|
225
|
+
npx tsc --noEmit 2>&1 | grep "error TS"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
3. **No file exceeds 300 lines**
|
|
229
|
+
4. **No function exceeds 50 lines**
|
|
230
|
+
5. **No remaining `any` types** (unless documented why)
|
|
231
|
+
|
|
232
|
+
## Step 5 — RuleCatch Report
|
|
233
|
+
|
|
234
|
+
After the refactor is complete, check RuleCatch:
|
|
235
|
+
|
|
236
|
+
- If the RuleCatch MCP server is available: query for violations in the refactored files
|
|
237
|
+
- Report any remaining violations
|
|
238
|
+
- If no MCP: suggest checking the dashboard
|
|
239
|
+
|
|
240
|
+
## Step 6 — Report
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
Refactor Complete: src/handlers/users.ts
|
|
244
|
+
========================================
|
|
245
|
+
Before: 1 file, 347 lines, 4 violations
|
|
246
|
+
After: 4 files, ~300 lines total, 0 violations
|
|
247
|
+
|
|
248
|
+
Files created:
|
|
249
|
+
✓ src/types/user.ts (40 lines)
|
|
250
|
+
✓ src/handlers/user-validation.ts (80 lines)
|
|
251
|
+
✓ src/handlers/user-transforms.ts (60 lines)
|
|
252
|
+
|
|
253
|
+
Files modified:
|
|
254
|
+
✓ src/handlers/users.ts (120 lines — down from 347)
|
|
255
|
+
✓ src/server.ts (imports updated)
|
|
256
|
+
✓ src/routes/user-routes.ts (imports updated)
|
|
257
|
+
|
|
258
|
+
Fixes applied:
|
|
259
|
+
✓ 3 `any` types replaced with proper types
|
|
260
|
+
✓ 2 functions extracted (were >50 lines)
|
|
261
|
+
✓ 1 Promise.all optimization
|
|
262
|
+
✓ 1 swallowed error fixed
|
|
263
|
+
✓ 15 lines of dead code removed
|
|
264
|
+
|
|
265
|
+
TypeScript: compiles clean ✓
|
|
266
|
+
RuleCatch: no violations ✓
|
|
267
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Remove a project created by the starter kit
|
|
3
|
+
scope: starter-kit
|
|
4
|
+
argument-hint: <project-name>
|
|
5
|
+
allowed-tools: Read, Edit, Bash(rm:*), Bash(ls:*), AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Remove Project — Unregister and Optionally Delete
|
|
9
|
+
|
|
10
|
+
Remove a project from the starter kit registry and optionally delete its files from disk.
|
|
11
|
+
|
|
12
|
+
**Arguments:** $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
### 1. Read the registry
|
|
17
|
+
|
|
18
|
+
Read `~/.claude/starter-kit-projects.json`. If the file does not exist, tell the user:
|
|
19
|
+
|
|
20
|
+
> No projects have been created yet. Nothing to remove.
|
|
21
|
+
|
|
22
|
+
And stop.
|
|
23
|
+
|
|
24
|
+
### 2. Find the project
|
|
25
|
+
|
|
26
|
+
Search the registry for a project matching $ARGUMENTS (by name).
|
|
27
|
+
|
|
28
|
+
**If no argument provided:**
|
|
29
|
+
- List all projects by name
|
|
30
|
+
- Ask via AskUserQuestion: "Which project do you want to remove?"
|
|
31
|
+
- Options: list all project names from the registry
|
|
32
|
+
|
|
33
|
+
**If the project name is not found:**
|
|
34
|
+
- Tell the user: "Project `<name>` not found in the registry."
|
|
35
|
+
- Show the list of registered projects
|
|
36
|
+
- Stop
|
|
37
|
+
|
|
38
|
+
### 3. Show project details
|
|
39
|
+
|
|
40
|
+
Display the project details:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Project: my-app
|
|
44
|
+
Path: ~/projects/my-app
|
|
45
|
+
Profile: default
|
|
46
|
+
Language: node
|
|
47
|
+
Framework: next
|
|
48
|
+
Created: 2025-01-15
|
|
49
|
+
Status: exists on disk / directory not found
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 4. Ask what to do
|
|
53
|
+
|
|
54
|
+
Ask via AskUserQuestion: "What do you want to do with this project?"
|
|
55
|
+
|
|
56
|
+
- **Remove from registry only** — Keep the files, just remove the tracking entry
|
|
57
|
+
- **Delete everything** — Delete the project directory AND remove from registry
|
|
58
|
+
|
|
59
|
+
### 5a. If "Remove from registry only"
|
|
60
|
+
|
|
61
|
+
- Read `~/.claude/starter-kit-projects.json`
|
|
62
|
+
- Remove the matching project entry from the `projects` array
|
|
63
|
+
- Write the updated registry back
|
|
64
|
+
- Confirm: "Removed `<name>` from the project registry. Files at `<path>` are untouched."
|
|
65
|
+
|
|
66
|
+
### 5b. If "Delete everything"
|
|
67
|
+
|
|
68
|
+
**Safety check — ask for explicit confirmation:**
|
|
69
|
+
|
|
70
|
+
Ask via AskUserQuestion: "Are you sure you want to permanently delete `<path>` and all its contents? This cannot be undone."
|
|
71
|
+
|
|
72
|
+
- **Yes, delete it** — Proceed with deletion
|
|
73
|
+
- **No, cancel** — Stop without deleting
|
|
74
|
+
|
|
75
|
+
**If confirmed:**
|
|
76
|
+
|
|
77
|
+
1. Check if the project directory exists on disk
|
|
78
|
+
2. If it exists:
|
|
79
|
+
- Check for uncommitted git changes: `cd <path> && git status --porcelain 2>/dev/null`
|
|
80
|
+
- If there are uncommitted changes, WARN the user and ask again: "This project has uncommitted changes. Are you SURE you want to delete?"
|
|
81
|
+
- Delete the directory: `rm -rf <path>`
|
|
82
|
+
3. Remove the entry from `~/.claude/starter-kit-projects.json`
|
|
83
|
+
4. Confirm: "Deleted `<path>` and removed `<name>` from the registry."
|
|
84
|
+
|
|
85
|
+
**If the directory doesn't exist:**
|
|
86
|
+
- Just remove from registry
|
|
87
|
+
- Confirm: "Directory `<path>` was already gone. Removed `<name>` from the registry."
|
|
88
|
+
|
|
89
|
+
### Safety Rules
|
|
90
|
+
|
|
91
|
+
- NEVER delete without explicit user confirmation
|
|
92
|
+
- ALWAYS warn about uncommitted changes before deletion
|
|
93
|
+
- NEVER delete directories outside the registered path
|
|
94
|
+
- ALWAYS show what will be deleted before doing it
|
|
95
|
+
- The registry itself (`~/.claude/starter-kit-projects.json`) is never deleted — only entries are removed
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Review code for bugs, security issues, and best practices
|
|
3
|
+
scope: project
|
|
4
|
+
allowed-tools: Read, Grep, Glob, Bash(git diff:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Review
|
|
8
|
+
|
|
9
|
+
Review the current changes for:
|
|
10
|
+
|
|
11
|
+
## Branch Check
|
|
12
|
+
|
|
13
|
+
Verify the current branch context:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git branch --show-current
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- If on `main` or `master` and `auto_branch = true` in `claude-mastery-project.conf`: warn — "You're reviewing changes directly on main. Next time, start work on a feature branch."
|
|
20
|
+
- Report which branch is being reviewed in the output header
|
|
21
|
+
- Review is read-only so no auto-branch is created, but the warning reminds the user for future commands
|
|
22
|
+
|
|
23
|
+
## Context
|
|
24
|
+
- Current diff: !`git diff HEAD`
|
|
25
|
+
- Staged changes: !`git diff --cached`
|
|
26
|
+
|
|
27
|
+
## Review Checklist
|
|
28
|
+
|
|
29
|
+
1. **Security** — OWASP Top 10, no secrets in code, proper input validation
|
|
30
|
+
2. **Types** — No `any`, proper null handling, explicit return types
|
|
31
|
+
3. **Error Handling** — No swallowed errors, proper logging, user-friendly messages
|
|
32
|
+
4. **Performance** — No N+1 queries, no memory leaks, proper pagination
|
|
33
|
+
5. **Testing** — New code has tests, tests have explicit assertions
|
|
34
|
+
6. **Database** — StrictDB if installed, otherwise the native driver (in the adapter); never Mongoose, never a raw driver in handlers
|
|
35
|
+
7. **API Versioning** — All endpoints use `/api/v1/` prefix
|
|
36
|
+
|
|
37
|
+
## RuleCatch Report
|
|
38
|
+
|
|
39
|
+
After completing the manual review, query RuleCatch for automated violations on the changed files:
|
|
40
|
+
|
|
41
|
+
- If the RuleCatch MCP server is available: query for violations on the files in the current diff
|
|
42
|
+
- Include results in a dedicated section of the review output (see format below)
|
|
43
|
+
- This catches pattern-based violations the manual review might miss
|
|
44
|
+
- If no MCP available: suggest — "Ask `RuleCatch, what violations happened today?` for automated checks"
|
|
45
|
+
|
|
46
|
+
## Output Format
|
|
47
|
+
|
|
48
|
+
For each issue found:
|
|
49
|
+
- **File**: path/to/file.ts:line
|
|
50
|
+
- **Severity**: 🔴 Critical | 🟡 Warning | 🔵 Info
|
|
51
|
+
- **Issue**: Description
|
|
52
|
+
- **Fix**: Suggested change
|
|
53
|
+
|
|
54
|
+
### RuleCatch Violations
|
|
55
|
+
| File | Rule | Severity | Details |
|
|
56
|
+
|------|------|----------|---------|
|
|
57
|
+
| ... | ... | ... | ... |
|
|
58
|
+
|
|
59
|
+
If no RuleCatch violations: "RuleCatch: No violations detected"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scan project for security issues — exposed secrets, missing .gitignore entries, unsafe patterns
|
|
3
|
+
scope: project
|
|
4
|
+
allowed-tools: Read, Grep, Glob, Bash(git:*), Bash(grep:*), Bash(find:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Security Check
|
|
8
|
+
|
|
9
|
+
Scan this project for security vulnerabilities.
|
|
10
|
+
|
|
11
|
+
## Checks to Perform
|
|
12
|
+
|
|
13
|
+
### 1. Secrets in Code
|
|
14
|
+
```bash
|
|
15
|
+
# Search for common secret patterns in tracked files
|
|
16
|
+
git grep -n -E '(api[_-]?key|secret[_-]?key|password|token)\s*[:=]\s*["\x27][A-Za-z0-9+/=_-]{8,}' -- ':!*.lock' ':!node_modules' 2>/dev/null || echo "No secrets found in code"
|
|
17
|
+
|
|
18
|
+
# Search for AWS keys
|
|
19
|
+
git grep -n 'AKIA[0-9A-Z]\{16\}' 2>/dev/null || echo "No AWS keys found"
|
|
20
|
+
|
|
21
|
+
# Search for hardcoded URLs with credentials
|
|
22
|
+
git grep -n -E '(https?://[^:]+:[^@]+@)' 2>/dev/null || echo "No credential URLs found"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. .gitignore Coverage
|
|
26
|
+
Verify these entries exist in .gitignore:
|
|
27
|
+
- [ ] `.env`
|
|
28
|
+
- [ ] `.env.*`
|
|
29
|
+
- [ ] `.env.local`
|
|
30
|
+
- [ ] `node_modules/`
|
|
31
|
+
- [ ] `dist/`
|
|
32
|
+
- [ ] `CLAUDE.local.md`
|
|
33
|
+
- [ ] `*.log`
|
|
34
|
+
|
|
35
|
+
### 3. Sensitive Files Check
|
|
36
|
+
```bash
|
|
37
|
+
# Check if any sensitive files are tracked by git
|
|
38
|
+
for f in .env .env.local .env.production secrets.json credentials.json id_rsa .npmrc; do
|
|
39
|
+
git ls-files --error-unmatch "$f" 2>/dev/null && echo "⚠️ WARNING: $f is tracked by git!"
|
|
40
|
+
done
|
|
41
|
+
echo "Sensitive file check complete."
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 4. .env File Verification
|
|
45
|
+
- [ ] `.env` exists but is NOT in git
|
|
46
|
+
- [ ] `.env.example` exists and IS in git
|
|
47
|
+
- [ ] `.env.example` has NO real values (only placeholders)
|
|
48
|
+
|
|
49
|
+
### 5. Dependency Audit
|
|
50
|
+
```bash
|
|
51
|
+
# Check for known vulnerabilities (if npm project)
|
|
52
|
+
[ -f "package.json" ] && npm audit --production 2>/dev/null | head -20 || echo "Not an npm project"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 6. RuleCatch Security Violations
|
|
56
|
+
|
|
57
|
+
Query RuleCatch for security-category violations in the current project:
|
|
58
|
+
|
|
59
|
+
- If the RuleCatch MCP server is available: query for violations with category "security"
|
|
60
|
+
- Report: rule name, file, severity, and description for each violation
|
|
61
|
+
- This catches patterns the manual scan might miss (insecure dependencies, unsafe type coercions, missing rate limiting, etc.)
|
|
62
|
+
- If no MCP available: suggest — "Install RuleCatch MCP for automated security monitoring — `npx @rulecatch/mcp-server init`"
|
|
63
|
+
|
|
64
|
+
## Output Format
|
|
65
|
+
|
|
66
|
+
| Check | Status | Details |
|
|
67
|
+
|-------|--------|---------|
|
|
68
|
+
| Secrets in code | ✅/❌ | ... |
|
|
69
|
+
| .gitignore coverage | ✅/❌ | ... |
|
|
70
|
+
| Sensitive files tracked | ✅/❌ | ... |
|
|
71
|
+
| .env handling | ✅/❌ | ... |
|
|
72
|
+
| Dependencies | ✅/❌ | ... |
|
|
73
|
+
| RuleCatch security | ✅/❌ | ... |
|
|
74
|
+
|
|
75
|
+
**Overall: PASS / FAIL**
|
|
76
|
+
|
|
77
|
+
List any specific remediation steps needed.
|