What's Included
Everything you need to start a Claude Code project the right way — security, automation, documentation, and testing all pre-configured.
CLAUDE.md
Battle-tested project instructions with numbered critical rules for security, TypeScript, StrictDB, testing, and deployment.
Global CLAUDE.md
Security gatekeeper for all projects. Never publish secrets, never commit .env files, standardized scaffolding rules.
9 Hooks
Deterministic enforcement that always runs. Block secrets, lint on save, verify no credentials, branch protection, port conflicts, Rybbit pre-deploy gate, E2E test gate, env sync warnings, and RuleCatch monitoring (optional — skips silently if not installed).
26 Slash Commands (16 project + 10 kit management)
/help, /quickstart, /install-global, /setup, /show-user-guide, /diagram, /review, /commit, /progress, /test-plan, /architecture, /new-project, /security-check, /optimize-docker, /create-e2e, /create-api, /worktree, /what-is-my-ai-doing, /refactor, /set-project-profile-default, /add-project-setup, /projects-created, /remove-project, /convert-project-to-starter-kit, /update-project, /add-feature
Skills
Context-aware templates that load on demand. Systematic code review checklist and full microservice scaffolding.
Custom Agents
Read-only code reviewer for security audits. Test writer that creates tests with explicit assertions, not just “page loads.”
Documentation
Pre-structured ARCHITECTURE.md, INFRASTRUCTURE.md, and DECISIONS.md templates that Claude actually follows.
Testing Templates
Master test checklist, issue tracking log, and StrictDB — a unified database driver that prevents connection pool explosion. Built-in sanitization and guardrails allow safe operators while stripping dangerous ones.
Live AI Monitor
See every tool call, token, cost, and file access in real-time. Free monitor mode works instantly — no API key, no setup. Run pnpm ai:monitor in a separate terminal. Zero token overhead.
MDD Workflow NEW
Manual-First Development — the built-in methodology that turns Claude Code from a code generator into a development partner. Every feature starts with documentation. Every fix starts with an audit.
/mdd now asks if you want to work in an isolated worktree — run multiple /mdd sessions simultaneously, each in its own directory and branch. Use /worktree for complete isolation.
What is MDD?
Most people prompt Claude Code like this: "fix the bug in my auth system." Claude reads 40 files, burns through context trying to understand your architecture, and produces something that technically compiles but misses the bigger picture.
MDD flips this. You write structured documentation first, then Claude reads one doc instead of 40 files. It gets the full picture in 200 tokens instead of 20,000. Every phase reads the output of the previous phase, compressing context further at each step.
The Workflow
Usage
One command, three modes:
# Build a new feature (Document → Test skeletons → Implement → Verify)
/mdd add user authentication with JWT tokens
# Audit existing code (Read → Notes → Report → Fix)
/mdd audit
/mdd audit database # audit a specific section
# Check MDD status (docs, tests, findings, quality gates)
/mdd status
Build Mode — New Features
When you run /mdd <feature description>, Claude follows a structured 6-phase process:
- Understand — Reads your architecture, existing docs, asks all questions upfront
- Document — Creates a numbered MDD doc in
.mdd/docs/with full YAML frontmatter - Test Skeletons — Generates failing tests from the documentation (Doc → Test → Code)
- Plan — Presents named steps with time estimates, waits for your approval
- Implement — Builds code until tests pass, reports progress per step
- Verify — Full test suite, typecheck, documentation updated
Tests are generated before code. They define the finish line. If a test fails, the implementation gets fixed — not the test.
Audit Mode — Existing Code
When you run /mdd audit, Claude runs a complete security and quality audit:
- Scope — Reads all
.mdd/docs/files, builds the feature map - Read + Notes — Reads all source files, writes notes every 2 features (survives context compaction)
- Analyze — Reads only the notes (not source code again), produces findings report
- Present — Shows top issues with severity, estimated fix time, asks what to fix
- Fix — Applies fixes from the report, writes tests, updates documentation
The .mdd/ Directory
All MDD artifacts live in a single dotfile directory, gitignored by default:
.mdd/
├── docs/ # Feature documentation (one per feature)
│ ├── 01-project-scaffolding.md
│ ├── 02-profile-system.md
│ └── ...
└── audits/ # Audit artifacts
├── notes-2026-03-01.md # Raw reading notes
├── report-2026-03-01.md # Structured findings
└── results-2026-03-01.md # Before/after summary
Real Results: Self-Audit
We used MDD to audit this starter kit — the same methodology the kit teaches. Here's what happened:
| Phase | Time | Output |
|---|---|---|
| Phase 0: Documentation | ~25 min | 9 feature docs (795 lines) in .mdd/docs/ |
| Phase 1: Read + Notes | 9 min 51s | 57+ files read, 837 lines of notes |
| Phase 2: Analyze | 2 min 39s | 298-line report, 20 findings |
| Phase 3: Fix All | 10 min 53s | 17/20 fixed, 125 tests written |
| Total | ~48 min | 20 findings, 125 tests from zero |
| Metric | Before MDD | After MDD |
|---|---|---|
| Unit tests | 0 | 94 |
| Test files | 0 | 5 |
| Documentation files | 3 | 14 |
| Known issues documented | 0 | 84 |
| Findings found & fixed | 0 | 17/20 |
| Quality gate violations | 1 (651-line file) | 0 (split into 5 modules) |
| Config validation | None (raw JSON.parse) | Zod schema with fail-fast |
| Secret detection patterns | 4 basic | 10+ (GitHub, Slack, Stripe, PEM, JWT) |
Why It Works
The problem with Claude Code isn't intelligence — it's context. A 200K token window sounds huge until you're reading 40 files and burning 80% of context on comprehension before writing a single line of output.
MDD makes each phase a context compressor: documentation compresses 40 files into 1 doc, raw notes compress all source code into a single file, the audit report compresses notes into severity-rated findings. By the time Claude writes code, it's working from a 300-line report — not a 40,000-line codebase. It's not problem-solving. It's pattern-matching.
The Incremental Write Trick
The most important technical detail: when Claude reads files during an audit, context will compact. If your findings are only in Claude's memory, they're gone.
Instead, Claude writes notes to disk every 2 features. If context compacts, it reads the tail of the notes file and picks up where it left off. We've run this pattern across 6 complete audit cycles. Zero data loss.
After processing every 2 features, immediately append your notes to
.mdd/audits/notes.md. If context compacts, read the TAIL of the notes
file and continue from where you left off.
Featured Packages
Four open-source npm packages by TheDecipherist — the same developer behind this starter kit — are integrated into project profiles. All are MIT-licensed.
ClassMCP — Semantic CSS for AI
MCP server that provides semantic CSS class patterns to Claude, reducing token usage when generating or editing styles. Auto-added to the mcp field in CSS-enabled profiles.
claude mcp add classmcp -- npx -y classmcp@latest
StrictDB-MCP — Database Context for AI
MCP server that gives Claude direct access to StrictDB schema discovery, query validation, and explain plans. Claude can inspect collection schemas, dry-run queries, and understand database structure without you pasting it into context. Auto-added to the mcp field in database-enabled profiles.
claude mcp add strictdb-mcp -- npx -y strictdb-mcp@latest
npm: strictdb-mcp
Classpresso — Post-Build CSS Optimization
Consolidates CSS classes after build for 50% faster style recalculation with zero runtime overhead. Auto-added as a devDependency in CSS-enabled profiles. Runs automatically after pnpm build.
pnpm add -D classpresso
npm: classpresso · Website
What Is This?
Three Ways to Use It
A. Scaffold a New Project
The most common path. Run /new-project my-app clean (or default) to create a new project directory with all Claude Code tooling pre-configured. Run /quickstart for a guided walkthrough.
B. Convert an Existing Project
Already have a project? Run /convert-project-to-starter-kit ~/projects/my-app to non-destructively merge all starter kit infrastructure into it. Preserves everything you have, adds what's missing. Undo with git revert HEAD.
C. Customize the Template
Clone this repo and modify the commands, hooks, skills, and rules to match your team's standards. Then use your customized version as the source for /new-project.
pnpm dev expecting a working app. This is the template that creates apps — it's not an app itself. Start with option A above.
Learning Path
Progress through these phases at your own pace. Each builds on the previous one.
• Classic —
/review, /commit, /create-api, /create-e2e (individual commands, you drive)• MDD —
/mdd (structured Document → Test → Code workflow, Claude drives with your approval)Both use the same hooks, rules, and quality gates. MDD adds structured documentation and audit capabilities on top. Learn more about MDD →
Initial Setup
5 minutes
/install-global/new-projectcd my-app/setup
Build Features
/mdd <feature>MDD/review/commit/create-api
Quality & Testing
/mdd auditMDD/mdd statusMDD/create-e2e/test-plan
Deployment
/optimize-docker/security-check- deploy
Advanced
/refactor/what-is-my-ai-doing/worktree- custom rules
First 5 Minutes
/install-global # One-time: install global Claude config
/new-project my-app clean # Scaffold a project (or: default for full stack)
cd ~/projects/my-app # Enter your new project
/setup # Configure .env interactively
pnpm install && pnpm dev # Start building
First Feature (MDD Workflow)
/mdd add user authentication # Claude interviews you, writes docs, generates
# test skeletons, presents a plan, then builds
Use /help to see all 27 commands at any time.
Quick Start
Clone and Customize
# Clone the starter kit
git clone https://github.com/TheDecipherist/claude-code-mastery-project-starter-kit my-project
cd my-project
# Remove git history and start fresh
rm -rf .git
git init
# Copy your .env
cp .env.example .env
Set Up Global Config (One Time)
# Run the install command — smart merges into existing config
/install-global
This installs global CLAUDE.md rules, settings.json hooks, and enforcement scripts (block-secrets.py, verify-no-secrets.sh, check-rulecatch.sh) into ~/.claude/. If you already have a global config, it merges without overwriting.
Manual setup (if you prefer)
cp global-claude-md/CLAUDE.md ~/.claude/CLAUDE.md
cp global-claude-md/settings.json ~/.claude/settings.json
mkdir -p ~/.claude/hooks
cp .claude/hooks/block-secrets.py ~/.claude/hooks/
cp .claude/hooks/verify-no-secrets.sh ~/.claude/hooks/
cp .claude/hooks/check-rulecatch.sh ~/.claude/hooks/
Customize for Your Project
- Run
/setup— Interactive .env configuration (database, GitHub, Docker, analytics) - Edit
CLAUDE.md— Update port assignments, add your specific rules - Run
/diagram all— Auto-generate architecture, API, database, and infrastructure diagrams - Edit
CLAUDE.local.md— Add your personal preferences
StrictDB works out of the box — just pnpm add strictdb and set STRICTDB_URI in your .env. Built-in sanitization and guardrails run on all inputs: safe operators ($gte, $in, $regex, etc.) pass through while dangerous operators ($where, $function) are stripped. Supports MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, and Elasticsearch. See the StrictDB section for details.
Start Building
claude
That's it. Claude Code now has battle-tested rules, deterministic hooks, slash commands, and documentation templates all ready to go.
Troubleshooting
Hooks Not Firing
Verify .claude/settings.json is valid JSON. Check that hook file paths are correct and executable. Restart your Claude Code session — hooks are loaded at session start.
pnpm dev Fails or Does Nothing
This is a scaffold template, not a runnable app. Use /new-project my-app to create a project first, then run pnpm dev inside that project.
Database Connection Errors
Run /setup to configure your .env with a valid connection string. Check that STRICTDB_URI is set and your IP is whitelisted (if using a cloud database like MongoDB Atlas).
/install-global Reports Conflicts
Normal behavior. The command uses smart merge — it keeps your existing sections and only adds what's missing. Check the report output for details.
Port Already in Use
Run lsof -i :PORT to find the process, then kill -9 PID. Or kill all test ports at once: pnpm test:kill-ports
E2E Tests Timing Out
Kill stale processes: pnpm test:kill-ports. Run headed to debug: pnpm test:e2e:headed. Check playwright.config.ts webServer config.
RuleCatch Not Monitoring
Free monitor mode requires no setup. Open a separate terminal and run pnpm ai:monitor (or npx @rulecatch/ai-pooler monitor --no-api-key). For full violation tracking, sign up at rulecatch.ai and run npx @rulecatch/ai-pooler init --api-key=YOUR_KEY --region=us.
Project Structure
project/
├── CLAUDE.md # Project instructions (customize this!)
├── CLAUDE.local.md # Personal overrides (gitignored)
├── .claude/
│ ├── settings.json # Hooks configuration
│ ├── commands/
│ │ ├── help.md # /help — list all commands, skills, and agents
│ │ ├── quickstart.md # /quickstart — interactive first-run walkthrough
│ │ ├── review.md # /review — code review
│ │ ├── commit.md # /commit — smart commit
│ │ ├── progress.md # /progress — project status
│ │ ├── test-plan.md # /test-plan — generate test plan
│ │ ├── architecture.md # /architecture — show system design
│ │ ├── new-project.md # /new-project — scaffold new project
│ │ ├── security-check.md # /security-check — scan for secrets
│ │ ├── optimize-docker.md # /optimize-docker — Docker best practices
│ │ ├── create-e2e.md # /create-e2e — generate E2E tests
│ │ ├── create-api.md # /create-api — scaffold API endpoints
│ │ ├── worktree.md # /worktree — isolated task branches
│ │ ├── what-is-my-ai-doing.md # /what-is-my-ai-doing — live AI monitor
│ │ ├── setup.md # /setup — interactive .env configuration
│ │ ├── refactor.md # /refactor — audit + refactor against all rules
│ │ ├── install-global.md # /install-global — merge global config into ~/.claude/
│ │ ├── diagram.md # /diagram — generate diagrams from actual code
│ │ ├── set-project-profile-default.md # /set-project-profile-default — set default profile
│ │ ├── add-project-setup.md # /add-project-setup — create a named profile
│ │ ├── projects-created.md # /projects-created — list all created projects
│ │ ├── remove-project.md # /remove-project — remove a project from registry
│ │ ├── convert-project-to-starter-kit.md # /convert-project-to-starter-kit — merge into existing project
│ │ ├── update-project.md # /update-project — update a project with latest starter kit
│ │ ├── add-feature.md # /add-feature — add capabilities post-scaffolding
│ │ └── show-user-guide.md # /show-user-guide — open the User Guide in browser
│ ├── skills/
│ │ ├── code-review/SKILL.md # Triggered code review checklist
│ │ └── create-service/SKILL.md # Service scaffolding template
│ ├── agents/
│ │ ├── code-reviewer.md # Read-only review subagent
│ │ └── test-writer.md # Test writing subagent
│ └── hooks/
│ ├── block-secrets.py # PreToolUse: block sensitive files
│ ├── check-rybbit.sh # PreToolUse: block deploy without Rybbit
│ ├── check-branch.sh # PreToolUse: block commits on main
│ ├── check-ports.sh # PreToolUse: block if port in use
│ ├── check-e2e.sh # PreToolUse: block push without E2E tests
│ ├── lint-on-save.sh # PostToolUse: lint after writes
│ ├── verify-no-secrets.sh # Stop: check for secrets
│ ├── check-rulecatch.sh # Stop: report RuleCatch violations
│ └── check-env-sync.sh # Stop: warn on .env/.env.example drift
├── project-docs/
│ ├── ARCHITECTURE.md # System overview (authoritative)
│ ├── INFRASTRUCTURE.md # Deployment details
│ └── DECISIONS.md # Architectural decision records
├── docs/ # GitHub Pages site
│ └── user-guide.html # Interactive User Guide (HTML)
├── src/
│ ├── handlers/ # Business logic
│ ├── adapters/ # External service adapters
│ └── types/ # Shared TypeScript types
├── scripts/
│ ├── db-query.ts # Test Query Master — dev/test query index
│ ├── queries/ # Individual dev/test query files
│ ├── build-content.ts # Markdown → HTML article builder
│ └── content.config.json # Article registry (SEO metadata)
├── content/ # Markdown source files for articles
├── tests/
│ ├── CHECKLIST.md # Master test tracker
│ ├── ISSUES_FOUND.md # User-guided testing log
│ ├── e2e/ # Playwright E2E tests
│ ├── unit/ # Vitest unit tests
│ └── integration/ # Integration tests
├── global-claude-md/ # Copy to ~/.claude/ (one-time setup)
│ ├── CLAUDE.md # Global security gatekeeper
│ └── settings.json # Global hooks config
├── USER_GUIDE.md # Comprehensive User Guide (Markdown)
├── .env.example
├── .gitignore
├── .dockerignore
├── package.json # All npm scripts (dev, test, db:query, etc.)
├── claude-mastery-project.conf # /new-project profiles + global root_dir
├── playwright.config.ts # E2E test config (test ports, webServer)
├── vitest.config.ts # Unit/integration test config
├── tsconfig.json
└── README.md
Key Concepts
Defense in Depth V3
Three layers of protection working together:
- CLAUDE.md rules — Behavioral suggestions (weakest)
- Hooks — Guaranteed to run, stronger than rules, but not bulletproof
- Git safety — .gitignore as last line of defense (strongest)
One Task, One Chat V1–V3
Research shows 39% performance degradation when mixing topics, and a 2% misalignment early can cause 40% failure by end of conversation. Use /clear between unrelated tasks.
Quality Gates V1/V2
No file > 300 lines. No function > 50 lines. All tests pass. TypeScript compiles clean. These prevent the most common code quality issues in AI-assisted development.
MCP Tool Search V4
With 10+ MCP servers, tool descriptions consume 50–70% of context. Tool Search lazy-loads on demand, saving 85% of context.
Plan First, Code Second V5
For non-trivial tasks, always start in plan mode. Don't let Claude write code until you've agreed on the plan. Bad plan = bad code.
Every step MUST have a unique name: Step 3 (Auth System). When you change a step, Claude must replace it — not append. Claude forgets this. If the plan contradicts itself, tell Claude: “Rewrite the full plan.”
CLAUDE.md Is Team Memory
Every time Claude makes a mistake, add a rule to prevent it from happening again. Tell Claude: “Update CLAUDE.md so this doesn't happen again.” Mistake rates actually drop over time. The file is checked into git — the whole team benefits from every lesson.
Never Work on Main
Auto-branch is on by default. Every command that modifies code automatically creates a feature branch when it detects you're on main. Zero friction — you never accidentally break main. Delete the branch if Claude screws up. Use /worktree for parallel sessions in separate directories. Set auto_branch = false in claude-mastery-project.conf to disable.
Windows? Use WSL Mode
Most Windows developers don't know VS Code can run its entire backend inside WSL 2. HMR becomes 5-10x faster, Playwright tests run significantly faster, and file watching actually works. Your project must live on the WSL filesystem (~/projects/), NOT /mnt/c/. Run /setup to auto-detect.
Every Command Enforces the Rules
Every slash command and skill has two built-in enforcement steps: Auto-Branch (automatically creates a feature branch when on main — no manual step) and RuleCatch Report (checks for violations after completion). The rules aren't just documented — they're enforced at every touchpoint.
TypeScript Is Non-Negotiable V5
Types are specs that tell Claude what functions accept and return. Without types, Claude guesses — and guesses become runtime errors.
CLAUDE.md — The Rulebook
The CLAUDE.md file is where you define the rules Claude Code must follow. These aren't suggestions — they're the operating manual for every session. Here are the critical rules included in this starter kit:
NEVER Publish Sensitive Data
- NEVER commit passwords, API keys, tokens, or secrets to git/npm/docker
- NEVER commit
.envfiles — ALWAYS verify.envis in.gitignore - Before ANY commit: verify no secrets are included
TypeScript Always
- ALWAYS use TypeScript for new files (strict mode)
- NEVER use
anyunless absolutely necessary and documented why - When editing JavaScript files, convert to TypeScript first
- Types are specs — they tell you what functions accept and return
API Versioning
CORRECT: /api/v1/users
WRONG: /api/users
Every API endpoint MUST use /api/v1/ prefix. No exceptions.
Database Access — StrictDB Only
- NEVER create direct database connections — always use StrictDB
- ALWAYS use StrictDB for all database operations
- Built-in sanitization and guardrails: safe operators pass through, dangerous operators (
$where,$function) stripped. Use{ trusted: true }for non-standard operators - Supports MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, and Elasticsearch
- One connection pool. One place to change. One place to mock.
Testing — Explicit Success Criteria
// CORRECT — explicit success criteria
await expect(page).toHaveURL('/dashboard');
await expect(page.locator('h1')).toContainText('Welcome');
// WRONG — passes even if broken
await page.goto('/dashboard');
// no assertion!
NEVER Hardcode Credentials
ALWAYS use environment variables. NEVER put API keys, passwords, or tokens directly in code. NEVER hardcode connection strings — use STRICTDB_URI from .env.
ALWAYS Ask Before Deploying
NEVER auto-deploy, even if the fix seems simple. NEVER assume approval — wait for explicit confirmation.
Quality Gates
- No file > 300 lines (split if larger)
- No function > 50 lines (extract helper functions)
- All tests must pass before committing
- TypeScript must compile with no errors (
tsc --noEmit)
Git Workflow — Auto-Branch on Main
- Auto-branch is ON by default — commands auto-create feature branches when on main
- Branch names match the command:
refactor/<file>,test/<feature>,feat/<scope> - Use
/worktreefor parallel sessions in separate directories - Review the full diff (
git diff main...HEAD) before merging - If Claude screws up on a branch — delete it. Main was never touched.
- Disable with
auto_branch = falseinclaude-mastery-project.conf
Parallelize Independent Awaits
When multiple await calls are independent, ALWAYS use Promise.all. Before writing sequential awaits, evaluate: does the second call need the first call's result?
// CORRECT — independent operations run in parallel
const [users, products, orders] = await Promise.all([
getUsers(),
getProducts(),
getOrders(),
]);
// WRONG — sequential when they don't depend on each other
const users = await getUsers();
const products = await getProducts(); // waits unnecessarily
const orders = await getOrders(); // waits unnecessarily
Docker Push Gate — Local Test First
Disabled by default. When enabled, NO docker push is allowed until the image passes local verification:
- Build the image
- Run the container locally
- Verify it doesn't crash (still running after 5s)
- Health endpoint returns 200
- No fatal errors in logs
- Clean up, then push
Enable with docker_test_before_push = true in claude-mastery-project.conf. Applies to all commands that push Docker images.
When Something Seems Wrong
The CLAUDE.md also includes a “Check Before Assuming” pattern that prevents Claude from jumping to conclusions:
Fixed Service Ports
Port conflicts are one of the most common problems in multi-service development. The CLAUDE.md locks them down:
| Service | Dev Port | Test Port |
|---|---|---|
| Website | 3000 | 4000 |
| API | 3001 | 4010 |
| Dashboard | 3002 | 4020 |
Hooks — Stronger Than Rules
CLAUDE.md rules are suggestions. Hooks are stronger — they're guaranteed to run as shell/python scripts at specific lifecycle points. But hooks are not bulletproof: Claude may still work around their output. They're a significant upgrade over CLAUDE.md rules alone, but not an absolute guarantee that behavior will be followed.
block-secrets.py
Runs before Claude reads or edits any file. Blocks access to sensitive files like .env, credentials.json, SSH keys, and .npmrc.
# Files that should NEVER be read or edited by Claude
SENSITIVE_FILENAMES = {
'.env', '.env.local', '.env.production',
'secrets.json', 'id_rsa', 'id_ed25519',
'.npmrc', 'credentials.json',
'service-account.json',
}
# Exit code 2 = block operation and tell Claude why
if path.name in SENSITIVE_FILENAMES:
print(f"BLOCKED: Access to '{file_path}' denied.", file=sys.stderr)
sys.exit(2)
check-rybbit.sh
Runs before any deployment command (docker push, vercel deploy, dokploy). If the project has analytics = rybbit in claude-mastery-project.conf, verifies that NEXT_PUBLIC_RYBBIT_SITE_ID is set in .env with a real value. Blocks with a link to app.rybbit.io if missing. Skips projects that don't use Rybbit.
check-branch.sh
Runs before any git commit. If auto-branch is enabled (default: true) and you're on main/master, blocks the commit and tells Claude to create a feature branch first. Respects the auto_branch setting in claude-mastery-project.conf.
check-ports.sh
Runs before dev server commands. Detects the target port from -p, --port, PORT=, or known script names (dev:website→3000, dev:api→3001, etc.). If the port is already in use, blocks and shows the PID + kill command.
check-e2e.sh
Runs before git push to main/master. Checks for real .spec.ts or .test.ts files in tests/e2e/ (excluding the example template). Blocks push if no E2E tests exist.
lint-on-save.sh
Runs after Claude writes or edits a file. Automatically checks TypeScript compilation, ESLint, or Python linting depending on file extension. Kept fast (<5 seconds) so Claude doesn't skip it.
case "$EXTENSION" in
ts|tsx)
# TypeScript — run type check
npx tsc --noEmit --pretty "$FILE_PATH" 2>&1 | head -20
;;
js|jsx)
# JavaScript — run eslint
npx eslint "$FILE_PATH" 2>&1 | head -20
;;
py)
# Python — run ruff or flake8
ruff check "$FILE_PATH" 2>&1 | head -20
;;
esac
verify-no-secrets.sh
Runs when Claude finishes a turn. Scans all staged git files for accidentally committed secrets using regex patterns for API keys, AWS credentials, and credential URLs.
# Check staged file contents for common secret patterns
if grep -qEi '(api[_-]?key|secret[_-]?key|password|token)\s*[:=]\s*["\x27][A-Za-z0-9+/=_-]{16,}' "$file"; then
VIOLATIONS="${VIOLATIONS}\n - POSSIBLE SECRET in $file"
fi
# Check for AWS keys
if grep -qE 'AKIA[0-9A-Z]{16}' "$file"; then
VIOLATIONS="${VIOLATIONS}\n - AWS ACCESS KEY in $file"
fi
check-rulecatch.sh
Runs when Claude finishes a turn. Checks RuleCatch for any rule violations detected during the session. Skips silently if RuleCatch isn't installed — zero overhead for users who haven't set it up yet.
# Run RuleCatch violation check
RESULT=$(npx @rulecatch/ai-pooler@latest check --quiet --format summary 2>/dev/null)
if [ -n "$RESULT" ] && [ "$RESULT" != "0 violations" ]; then
echo "📋 RuleCatch: $RESULT" >&2
echo " Run 'pnpm ai:monitor' for details." >&2
fi
check-env-sync.sh
Runs when Claude finishes a turn. Compares key names (never values) between .env and .env.example. If .env has keys that .env.example doesn't document, prints a warning so other developers know those variables exist. Informational only — never blocks.
Hook Configuration
Hooks are wired up in .claude/settings.json. Each hook type fires at a different point in Claude's lifecycle:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Read|Edit|Write",
"hooks": [{ "type": "command", "command": "python3 .claude/hooks/block-secrets.py" }]
},
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "bash .claude/hooks/check-rybbit.sh" },
{ "type": "command", "command": "bash .claude/hooks/check-branch.sh" },
{ "type": "command", "command": "bash .claude/hooks/check-ports.sh" },
{ "type": "command", "command": "bash .claude/hooks/check-e2e.sh" }
]
}
],
"PostToolUse": [{
"matcher": "Write",
"hooks": [{ "type": "command", "command": "bash .claude/hooks/lint-on-save.sh" }]
}],
"Stop": [{
"hooks": [
{ "type": "command", "command": "bash .claude/hooks/verify-no-secrets.sh" },
{ "type": "command", "command": "bash .claude/hooks/check-rulecatch.sh" },
{ "type": "command", "command": "bash .claude/hooks/check-env-sync.sh" }
]
}]
}
}
Slash Commands — On-Demand Tools
Invoke these with /command in any Claude Code session. Each command is a markdown file in .claude/commands/ that gives Claude specific instructions and tool permissions.
pnpm ai:monitor in a separate terminal (free, no API key needed)
/help
Lists every command, skill, and agent in the starter kit, grouped by category: Getting Started, Project Scaffold, Code Quality, Development, Infrastructure, and Monitoring. Also shows skill triggers and agent descriptions. Run /help anytime to see what's available.
/quickstart
Interactive first-run walkthrough for new users. Checks if global config is installed, asks for a project name and profile preference (clean vs default), then walks you through the first 5 minutes: scaffolding, setup, first dev server, first review, first commit.
/diagram
Scans your actual code and generates ASCII diagrams automatically:
/diagram architecture— services, connections, data flow (scans src/, routes, adapters)/diagram api— all API endpoints grouped by resource with handler locations/diagram database— collections, indexes, relationships (scans queries + types)/diagram infrastructure— deployment topology, regions, containers (scans .env + Docker)/diagram all— generate everything at once
Writes to project-docs/ARCHITECTURE.md and project-docs/INFRASTRUCTURE.md. Uses ASCII box-drawing — works everywhere, no external tools needed. Add --update to write without asking.
/install-global
One-time setup: installs the starter kit's global Claude config into ~/.claude/.
- Smart merge — if you already have a global
CLAUDE.md, it appends missing sections without overwriting yours - settings.json — merges deny rules and hooks (never removes existing ones)
- Hooks — copies
block-secrets.py,verify-no-secrets.sh, andcheck-rulecatch.shto~/.claude/hooks/
Reports exactly what was added, skipped, and merged. Your existing config is never overwritten.
/setup
Interactive project configuration. Walks you through setting up your .env with real values:
- Multi-region — US + EU with isolated databases, VPS, and Dokploy per region
- Database — StrictDB per region (
STRICTDB_URI_US,STRICTDB_URI_EU) - Deployment — Dokploy on Hostinger VPS per region (IP, API key, app ID, webhook token)
- Docker — Hub username, image name, region tagging (
:latestfor US,:eufor EU) - GitHub — username, SSH vs HTTPS
- Analytics — Rybbit site ID
- RuleCatch — API key, region
- Auth — auto-generates JWT secret
Multi-region writes the region map to both .env and CLAUDE.md so Claude always knows: US containers → US database, EU containers → EU database. Never cross-connects.
Skips variables that already have values. Use /setup --reset to re-configure everything. Never displays secrets back to you. Keeps .env.example in sync.
/show-user-guide
Opens the comprehensive User Guide in your browser. Includes step-by-step tutorials, command deep dives, hook explanations, database cookbook, and troubleshooting. Tries the GitHub Pages URL first, falls back to the local file.
/what-is-my-ai-doing
Free monitor mode — no API key, no account, no setup. Just open a separate terminal and run it.
Launches the RuleCatch AI-Pooler live monitor in a separate terminal. See everything your AI is doing in real time:
- Every tool call (Read, Write, Edit, Bash)
- Token usage and cost per turn
- Which files are being accessed
- Cost per session
# Open a separate terminal and run this while Claude works
npx @rulecatch/ai-pooler monitor --no-api-key
Zero token overhead — runs completely outside Claude's context. Also available as pnpm ai:monitor.
Want more? With a RuleCatch.AI API key you also get violation tracking, dashboards, and the MCP server. See Monitor Your Rules.
/review
Systematic code review against a 7-point checklist:
- Security — OWASP Top 10, no secrets in code
- Types — No
any, proper null handling - Error Handling — No swallowed errors
- Performance — No N+1 queries, no memory leaks
- Testing — New code has explicit assertions
- Database — Using StrictDB
- API Versioning — All endpoints use
/api/v1/
Issues are reported with severity (Critical / Warning / Info), file:line references, and suggested fixes.
/commit
Smart commit with conventional commit format. Reviews staged changes, generates appropriate commit messages using the type(scope): description convention (feat, fix, docs, refactor, test, chore, perf). Warns if changes span multiple concerns and suggests splitting.
/test-plan
Generates a structured test plan for any feature with:
- Prerequisites and environment setup
- Happy path scenarios with specific expected outcomes
- Error cases and edge cases (empty, null, max values, concurrency)
- Pass/fail criteria table
- Sign-off tracker
/security-check
Scans the project for security vulnerabilities:
- Secrets in code (API keys, AWS keys, credential URLs)
.gitignorecoverage verification- Sensitive files tracked by git
.envhandling audit- Dependency vulnerability scan (
npm audit)
/progress
Checks the actual filesystem state and reports project status — source file counts by type, test coverage, recent git activity, and prioritized next actions.
/architecture
Reads project-docs/ARCHITECTURE.md and displays the system overview, data flow diagrams, and service responsibility maps. If docs don't exist, scaffolds them.
/worktree
Creates an isolated git worktree + branch for a task:
/worktree add-auth # → task/add-auth branch
/worktree feat/new-dashboard # → uses prefix as-is
Each task gets its own branch and its own directory. Main stays untouched. If Claude screws something up, delete the branch — zero risk. Enables running multiple Claude sessions in parallel without conflicts.
When done: merge into main (or open a PR), then git worktree remove.
/optimize-docker
Audits your Dockerfile against 12 production best practices:
- Multi-stage builds — mandatory, no exceptions
- Layer caching — COPY package.json before source
- Alpine base images — 7x smaller than full images
- Non-root user — drop privileges
- .dockerignore — must exclude .env, .git, node_modules
- Frozen lockfile — deterministic installs
- Health checks — Docker knows if app is alive
- No secrets in build args — runtime env only
- Pin versions — no
:latesttags
Generates an optimized Dockerfile, verifies .dockerignore, and reports image size estimate with before/after comparison. When docker_test_before_push = true in conf, blocks docker push until the image passes local verification (build, run, health check, no crash).
/create-e2e
Generates a properly structured Playwright E2E test for a feature. Reads the source code, identifies URLs/elements/data to verify, creates the test at tests/e2e/[name].spec.ts with happy path, error cases, and edge cases. Verifies the test meets the “done” checklist (URL assertion, visibility assertion, data assertion, error case, no TODOs) before finishing.
/create-api
Scaffolds a production-ready API endpoint with full CRUD:
- Types —
src/types/<resource>.ts(document, request, response shapes) - Handler —
src/handlers/<resource>.ts(business logic, indexes, CRUD) - Route —
src/routes/v1/<resource>.ts(thin routes, proper HTTP status codes) - Tests —
tests/unit/<resource>.test.ts(happy path, error cases, edge cases)
Uses StrictDB with shared pool, auto-sanitized inputs, pagination (max 100), registered indexes, and /api/v1/ prefix. Pass --no-db to skip database integration.
/refactor
Audit + refactor any file against every rule in CLAUDE.md:
- Branch check — verifies you're not on main (suggests
/worktree) - File size — >300 lines = must split
- Function size — >50 lines = must extract
- TypeScript — no
any, explicit types, strict mode - Import hygiene — no barrel imports, proper
import type - Error handling — no swallowed errors, proper logging
- Database access — StrictDB only (
import from 'strictdb') - API routes —
/api/v1/prefix - Promise.all — parallelize independent awaits
- Security + dead code — no secrets, no unused code
Presents a named-step plan before making any changes. Splits files by type (types → src/types/, validation → colocated, helpers → colocated). Updates all imports across the project. Runs RuleCatch after completion.
/refactor src/handlers/users.ts
/refactor src/server.ts --dry-run # report only, no changes
/new-project
Full project scaffolding with profiles or shorthand params:
/new-project my-app clean
/new-project my-app default
/new-project my-app fullstack next dokploy seo tailwind pnpm
/new-project my-api api fastify dokploy docker multiregion
/new-project my-site static-site
/new-project my-api go # Go API with Gin, StrictDB, Docker
/new-project my-api go chi postgres # Go with Chi, PostgreSQL
/new-project my-cli go cli # Go CLI with Cobra
/new-project my-app vue # Vue 3 SPA with Tailwind
/new-project my-app nuxt # Nuxt full-stack with StrictDB, Docker
/new-project my-app sveltekit # SvelteKit full-stack
/new-project my-api python-api # FastAPI with PostgreSQL, Docker
/new-project my-app django # Django full-stack
clean — All Claude infrastructure (commands, skills, agents, hooks, project-docs, tests templates) with zero coding opinions. No TypeScript enforcement, no port assignments, no StrictDB rules, no quality gates. Your project, your rules — Claude just works.
go — Go project scaffolding with standard layout (cmd/, internal/), Gin router, Makefile builds, golangci-lint, table-driven tests, multi-stage Docker with scratch base (5-15MB images). Supports Gin, Chi, Echo, Fiber, or stdlib net/http.
default and other profiles — Full opinionated scaffolding with project type, framework, SSR, hosting (Dokploy/Vercel/static), package manager, database (via StrictDB), extras (Tailwind, Prisma, Docker, CI), and MCP servers. Includes mandatory SEO for web projects and Dokploy deployment scripts with multi-region support.
vue / nuxt / svelte / sveltekit / angular — Frontend framework scaffolding with CLI scaffold + starter kit overlay. Each gets framework-specific CLAUDE.md rules (Composition API for Vue, Runes for Svelte, Standalone Components for Angular).
python-api / django / flask — Python project scaffolding with FastAPI/Django/Flask, pytest, ruff linter, virtual environment, and multi-stage Docker. Full type hints enforced.
Use claude-mastery-project.conf profiles to save your preferred stack.
/set-project-profile-default
Sets the default profile for /new-project. Accepts any profile name: clean, default, go, vue, python-api, etc. Also supports shorthand: /set-project-profile-default mongo next tailwind docker creates a [user-default] profile with those settings.
/add-project-setup
Interactive wizard to create a named profile in claude-mastery-project.conf. Asks about language, framework, database (via StrictDB), hosting, and more. Use with /new-project my-app <profile-name>.
/projects-created
Lists every project scaffolded by /new-project, with creation date, profile, language, framework, database (StrictDB), and location. Checks which projects still exist on disk and marks missing ones. Data stored in ~/.claude/starter-kit-projects.json.
/remove-project
Removes a project from the starter kit registry and optionally deletes its files from disk. Shows project details, asks for confirmation, checks for uncommitted git changes before deletion. Use /remove-project my-app or run without arguments to pick from a list.
/convert-project-to-starter-kit
Merges all starter kit infrastructure into an existing project without destroying anything. Creates a safety commit, detects language and existing Claude setup, asks how to handle conflicts, then copies commands, hooks, skills, agents, merges CLAUDE.md sections, deep-merges settings.json, and adds infrastructure files. Registers the project in ~/.claude/starter-kit-projects.json. Undo with git revert HEAD.
/convert-project-to-starter-kit ~/projects/my-app
/convert-project-to-starter-kit ~/projects/my-app --force
/update-project
Updates an existing starter-kit project with the latest commands, hooks, skills, agents, and rules. Smart merge — replaces starter kit files with newer versions while preserving any custom files. Shows a diff report before applying, creates a safety commit for easy undo.
/update-project # Pick from registered projects
/update-project --force # Skip confirmation prompts
/add-feature <name>
Add capabilities (StrictDB, Docker, testing, etc.) to an existing project after scaffolding. Idempotent — safely updates already-installed features. Maintains a feature manifest (.claude/features.json) so /update-project can sync feature files too.
/add-feature strictdb # Add StrictDB + query system
/add-feature vitest playwright # Add both test frameworks
/add-feature --list # Show all available features
Supported Technologies
This starter kit works with any language, framework, or database. Use /new-project my-app clean for zero opinions, or pick a profile that matches your stack.
Languages & Frameworks
| Category | Technologies | Notes |
|---|---|---|
| Languages | Node.js/TypeScript, Go, Python | Full scaffolding support |
| Frontend | React, Vue 3, Svelte, SvelteKit, Angular, Next.js, Nuxt, Astro | CLI scaffold + CLAUDE.md rules |
| Backend (Node.js) | Fastify, Express, Hono | API scaffolding with /create-api |
| Backend (Go) | Gin, Chi, Echo, Fiber, stdlib | Standard layout cmd/internal/ |
| Backend (Python) | FastAPI, Django, Flask | Async, Pydantic, pytest |
| Database | MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, Elasticsearch | StrictDB + StrictDB-MCP |
| Hosting | Dokploy, Vercel, Static | Deploy scripts + Docker |
| Testing | Vitest, Playwright, pytest, Go test | Framework-appropriate setup |
| CSS | Tailwind CSS + ClassMCP + Classpresso | ClassMCP (MCP) + Classpresso (post-build) auto-included in CSS profiles |
Recommended Stacks
| Use Case | Stack | Profile |
|---|---|---|
| SPA Dashboard | Vite + React + Fastify + StrictDB | default |
| REST API (Node.js) | Fastify + PostgreSQL | api + postgres |
| Go Microservice | Gin + PostgreSQL | go + postgres |
| Python API | FastAPI + PostgreSQL | python-api |
| Vue SPA | Vue 3 + Vite + Tailwind | vue |
| Nuxt Full-Stack | Nuxt + StrictDB + Docker | nuxt |
| SvelteKit Full-Stack | SvelteKit + StrictDB + Docker | sveltekit |
| Angular App | Angular + Tailwind | angular |
| Django Web App | Django + PostgreSQL + Docker | django |
| Content Site | Astro or SvelteKit | static-site |
| AI goodies only | Any — you choose | clean |
Skills — Triggered Expertise
Skills are context-aware templates that activate automatically when Claude detects relevant keywords in your conversation. Unlike slash commands (which you invoke explicitly with /command), skills load themselves when needed.
What Triggers Skills?
Claude monitors your conversation for specific keywords. When it detects a match, it loads the relevant skill template — giving Claude structured instructions for that specific task. You don't need to do anything special.
| Skill | Trigger Keywords | What It Does |
|---|---|---|
| Code Review | review, audit, check code, security review | Loads a systematic 7-point review checklist with severity ratings |
| Create Service | create service, new service, scaffold service | Scaffolds a microservice with server/handlers/adapters pattern |
How to Activate Skills
You don't — just use natural language. Say things like:
- “Review this file for security issues” → Code Review skill activates
- “Audit the authentication module” → Code Review skill activates
- “Create a new payment service” → Create Service skill activates
- “Scaffold a notification service” → Create Service skill activates
Skills vs Commands
| Skills | Commands | |
|---|---|---|
| How to use | Automatic — just use natural language | Explicit — type /command |
| When they load | When Claude detects trigger keywords | When you invoke them |
| Example | “Review this code” | /review |
| Best for | Organic, conversational workflows | Deliberate, specific actions |
Both skills and commands can cover similar ground (e.g., code review). Skills are more natural; commands are more predictable. Use whichever fits your workflow.
Code Review Skill
Triggers: review, audit, check code, security review
A systematic review checklist that covers security (OWASP, input validation, CORS, rate limiting), TypeScript quality (no any, explicit return types, strict mode), error handling (no swallowed errors, user-facing messages), performance (N+1 queries, memory leaks, pagination), and architecture compliance (StrictDB, API versioning, service separation).
Each issue is reported with severity, location, fix, and why it matters.
Create Service Skill
Triggers: create service, new service, scaffold service
Generates a complete microservice following the server/handlers/adapters separation pattern:
┌─────────────────────────────────────────────────────┐
│ YOUR SERVICE │
├─────────────────────────────────────────────────────┤
│ SERVER (server.ts) │
│ → Express/Fastify entry point, defines routes │
│ → NEVER contains business logic │
│ │ │
│ ▼ │
│ HANDLERS (handlers/) │
│ → Business logic lives here │
│ → One file per domain │
│ │ │
│ ▼ │
│ ADAPTERS (adapters/) │
│ → External service adapters │
│ → Third-party APIs, etc. │
└─────────────────────────────────────────────────────┘
Includes package.json, tsconfig.json, entry point with error handlers, health check endpoint, and a post-creation verification checklist.
Custom Agents — Specialist Subagents
Agents are specialists that Claude delegates to automatically. They run with restricted tool access so they can't accidentally modify your code when they shouldn't.
Code Reviewer Agent
Tools: Read, Grep, Glob (read-only)“You are a senior code reviewer. Your job is to find real problems — not nitpick style.”
Priority order:
- Security — secrets in code, injection vulnerabilities, auth bypasses
- Correctness — logic errors, race conditions, null pointer risks
- Performance — N+1 queries, memory leaks, missing indexes
- Type Safety —
anyusage, missing null checks, unsafe casts - Maintainability — dead code, unclear naming (lowest priority)
If the code is good, it says so — it doesn't invent issues to justify its existence.
Test Writer Agent
Tools: Read, Write, Grep, Glob, Bash“You are a testing specialist. You write tests that CATCH BUGS, not tests that just pass.”
Principles:
- Every test MUST have explicit assertions — “page loads” is NOT a test
- Test behavior, not implementation details
- Cover happy path, error cases, AND edge cases
- Use realistic test data, not
"test"/"asdf" - Tests should be independent — no shared mutable state
// GOOD — explicit, specific assertions
expect(result.status).toBe(200);
expect(result.body.user.email).toBe('test@example.com');
// BAD — passes even when broken
expect(result).toBeTruthy(); // too vague
StrictDB — Unified Database Driver
The starter kit uses StrictDB — a production-grade unified database driver (npm package) supporting MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, and Elasticsearch. It enforces every best practice that prevents the most common database failures in AI-assisted development.
The Absolute Rule
ALL database access goes through StrictDB. No exceptions. Never create direct database clients. Never import raw database drivers in business logic.
// CORRECT — import from StrictDB
import { queryOne, insertOne, updateOne } from 'strictdb';
// WRONG — NEVER do this
import { MongoClient } from 'mongodb'; // FORBIDDEN — use StrictDB
import { Pool } from 'pg'; // FORBIDDEN — use StrictDB
Reading Data — Aggregation Only
// Single document (automatic $limit: 1)
const user = await queryOne<User>('users', { email });
// Pipeline query
const recent = await queryMany<Order>('orders', [
{ $match: { userId, status: 'active' } },
{ $sort: { createdAt: -1 } },
{ $limit: 20 },
]);
// Join — $limit enforced BEFORE $lookup automatically
const userWithOrders = await queryWithLookup<UserWithOrders>('users', {
match: { _id: userId },
lookup: { from: 'orders', localField: '_id', foreignField: 'userId', as: 'orders' },
});
Writing Data — BulkWrite Only
// Insert
await insertOne('users', { email, name, createdAt: new Date() });
await insertMany('events', batchOfEvents);
// Update — use $inc for counters (NEVER read-modify-write)
await updateOne<Stats>('stats',
{ date },
{ $inc: { pageViews: 1 } },
true // upsert
);
// Complex batch (auto-retries E11000 concurrent races)
await bulkOps('sessions', [
{ updateOne: { filter: { sessionId }, update: { $inc: { events: 1 } }, upsert: true } },
]);
Connection Pool Presets
| Preset | Max Pool | Min Pool | Use Case |
|---|---|---|---|
high | 20 | 2 | APIs, high-traffic services |
standard | 10 | 2 | Default for most services |
low | 5 | 1 | Background workers, cron jobs |
Built-in Sanitization and Guardrails
All query inputs are automatically sanitized. The sanitizer uses an allowlist of known-safe query operators — standard operators pass through while dangerous ones are stripped.
| Category | Operators | What happens |
|---|---|---|
| Safe (allowed) | $gte, $lt, $in, $nin, $ne, $eq, $regex, $exists, $and, $or, $not, $nor, $elemMatch, $all, $size, $type, $expr, $text, geo, bitwise |
Key allowed through, value recursively sanitized |
| Dangerous (stripped) | $where, $function, $accumulator |
Stripped automatically — these execute arbitrary JavaScript |
| Unknown (stripped) | Any unrecognized $ key |
Stripped as defense in depth |
This means standard queries just work without any special options:
// All of these work by default — no special options needed:
const entries = await queryMany('logs', [
{ $match: { timestamp: { $gte: new Date(since) } } },
]);
const total = await count('waf_events', { event_at: { $gte: sinceDate } });
const latest = await queryOne('events', {
level: { $in: ['error', 'fatal'] },
timestamp: { $gte: cutoff },
});
// Dangerous operators are automatically stripped:
// { $where: 'this.isAdmin' } → stripped (JS execution)
// { $function: { body: '...' } } → stripped (JS execution)
Disable sanitization entirely with sanitize: false in StrictDB.create() config or sanitize = false in claude-mastery-project.conf.
{ trusted: true } — Escape Hatch
If you need an operator not in the allowlist, queryOne(), queryMany(), and count() accept { trusted: true } to skip sanitization entirely. This should be rare — if you use it frequently, add the operator to the SAFE_OPERATORS configuration in StrictDB instead.
// Only needed for operators NOT in the allowlist:
const results = await queryMany('collection', pipeline, { trusted: true });
const total = await count('collection', match, { trusted: true });
const one = await queryOne('collection', match, { trusted: true });
When to use { trusted: true }
- Non-standard operators not in the allowlist
- You validated/sanitized input yourself at a higher layer
When NOT to use it
- Standard operators (
$gte,$in,$regex, etc.) — these work by default - Raw user input flows directly into
$matchwithout validation
Additional Features
- Singleton per URI — same
STRICTDB_URIalways returns the same client, prevents pool exhaustion - Next.js hot-reload safe — persists connections via
globalThisduring development - Transaction support —
withTransaction()for multi-document atomic operations - Change Stream access —
rawCollection()for real-time event processing - Graceful shutdown —
gracefulShutdown()closes all pools onSIGTERM,SIGINT,uncaughtException, andunhandledRejection— no zombie connections on crash - E11000 auto-retry — handles concurrent upsert race conditions automatically
- $limit before $lookup —
queryWithLookup()enforces this for join performance - Index management —
registerIndex()+ensureIndexes()at startup
Test Query Master — scripts/db-query.ts
One of the biggest problems with AI-assisted database development: Claude scatters random query scripts all over your project. The Test Query Master solves this completely.
The Problem
Without guardrails, Claude creates ad-hoc database scripts everywhere — scripts/check-users.ts, src/utils/debug-query.ts, temp-lookup.js — making it impossible to tell test code from production code.
The Solution
Every dev/test query gets its own file in scripts/queries/ and is registered in the master index. Production code in src/ stays clean. One command shows everything: npx tsx scripts/db-query.ts --list
import { queryMany } from 'strictdb';
export default {
name: 'find-expired-sessions',
description: 'Find sessions that expired in the last 24 hours',
async run(args: string[]): Promise<void> {
const cutoff = new Date(Date.now() - 24 * 60 * 60 * 1000);
const sessions = await queryMany('sessions', [
{ $match: { expiresAt: { $lt: cutoff } } },
{ $sort: { expiresAt: -1 } },
{ $limit: 50 },
]);
console.log(`Found ${sessions.length} expired sessions`);
},
};
Then register in scripts/db-query.ts and run: npx tsx scripts/db-query.ts find-expired-sessions
Every query uses StrictDB — same connection pool, same patterns, same rules. When you're done exploring, just delete the file and its registry entry.
Content Builder — scripts/build-content.ts
A config-driven Markdown-to-HTML article builder. Write content in content/ as Markdown, register it in scripts/content.config.json, and build fully SEO-ready static HTML pages with one command.
{
"articles": [
{
"id": "getting-started",
"published": true,
"mdSource": "content/getting-started.md",
"htmlOutput": "public/articles/getting-started/index.html",
"title": "Getting Started Guide",
"description": "Everything you need to know.",
"url": "https://example.com/articles/getting-started/",
"datePublished": "2026-01-15",
"category": "Guides",
"keywords": ["setup", "installation"]
}
]
}
Each generated page includes: Open Graph, Twitter Cards, Schema.org JSON-LD, syntax highlighting, optional sidebar TOC, and parent/child article relationships.
pnpm content:build # Build all published articles
pnpm content:build:id my-post # Build a single article
pnpm content:list # List all articles and status
pnpm content:dry-run # Preview what would build
All Scripts — package.json
Everything is tied together through package.json scripts. No random npx commands to remember.
| Command | What it does |
|---|---|
| Development | |
pnpm dev | Dev server with hot reload |
pnpm dev:website | Dev server on port 3000 |
pnpm dev:api | Dev server on port 3001 |
pnpm dev:dashboard | Dev server on port 3002 |
pnpm build | Type-check + compile TypeScript |
pnpm start | Run production build |
pnpm typecheck | TypeScript check only (no emit) |
pnpm lint | Same as typecheck |
| Testing | |
pnpm test | Run ALL tests (unit + E2E) |
pnpm test:unit | Unit/integration tests (Vitest) |
pnpm test:unit:watch | Unit tests in watch mode |
pnpm test:coverage | Unit tests with coverage report |
pnpm test:e2e | E2E tests (kills ports → spawns servers → Playwright) |
pnpm test:e2e:headed | E2E with visible browser |
pnpm test:e2e:ui | E2E with Playwright UI mode |
pnpm test:e2e:chromium | E2E on Chromium only (fast) |
pnpm test:e2e:report | Open last Playwright HTML report |
pnpm test:kill-ports | Kill processes on test ports (4000, 4010, 4020) |
| Test Servers | |
pnpm dev:test:website | Test server on port 4000 |
pnpm dev:test:api | Test server on port 4010 |
pnpm dev:test:dashboard | Test server on port 4020 |
| Database | |
pnpm db:query <name> | Run a dev/test database query |
pnpm db:query:list | List all registered queries |
| Content | |
pnpm content:build | Build all published MD → HTML |
pnpm content:build:id <id> | Build a single article by ID |
pnpm content:list | List all articles |
pnpm content:dry-run | Preview what would build |
| Monitoring & Docker | |
pnpm ai:monitor | Free monitor mode — live AI activity (run in separate terminal, no API key needed) |
pnpm docker:optimize | Audit Dockerfile (use /optimize-docker in Claude) |
| Utility | |
pnpm clean | Remove dist/, coverage/, test-results/ |
Documentation Templates
Pre-structured docs that Claude actually follows. Each template uses the “STOP” pattern — explicit boundaries that prevent Claude from making unauthorized changes.
ARCHITECTURE.md
project-docs/ARCHITECTURE.md
Starts with “This document is AUTHORITATIVE. No exceptions.” Includes:
- ASCII architecture diagram with data flow
- Service responsibility table (Does / Does NOT)
- Technology choices with rationale
- “If You Are About To… STOP” section that blocks scope creep
## If You Are About To...
- Add an endpoint to the wrong service → STOP. Check the table above.
- Create a direct database connection → STOP. Use StrictDB.
- Skip TypeScript for a quick fix → STOP. TypeScript is non-negotiable.
- Deploy without tests → STOP. Write tests first.
DECISIONS.md
project-docs/DECISIONS.md
Architectural Decision Records (ADRs) that document why you chose X over Y. Includes a template and two starter decisions:
- ADR-001: TypeScript Over JavaScript — AI needs explicit type contracts to avoid guessing
- ADR-002: StrictDB as Unified Database Driver — prevents connection pool exhaustion
Each ADR has: Context, Decision, Alternatives Considered (with pros/cons table), and Consequences.
INFRASTRUCTURE.md
project-docs/INFRASTRUCTURE.md
Deployment and environment details:
- Environment overview diagram (production vs local)
- Environment variables table (required, where, purpose)
- Deployment prerequisites and steps
- Rollback procedures
- Monitoring setup
Testing Methodology
From the V5 testing methodology — a structured approach to testing that prevents the most common AI-assisted testing failures.
CHECKLIST.md
tests/CHECKLIST.md
A master test status tracker that gives you a single-glance view of what's tested and what's not. Uses visual status indicators (✅ passed, ❌ failed, ⬜ not tested) for every feature area.
ISSUES_FOUND.md
tests/ISSUES_FOUND.md
A user-guided testing log where you document issues discovered during testing. Each entry includes: what was tested, what was expected, what actually happened, severity, and current status. Queue observations, fix in batch — not one at a time.
Test Structure Pattern
Every test in this project follows the Arrange → Act → Assert pattern:
describe('[Feature]', () => {
describe('[Scenario]', () => {
it('should [expected behavior] when [condition]', async () => {
// Arrange — set up test data
// Act — perform the action
// Assert — verify SPECIFIC outcomes
});
});
});
E2E Test Requirements
Every E2E test (Playwright) must verify four things:
- Correct URL after navigation
- Key visible elements are present
- Correct data is displayed
- Error states show proper messages
E2E Infrastructure — playwright.config.ts
The Playwright config is pre-wired with test ports, automatic server spawning, and port cleanup. You never have to manually start servers for E2E tests.
How It Works
pnpm test:e2e— kills anything on test ports (4000, 4010, 4020)- Playwright spawns servers via
webServerconfig on test ports - Tests run against the test servers
- Servers shut down automatically when tests complete
When Is a Test Done?
- ✓ At least one
toHaveURL()assertion - ✓ At least one
toBeVisible()assertion - ✓ At least one
toContainText()data assertion - ✓ Error case covered
- ✓ No
// TODOplaceholders
pnpm test # ALL tests (unit + E2E)
pnpm test:unit # Unit/integration only (Vitest)
pnpm test:e2e # E2E only (kills ports → spawns servers → Playwright)
pnpm test:e2e:headed # E2E with visible browser
pnpm test:e2e:ui # E2E with Playwright UI mode
pnpm test:e2e:report # Open last HTML report
/create-e2e Slash Command
Use /create-e2e <feature-name> to generate a properly structured E2E test. Claude will:
- Read the source code for the feature being tested
- Identify all URLs, elements, and data to verify
- Ask what specific success criteria you expect (if not obvious)
- Create the test at
tests/e2e/[name].spec.tswith happy path, error cases, and edge cases - Verify the test meets the “done” checklist before finishing
Windows Users — VS Code in WSL Mode
If you're developing on Windows, this is the single biggest performance improvement you can make — and most people don't even know it exists.
VS Code can run its entire backend inside WSL 2 while the UI stays on Windows. Your terminal, extensions, git, Node.js, and Claude Code all run natively in Linux. Everything just works — but 5-10x faster.
Without WSL Mode
- HMR takes 2-5 seconds per change
- Playwright tests are slow and flaky
- File watching misses changes or double-fires
- Node.js filesystem ops hit NTFS translation layer
git statustakes seconds on large repos
With WSL Mode
- HMR is near-instant (<200ms)
- Playwright tests run at native Linux speed
- File watching is reliable and fast
- Native ext4 filesystem — no translation
git statusis instant
Setup (One Time)
# 1. Install WSL 2 (PowerShell as admin)
wsl --install
# 2. Restart your computer
# 3. Install VS Code extension
# Search for "WSL" by Microsoft (ms-vscode-remote.remote-wsl)
# 4. Connect VS Code to WSL
# Click green "><" icon in bottom-left → "Connect to WSL"
# 5. Clone projects INSIDE WSL (not /mnt/c/)
mkdir -p ~/projects
cd ~/projects
git clone git@github.com:YourUser/your-project.git
code your-project # opens in WSL mode automatically
The Critical Mistake
Your project MUST live on the WSL filesystem (~/projects/), NOT on /mnt/c/. Having WSL but keeping your project on the Windows filesystem gives you the worst of both worlds — every file operation still crosses the slow Windows/Linux boundary.
# Check your setup:
pwd
# GOOD — native Linux filesystem
/home/you/projects/my-app
# BAD — still hitting Windows filesystem through WSL
/mnt/c/Users/you/projects/my-app
Run /setup in Claude Code to auto-detect your environment and get specific instructions if something is misconfigured.
Global CLAUDE.md — Security Gatekeeper
The global CLAUDE.md lives at ~/.claude/CLAUDE.md and applies to every project you work on. It's your organization-wide security gatekeeper.
The starter kit includes a complete global config template in global-claude-md/ with:
Absolute Rules
NEVER publish sensitive data. NEVER commit .env files. NEVER auto-deploy. NEVER hardcode credentials. NEVER rename without a plan. These rules apply to every project, every session.
New Project Standards
Every new project automatically gets: .env + .env.example, proper .gitignore, .dockerignore, TypeScript strict mode, src/tests/project-docs/.claude/ directory structure.
Coding Standards
Error handling requirements, testing standards, quality gates, StrictDB pattern — all enforced across every project.
Global Permission Denials
The companion settings.json explicitly denies Claude access to .env, .env.local, secrets.json, id_rsa, and credentials.json at the permission level — before hooks even run.
Coding Standards
Patterns and practices enforced across the project through CLAUDE.md rules, hooks, and code review.
Imports
// CORRECT — explicit, typed
import { getUserById } from './handlers/users.js';
import type { User } from './types/index.js';
// WRONG — barrel imports that pull everything
import * as everything from './index.js';
Error Handling
// CORRECT — handle errors explicitly
try {
const user = await getUserById(id);
if (!user) throw new NotFoundError('User not found');
return user;
} catch (err) {
logger.error('Failed to get user', { id, error: err });
throw err;
}
// WRONG — swallow errors silently
try {
return await getUserById(id);
} catch {
return null; // silent failure
}
Naming Safety
Renaming packages, modules, or key variables mid-project causes cascading failures. If you must rename:
- Create a checklist of ALL files and references first
- Use IDE semantic rename (not search-and-replace)
- Full project search for old name after renaming
- Check:
.md,.txt,.env, comments, strings, paths - Start a FRESH Claude session after renaming
Plan Mode — Named Steps + Replace, Don't Append
Every plan step MUST have a unique, descriptive name so you can reference it unambiguously:
Step 1 (Project Setup): Initialize repo with TypeScript
Step 2 (Database Layer): Configure StrictDB
Step 3 (Auth System): Implement JWT authentication
When modifying a plan, Claude tends to append instead of replacing — creating contradictions. The rules:
- REPLACE the named step entirely: “Change Step 3 (Auth System) to use session cookies”
- NEVER just append: “Also, use session cookies” ← Step 3 still says JWT
- After any change, Claude must rewrite the full updated plan
- If the plan contradicts itself, tell Claude: “Rewrite the full plan — Step 3 and Step 7 contradict”
- If fundamentally changing direction:
/clear→ state requirements fresh
Monitor Your Rules
Full disclosure: RuleCatch.AI is built by TheDecipherist — the same developer behind this starter kit. It's purpose-built for catching the exact issues AI-assisted development introduces.
Try It Now — Free Monitor Mode
See what your AI is doing in real-time. No API key, no account, no setup — just open a separate terminal and run:
# Open a separate terminal and run this while Claude works
npx @rulecatch/ai-pooler monitor --no-api-key
Also available as pnpm ai:monitor. You'll instantly see every tool call, token count, cost per turn, and which files Claude is touching — all updating live. Zero token overhead. This is the free preview that lets you see what you've been missing.
Unlock the Full Experience
Why you'd want it: AI models break your CLAUDE.md rules more often than you'd expect — wrong language, skipped patterns, hardcoded values, ignored constraints. Code that looks right and passes linting, but violates your project's actual standards. RuleCatch.AI bridges the gap between detecting these violations and fixing them.
AI-Pooler (Free Monitor Mode)
Free monitor mode works instantly — no API key needed. See every tool call, token, cost, and file access in a live terminal view. With an API key: adds persistent violation tracking, session history, and cost analytics
Dashboard
Violations across 18 rule categories, session analytics (tokens, cost, lines/hour), trend reports, per-file attribution. Alerts via Slack, Discord, PagerDuty, and more
MCP Server
Gives Claude direct read access to violation data. Ask: "Show all security violations this week" or "Create a plan to fix today's violations" — Claude reviews, analyzes, and generates file-by-file fix plans without leaving your session
200+ Rules & Privacy-First
Security, TypeScript, React, Next.js, MongoDB, Docker — violations in under 100ms. AES-256-GCM client-side encryption. You hold the key. US and EU data isolation, fully GDPR compliant
The RuleCatch dashboard — violation trends, category breakdown, per-file attribution, and top triggered rules at a glance. Configure alerts via Slack, Discord, PagerDuty, and more.
Full Setup (with API Key)
# Install the AI-Pooler with your API key (hooks into Claude Code automatically)
npx @rulecatch/ai-pooler init --api-key=dc_your_key --region=us
# Add the MCP server to query violations from Claude
npx @rulecatch/mcp-server init
The AI-Pooler free monitor in action — tokens, cost, and tool usage updating in real time. Try it now: open a separate terminal and run npx @rulecatch/ai-pooler monitor --no-api-key
Recommended MCP Servers
MCP (Model Context Protocol) servers extend Claude's capabilities by giving it tools beyond reading and writing files. Each server below solves a specific problem in AI-assisted development. All are optional — install the ones that fit your workflow.
Context7 — Live Documentation
Claude's training data has a knowledge cutoff. When it generates code for a library, it might use APIs that have been renamed, deprecated, or don't exist in your version. Context7 fetches up-to-date, version-specific documentation and code examples directly from official sources and injects them into Claude's context.
What it solves: Hallucinated APIs, outdated code patterns, version mismatches
How to use: Add use context7 to your prompt — Context7 automatically identifies the relevant library and fetches current docs
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
npm: @upstash/context7-mcp · GitHub
GitHub MCP — Repository Management
Gives Claude direct access to the GitHub API — create and review PRs, manage issues, trigger CI/CD workflows, search code across repos, and handle branch operations. Instead of switching between Claude and the GitHub UI, Claude can do it all in-session.
What it solves: Context-switching between Claude and GitHub for PR reviews, issue management, and CI/CD
Toolsets: Repository management, issues, pull requests, actions, code security, discussions, notifications
claude mcp add github -- npx -y @modelcontextprotocol/server-github
Note: GitHub has also released an official GitHub MCP Server with expanded toolsets.
npm: @modelcontextprotocol/server-github · GitHub (official)
Playwright MCP — Browser Automation
Gives Claude the ability to interact with web pages through structured accessibility snapshots — no vision models or screenshots needed. Claude can navigate pages, click elements, fill forms, and verify content using the page's accessibility tree.
What it solves: E2E test debugging, verifying UI behavior, interacting with web apps during development
How it works: Uses Playwright's accessibility tree (not screenshots) — fast, lightweight, and LLM-friendly. Supports Chrome, Firefox, WebKit, and 143+ device emulation profiles
claude mcp add playwright -- npx -y @playwright/mcp@latest
npm: @playwright/mcp · GitHub
ClassMCP — Semantic CSS for AI
By TheDecipherist — open source (MIT license)
MCP server that provides semantic CSS class patterns to Claude, reducing token usage when working with styles. Instead of Claude guessing class names or hallucinating utility classes, ClassMCP feeds it the correct patterns from your project's CSS framework. Auto-included in all CSS-enabled profiles.
What it solves: Hallucinated CSS class names, inconsistent styling patterns, wasted tokens on style guessing
claude mcp add classmcp -- npx -y classmcp@latest
StrictDB-MCP — Database Context for AI
By TheDecipherist — open source (MIT license)
MCP server that gives Claude direct access to StrictDB schema discovery, query validation, and explain plans. Claude can inspect collection schemas, dry-run queries before execution, and understand your database structure without you pasting it into context. Auto-included in all database-enabled profiles.
What it solves: Hallucinated collection names, wrong field types, queries that fail on execution, missing context about database schema
claude mcp add strictdb-mcp -- npx -y strictdb-mcp@latest
npm: strictdb-mcp
RuleCatch MCP — AI Session Analytics
Already covered in detail in the Monitor Your Rules section above. Gives Claude direct read access to violation data so it can query what rules it's breaking and generate fix plans.
npx @rulecatch/mcp-server init
See the Claude Code Mastery Guide for the complete MCP server directory.
Screenshots
The starter kit in action — every screenshot is from real command output.
Credits
Based on the Claude Code Mastery Guide series by TheDecipherist:
- V1: Global CLAUDE.md, Security Gatekeeper, Project Scaffolding, Context7
- V2: Skills & Hooks, Enforcement over Suggestion, Quality Gates
- V3: LSP, CLAUDE.md, MCP, Skills & Hooks
- V4: 85% Context Reduction, Custom Agents & Session Teleportation
- V5: Renaming Problem, Plan Mode, Testing Methodology & Rules That Stick
Community contributors: u/BlueVajra, u/stratofax, u/antoniocs, u/GeckoLogic, u/headset38, u/tulensrma, u/jcheroske, u/ptinsley, u/Keksy, u/lev606