@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
package/README.md
ADDED
|
@@ -0,0 +1,2152 @@
|
|
|
1
|
+
> ## ✨ MDD — Manual-Driven Development is now a standalone package
|
|
2
|
+
>
|
|
3
|
+
> MDD turns Claude Code into a structured development partner: every feature starts with documentation, every fix starts with an audit. **21 modes** covering build, audit, planning, ops runbooks, and more — all via `/mdd` in any Claude Code session.
|
|
4
|
+
>
|
|
5
|
+
> **Install:** `npm install -g @thedecipherist/mdd && mdd install`
|
|
6
|
+
>
|
|
7
|
+
> [GitHub →](https://github.com/TheDecipherist/mdd) · [npm →](https://www.npmjs.com/package/@thedecipherist/mdd)
|
|
8
|
+
|
|
9
|
+
# Claude Code Starter Kit
|
|
10
|
+
|
|
11
|
+
> ## [View the Full Interactive Guide →](https://thedecipherist.github.io/claude-code-mastery-project-starter-kit/)
|
|
12
|
+
>
|
|
13
|
+
> The GitHub Pages site has the complete documentation with syntax highlighting, navigation, and visual examples.
|
|
14
|
+
|
|
15
|
+
> The definitive starting point for Claude Code projects.
|
|
16
|
+
> Based on [Claude Code Mastery Guides V1-V5](https://github.com/TheDecipherist/claude-code-mastery) by TheDecipherist.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What Is This?
|
|
21
|
+
|
|
22
|
+
This is a **scaffold template**, not a runnable application. It provides the infrastructure (commands, hooks, skills, documentation templates) that makes Claude Code dramatically more effective. You use it to **create** projects, not run it directly.
|
|
23
|
+
|
|
24
|
+
### Three Ways to Use It
|
|
25
|
+
|
|
26
|
+
**A. Scaffold a new project (most common):**
|
|
27
|
+
```bash
|
|
28
|
+
/new-project my-app clean # or: /new-project my-app default
|
|
29
|
+
cd ~/projects/my-app
|
|
30
|
+
/setup
|
|
31
|
+
```
|
|
32
|
+
This creates a new project directory with all the Claude Code tooling pre-configured. Run `/quickstart` for a guided walkthrough.
|
|
33
|
+
|
|
34
|
+
**B. Convert an existing project:**
|
|
35
|
+
```bash
|
|
36
|
+
/convert-project-to-starter-kit ~/projects/my-existing-app
|
|
37
|
+
```
|
|
38
|
+
Non-destructive merge — brings all starter kit infrastructure (commands, hooks, skills, CLAUDE.md rules) into your existing project while preserving everything you already have. Creates a safety commit first so you can `git revert HEAD` to undo.
|
|
39
|
+
|
|
40
|
+
**C. Customize the template itself:**
|
|
41
|
+
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`.
|
|
42
|
+
|
|
43
|
+
> **What NOT to do:** Don't clone this repo and run `pnpm dev` expecting a working app. This is the *template* that creates apps — it's not an app itself. If you're looking to build something, start with option A above.
|
|
44
|
+
|
|
45
|
+
## Learning Path
|
|
46
|
+
|
|
47
|
+
Progress through these phases at your own pace. Each builds on the previous one.
|
|
48
|
+
|
|
49
|
+
The starter kit supports two development workflows:
|
|
50
|
+
- **Classic** — `/review`, `/commit`, `/create-api`, `/create-e2e` (individual commands, you drive)
|
|
51
|
+
- **MDD** — `/mdd` (structured Analyze → Document → Test → Code workflow, Claude drives with your approval)
|
|
52
|
+
|
|
53
|
+
Both use the same hooks, rules, and quality gates. MDD adds structured documentation and audit capabilities on top.
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Phase 1 Phase 2 Phase 3 Phase 4 Phase 5
|
|
57
|
+
INITIAL SETUP BUILD FEATURES QUALITY & TESTING DEPLOYMENT ADVANCED
|
|
58
|
+
(5 minutes)
|
|
59
|
+
|
|
60
|
+
/install-global --> /mdd <feature> --> /mdd audit --> /optimize-docker --> /refactor
|
|
61
|
+
/new-project /review /mdd status /security-check /what-is-my-ai-doing
|
|
62
|
+
cd my-app /commit /create-e2e deploy /worktree
|
|
63
|
+
/setup /create-api /test-plan custom rules
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### First 5 Minutes
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
/install-global # One-time: installs global Claude config + MDD (prompted, default yes)
|
|
70
|
+
/new-project my-app clean # Scaffold a project (or: default for full stack)
|
|
71
|
+
cd ~/projects/my-app # Enter your new project
|
|
72
|
+
/setup # Configure .env interactively
|
|
73
|
+
pnpm install && pnpm dev # Start building
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### First Feature (MDD Workflow)
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
/mdd add user authentication # Claude interviews you, writes docs, generates
|
|
80
|
+
# test skeletons, presents a plan, then builds
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use `/help` to see all 27 commands at any time.
|
|
84
|
+
|
|
85
|
+
## See It In Action
|
|
86
|
+
|
|
87
|
+
| | |
|
|
88
|
+
|---|---|
|
|
89
|
+
|  |  |
|
|
90
|
+
| **`/help`** — All 27 commands | **`/review`** — Catching violations with severity ratings |
|
|
91
|
+
|  |  |
|
|
92
|
+
| **Auto-Branching** — Hook blocks commits to main | **Lint-on-Save** — TypeScript errors caught instantly |
|
|
93
|
+
|  |  |
|
|
94
|
+
| **`/diagram architecture`** — Generated from actual code | **`/setup`** — Interactive .env configuration |
|
|
95
|
+
|  |  |
|
|
96
|
+
| **AI Monitor** — Free mode, no API key needed | **E2E Tests** — Good vs bad assertions |
|
|
97
|
+
|
|
98
|
+
## What's Included
|
|
99
|
+
|
|
100
|
+
Everything you need to start a Claude Code project the right way — security, automation, documentation, and testing all pre-configured.
|
|
101
|
+
|
|
102
|
+
- **CLAUDE.md** — Battle-tested project instructions with 11 numbered critical rules for security, TypeScript, database access, testing, and deployment
|
|
103
|
+
- **Global CLAUDE.md** — Security gatekeeper for all projects. Never publish secrets, never commit .env files, standardized scaffolding rules
|
|
104
|
+
- **27 Slash Commands** (16 project + 11 kit management)
|
|
105
|
+
- **Project** (copied into every scaffolded project): `/help`, `/review`, `/commit`, `/progress`, `/test-plan`, `/architecture`, `/security-check`, `/optimize-docker`, `/create-e2e`, `/create-api`, `/worktree`, `/what-is-my-ai-doing`, `/refactor`, `/diagram`, `/setup`, `/show-user-guide`
|
|
106
|
+
- **Kit management** (starter kit only): `/new-project`, `/update-project`, `/convert-project-to-starter-kit`, `/install-global`, `/install-mdd`, `/quickstart`, `/projects-created`, `/remove-project`, `/set-project-profile-default`, `/add-project-setup`, `/add-feature`
|
|
107
|
+
- **MDD workflow** — separate package: `npm install -g @thedecipherist/mdd && mdd install` → adds `/mdd` globally (21 modes)
|
|
108
|
+
- **10 Hooks** — Deterministic enforcement that always runs. Block dangerous bash commands, enforce file-length limits, lint on save, verify no committed credentials, branch protection, port conflicts, Rybbit pre-deploy gate, E2E test gate, env sync warnings, and RuleCatch monitoring (optional — skips silently if not installed)
|
|
109
|
+
- **9 Skills** — Context-aware expertise: code review, debugging, design review, test writing, API conventions, MongoDB rules, microservice scaffolding, MCP server building, and dependency vetting
|
|
110
|
+
- **Documentation Templates** — Pre-structured ARCHITECTURE.md, INFRASTRUCTURE.md, and DECISIONS.md templates
|
|
111
|
+
- **Testing Templates** — Master test checklist, issue tracking log, and StrictDB integration that prevents connection pool explosion
|
|
112
|
+
- **Live AI Monitor** — See every tool call, token, cost, and violation in real-time with `/what-is-my-ai-doing`. Free monitor mode works instantly — no API key, no account. Run `pnpm ai:monitor` in a separate terminal. Zero token overhead
|
|
113
|
+
|
|
114
|
+
## MDD Workflow — Manual-Driven Development ✨ Standalone Package
|
|
115
|
+
|
|
116
|
+
> **MDD has been separated into its own standalone npm package.** It is no longer bundled with this starter kit — you install it independently and use it in any project, with or without the starter kit.
|
|
117
|
+
|
|
118
|
+
[](https://github.com/TheDecipherist/mdd)
|
|
119
|
+
[](https://www.npmjs.com/package/@thedecipherist/mdd)
|
|
120
|
+
|
|
121
|
+
> **We used MDD to audit this starter kit.** Result: 20 findings discovered, 17 fixed, and 125 tests written from zero — all in **48 minutes**. The methodology the starter kit teaches was used to audit the starter kit itself.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm install -g @thedecipherist/mdd # install the MDD package
|
|
125
|
+
mdd install # deploy /mdd command to ~/.claude/commands/
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
MDD is the companion development methodology that turns Claude Code from a code generator into a structured development partner. Every feature starts with documentation. Every fix starts with an audit.
|
|
129
|
+
|
|
130
|
+
### The Problem
|
|
131
|
+
|
|
132
|
+
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.
|
|
133
|
+
|
|
134
|
+
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.
|
|
135
|
+
|
|
136
|
+
### The Workflow: Document → Audit → Fix → Verify
|
|
137
|
+
|
|
138
|
+
Every phase reads the output of the previous phase, compressing context further at each step:
|
|
139
|
+
|
|
140
|
+
| Phase | What Happens |
|
|
141
|
+
|-------|-------------|
|
|
142
|
+
| 📋 **Document** | Write feature docs with YAML frontmatter in `.mdd/docs/` |
|
|
143
|
+
| 🔍 **Audit** | Read source code, write incremental notes to disk (survives compaction) |
|
|
144
|
+
| 📊 **Analyze** | Read notes only → produce severity-rated findings report |
|
|
145
|
+
| 🔧 **Fix** | Execute pre-planned fixes with tests |
|
|
146
|
+
| ✅ **Verify** | Tests pass, types check, documentation updated |
|
|
147
|
+
|
|
148
|
+
### Usage — One Command, Fifteen Modes
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Build a new feature (Analyze → Document → Test skeletons → Plan → Implement → Verify)
|
|
152
|
+
/mdd add user authentication with JWT tokens
|
|
153
|
+
|
|
154
|
+
# Audit existing code (Scope → Read + Notes → Analyze → Present → Fix)
|
|
155
|
+
/mdd audit
|
|
156
|
+
/mdd audit database # audit a specific section
|
|
157
|
+
|
|
158
|
+
# Check MDD status and rebuild .mdd/.startup.md (includes drift summary)
|
|
159
|
+
/mdd status
|
|
160
|
+
|
|
161
|
+
# Detect code that changed outside MDD — catch doc drift before it silently spreads
|
|
162
|
+
/mdd scan
|
|
163
|
+
|
|
164
|
+
# Create a one-off task doc (follows full MDD workflow, but frozen — never shows as drifted)
|
|
165
|
+
/mdd task refactor db-query script
|
|
166
|
+
/mdd task investigate auth flow latency
|
|
167
|
+
|
|
168
|
+
# Update an existing feature doc after code has changed
|
|
169
|
+
/mdd update 04 # by number
|
|
170
|
+
/mdd update content-builder
|
|
171
|
+
|
|
172
|
+
# Generate docs from undocumented code, or regenerate an existing doc
|
|
173
|
+
/mdd reverse-engineer src/handlers/payments.ts
|
|
174
|
+
/mdd reverse-engineer 07 # regenerate doc 07 by comparing code vs existing doc
|
|
175
|
+
|
|
176
|
+
# Show cross-feature dependency graph with broken/risky dep warnings
|
|
177
|
+
/mdd graph
|
|
178
|
+
|
|
179
|
+
# Retire a feature cleanly — archive doc, flag dependents, optionally clean up files
|
|
180
|
+
/mdd deprecate 03
|
|
181
|
+
|
|
182
|
+
# Batch-patch missing frontmatter (last_synced, status, phase) across all docs
|
|
183
|
+
# Fixes the UNTRACKED state — use once when upgrading from an older MDD version
|
|
184
|
+
/mdd upgrade
|
|
185
|
+
|
|
186
|
+
# Append a note to .mdd/.startup.md (survives compaction)
|
|
187
|
+
/mdd note "just switched to PostgreSQL"
|
|
188
|
+
/mdd note list # view all notes
|
|
189
|
+
/mdd note clear # wipe notes section
|
|
190
|
+
|
|
191
|
+
# ── Initiative / Wave Planning (NEW) ────────────────────────────────────────────
|
|
192
|
+
|
|
193
|
+
# Create a new initiative (groups related waves and features into one roadmap item)
|
|
194
|
+
/mdd plan-initiative "auth system" # guided mode
|
|
195
|
+
/mdd plan-initiative "auth system" --template # write raw markdown yourself
|
|
196
|
+
|
|
197
|
+
# Add a wave to an initiative (a phase of work with a concrete demo state)
|
|
198
|
+
/mdd plan-wave auth-system "Auth Foundation"
|
|
199
|
+
/mdd plan-wave auth-system "Auth Foundation" --template
|
|
200
|
+
|
|
201
|
+
# Execute a wave — turns planned features into MDD docs and starts implementation
|
|
202
|
+
/mdd plan-execute auth-system-wave-1
|
|
203
|
+
|
|
204
|
+
# Sync wave docs after the parent initiative changes (version bump)
|
|
205
|
+
/mdd plan-sync auth-system
|
|
206
|
+
|
|
207
|
+
# Remove a feature from a wave (before it has a doc)
|
|
208
|
+
/mdd plan-remove-feature auth-system-wave-1 auth-signup
|
|
209
|
+
|
|
210
|
+
# Cancel an initiative and all its planned work
|
|
211
|
+
/mdd plan-cancel-initiative auth-system
|
|
212
|
+
|
|
213
|
+
# Show a reference table of every /mdd mode and what it does
|
|
214
|
+
/mdd commands
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Build mode** (`/mdd <description>`) — 7 phases, 3 mandatory gates:
|
|
218
|
+
|
|
219
|
+
- **Pipeline:** Understand → Analyze → Document → Test Skeletons + **Red Gate** → Plan → Implement + **Green Gate** → Verify + **Integration Gate**
|
|
220
|
+
- **Phase 1** gathers context using 3 parallel Explore agents (rules, existing features, codebase structure)
|
|
221
|
+
- **Phase 2** is a mandatory **Data Flow & Impact Analysis** gate — traces every data value end-to-end before writing a line of docs; skipped automatically on greenfield projects
|
|
222
|
+
- Questions are context-adaptive — tooling tasks skip the database and API questions entirely
|
|
223
|
+
- **Red Gate** runs every test skeleton to confirm it actually fails before implementation begins
|
|
224
|
+
- Build plan uses **commit-worthy blocks** with runnable end-states, verification commands, and handoff contracts; independent blocks are annotated for parallel execution
|
|
225
|
+
- **Green Gate** implements each block with a 5-iteration diagnosis-first loop — states root cause before each fix; stops at 5 and reports to the user rather than continuing blindly
|
|
226
|
+
- **Integration Gate** verifies real behavior (real HTTP calls, real DB, real browser) before marking complete; blocked features get `⏸️ MDD Blocked` with a concrete next step
|
|
227
|
+
|
|
228
|
+
**Audit mode** (`/mdd audit`) — complete security and quality audit, 5 phases:
|
|
229
|
+
|
|
230
|
+
- **A1 Scope** — reads `.mdd/docs/` to build the feature map; auto-generates docs if none exist
|
|
231
|
+
- **A2 Read + Notes** — features batched across up to 3 parallel Explore agents; notes written to disk so findings survive context compaction
|
|
232
|
+
- **A3 Analyze** — reads notes file only to produce a severity-rated findings report
|
|
233
|
+
- **A4 Present** — shows top findings with effort estimates and asks what to fix
|
|
234
|
+
- **A5 Fix** — applies fixes, writes tests, updates documentation
|
|
235
|
+
- Auto-branches to `fix/mdd-audit-<date>` before making any changes
|
|
236
|
+
|
|
237
|
+
**Scan mode** (`/mdd scan`) — detects documentation drift (features whose source files changed since last session):
|
|
238
|
+
|
|
239
|
+
- A single Explore agent runs all `git log --after="<last_synced>"` checks in one pass
|
|
240
|
+
- Returns a classification table: ✅ in sync / ⚠️ drifted / ❌ broken reference / ❓ untracked
|
|
241
|
+
- Task docs (`type: task`) appear in a separate frozen section — never flagged as drifted
|
|
242
|
+
- Saves a full drift report to `.mdd/audits/scan-<date>.md`
|
|
243
|
+
|
|
244
|
+
**Update mode** (`/mdd update <feature-id>`) — re-syncs a feature doc after code changes:
|
|
245
|
+
|
|
246
|
+
- Reads current source files, diffs them against the doc, presents "what changed"
|
|
247
|
+
- Rewrites only the affected sections; never touches unchanged content
|
|
248
|
+
- Appends new test skeletons for newly documented behaviors without modifying existing tests
|
|
249
|
+
- Updates `last_synced` in frontmatter
|
|
250
|
+
|
|
251
|
+
**Reverse-engineer mode** (`/mdd reverse-engineer [path|feature-id]`) — generates MDD docs from existing code:
|
|
252
|
+
|
|
253
|
+
- Works on undocumented files (new doc) or existing docs (regenerate + compare)
|
|
254
|
+
- ≤3 files read directly in the main conversation; 4+ files batched across up to 3 parallel Explore agents
|
|
255
|
+
- Always shows a diff in regenerate mode so you can merge rather than blindly overwrite
|
|
256
|
+
- Discloses limitations — business intent and implicit constraints must be manually reviewed
|
|
257
|
+
|
|
258
|
+
**Graph mode** (`/mdd graph`) — renders an ASCII dependency map from `depends_on` fields:
|
|
259
|
+
|
|
260
|
+
- Flags broken dependencies (deprecated features still depended on)
|
|
261
|
+
- Flags risky dependencies (complete features depending on in-progress ones)
|
|
262
|
+
- Identifies orphans (no connections either way)
|
|
263
|
+
- When `.mdd/initiatives/` exists: appends an initiative → wave → feature hierarchy tree showing progress and broken doc links
|
|
264
|
+
|
|
265
|
+
**Deprecate mode** (`/mdd deprecate <feature-id>`) — retires a feature cleanly:
|
|
266
|
+
|
|
267
|
+
- Sets `status: deprecated` and moves the doc to `.mdd/docs/archive/`
|
|
268
|
+
- Adds known-issue warnings to all dependent docs
|
|
269
|
+
- Asks separately whether to delete source files and test files — never auto-deletes
|
|
270
|
+
|
|
271
|
+
**Upgrade mode** (`/mdd upgrade`) — batch-patches missing frontmatter fields across all docs:
|
|
272
|
+
|
|
273
|
+
- Adds `last_synced`, `status`, and `phase` to any doc missing them
|
|
274
|
+
- Non-destructive — existing fields are never overwritten
|
|
275
|
+
- `last_synced` inferred from `git log` on each doc file (not today's date) so drift stays accurate
|
|
276
|
+
- Shows a plan and asks for confirmation before writing anything
|
|
277
|
+
- Run once when upgrading from an older MDD version; fixes the UNTRACKED (❓) state
|
|
278
|
+
|
|
279
|
+
**Plan-initiative mode** (`/mdd plan-initiative <title>`) — creates a new initiative file in `.mdd/initiatives/`:
|
|
280
|
+
|
|
281
|
+
- Interviews you about goals, target audience, and open product questions (guided mode), or writes the raw template for you to fill in (--template)
|
|
282
|
+
- Generates a slug and a v1 hash; collision-checks against existing initiatives
|
|
283
|
+
- If an initiative with the same slug already exists and has active wave docs, blocks with an error — active code must be deprecated before overwriting
|
|
284
|
+
|
|
285
|
+
**Plan-wave mode** (`/mdd plan-wave <initiative-id> <wave-title>`) — adds a wave to an existing initiative:
|
|
286
|
+
|
|
287
|
+
- Asks about demo state, feature list, and dependencies between features in the same wave
|
|
288
|
+
- Writes a wave file in `.mdd/waves/` stamped with the initiative's current version
|
|
289
|
+
- Validates that the parent initiative exists and is not cancelled
|
|
290
|
+
|
|
291
|
+
**Plan-execute mode** (`/mdd plan-execute <wave-id>`) — turns a planned wave into real work:
|
|
292
|
+
|
|
293
|
+
- Reads the wave file; for each planned feature without a doc, runs `/mdd <feature-slug>` build mode
|
|
294
|
+
- Supports automated (run all) or interactive (confirm each feature) execution
|
|
295
|
+
- Updates each feature's `docPath` and `waveStatus` in the wave file as docs are created
|
|
296
|
+
|
|
297
|
+
**Plan-sync mode** (`/mdd plan-sync <initiative-id>`) — re-stamps all wave files after a version bump:
|
|
298
|
+
|
|
299
|
+
- Run after editing an initiative (overview, questions) — updates `initiativeVersion` in all child waves
|
|
300
|
+
- Surfaces stale waves flagged by `/mdd scan`
|
|
301
|
+
|
|
302
|
+
**Plan-remove-feature mode** (`/mdd plan-remove-feature <wave-id> <feature-slug>`) — removes a feature from a wave before it has been executed:
|
|
303
|
+
|
|
304
|
+
- Hard-stops if the feature already has a `docPath` — use `/mdd deprecate` for that instead
|
|
305
|
+
- Confirms with the user before removing
|
|
306
|
+
|
|
307
|
+
**Plan-cancel-initiative mode** (`/mdd plan-cancel-initiative <initiative-id>`) — cancels an initiative and all its planned work:
|
|
308
|
+
|
|
309
|
+
- Sets initiative `status: cancelled` and all child wave statuses to `cancelled`
|
|
310
|
+
- If any wave has executed features (docs with `docPath`), warns and asks how to handle them
|
|
311
|
+
- Cancelled initiatives are still visible in the TUI dashboard (shown in gray)
|
|
312
|
+
|
|
313
|
+
**MDD versioning** — every file created or updated by MDD is stamped with `mdd_version: N` in its frontmatter, where N matches the version declared in the `@thedecipherist/mdd` package. `/mdd status` shows a breakdown of which docs are on which version. Update MDD with `npm install -g @thedecipherist/mdd && mdd install` (or `/install-global mdd`). Files without `mdd_version` (created before versioning was introduced) are treated as version 0 and flagged as outdated.
|
|
314
|
+
|
|
315
|
+
### The `.mdd/` Directory
|
|
316
|
+
|
|
317
|
+
All MDD artifacts live in a single dotfile directory, gitignored by default:
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
.mdd/
|
|
321
|
+
├── docs/ # Feature documentation (one per feature)
|
|
322
|
+
│ ├── 01-<feature-name>.md # auto-numbered, YAML frontmatter + last_synced/status/phase
|
|
323
|
+
│ ├── 02-<feature-name>.md
|
|
324
|
+
│ └── archive/ # Deprecated feature docs (set by /mdd deprecate)
|
|
325
|
+
├── initiatives/ # Initiative files (created by /mdd plan-initiative)
|
|
326
|
+
│ └── <initiative-slug>.md # YAML frontmatter: id, title, status, version, hash
|
|
327
|
+
├── waves/ # Wave files (created by /mdd plan-wave)
|
|
328
|
+
│ └── <initiative-slug>-wave-N.md # YAML frontmatter + feature table; links back to docs
|
|
329
|
+
├── audits/ # Audit artifacts (all gitignored)
|
|
330
|
+
│ ├── flow-<feature>-<date>.md # Data flow analysis written during Phase 2
|
|
331
|
+
│ ├── notes-<date>.md # Raw reading notes (Phase A2, written every 2 features)
|
|
332
|
+
│ ├── report-<date>.md # Severity-rated findings report (Phase A3)
|
|
333
|
+
│ ├── results-<date>.md # Before/after fix summary (Phase A5)
|
|
334
|
+
│ ├── scan-<date>.md # Drift report from /mdd scan
|
|
335
|
+
│ └── graph-<date>.md # Dependency graph from /mdd graph
|
|
336
|
+
└── .startup.md # Auto-generated session context (injected at startup)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Real Results: Self-Audit
|
|
340
|
+
|
|
341
|
+
| Audit Step | Time | Output |
|
|
342
|
+
|------------|------|--------|
|
|
343
|
+
| Create Docs (pre-audit) | ~25 min | 9 feature docs (795 lines) in `.mdd/docs/` |
|
|
344
|
+
| A2: Read + Notes | 9 min 51s | 57+ files read, 837 lines of notes |
|
|
345
|
+
| A3: Analyze | 2 min 39s | 298-line report, 20 findings |
|
|
346
|
+
| A5: Fix All | 10 min 53s | 17/20 fixed, 125 tests written |
|
|
347
|
+
| **Total** | **~48 min** | **20 findings, 125 tests from zero** |
|
|
348
|
+
|
|
349
|
+
| Metric | Before MDD | After MDD |
|
|
350
|
+
|--------|-----------|----------|
|
|
351
|
+
| Unit tests | 0 | 94 |
|
|
352
|
+
| Test files | 0 | 5 |
|
|
353
|
+
| Documentation files | 3 | 14 |
|
|
354
|
+
| Known issues documented | 0 | 84 |
|
|
355
|
+
| Findings found & fixed | 0 | 17/20 |
|
|
356
|
+
| Quality gate violations | 1 (651-line file) | 0 (split into 5 modules) |
|
|
357
|
+
| Config validation | None (raw JSON.parse) | Zod schema with fail-fast |
|
|
358
|
+
| Secret detection patterns | 4 basic | 10+ (GitHub, Slack, Stripe, PEM, JWT) |
|
|
359
|
+
|
|
360
|
+
### The Incremental Write Trick
|
|
361
|
+
|
|
362
|
+
The most important technical detail: when Claude reads files during an audit, context will compact. If your findings are only in 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. Zero data loss across 6 complete audit cycles.
|
|
363
|
+
|
|
364
|
+
### Startup Context -- .mdd/.startup.md
|
|
365
|
+
|
|
366
|
+
Every time a Claude Code session starts (including after `/clear` and compaction),
|
|
367
|
+
the starter kit injects a compact project snapshot into Claude's context automatically.
|
|
368
|
+
This replaces the expensive habit of Claude reading 40 files to get oriented -- it reads
|
|
369
|
+
one file instead.
|
|
370
|
+
|
|
371
|
+
The snapshot is stored in `.mdd/.startup.md` and has two zones:
|
|
372
|
+
|
|
373
|
+
**Auto-generated zone** (above the `---` divider) -- rewritten by `/mdd` commands:
|
|
374
|
+
- Current git branch
|
|
375
|
+
- Stack summary (framework, database, hosting)
|
|
376
|
+
- Features documented in `.mdd/docs/`
|
|
377
|
+
- Last audit results (findings found, fixed, still open)
|
|
378
|
+
- Rules quick-reference
|
|
379
|
+
|
|
380
|
+
**Notes zone** (below the `---` divider) -- append-only, never overwritten:
|
|
381
|
+
- Your own timestamped annotations added with `/mdd note`
|
|
382
|
+
|
|
383
|
+
The file is gitignored -- it is machine state, not source code. It regenerates
|
|
384
|
+
automatically as you use MDD.
|
|
385
|
+
|
|
386
|
+
**Commands:**
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
/mdd status -- regenerate .startup.md from current project state
|
|
390
|
+
/mdd note "your note" -- append a timestamped note
|
|
391
|
+
/mdd note list -- print only the Notes section
|
|
392
|
+
/mdd note clear -- wipe the Notes section
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Why this works:**
|
|
396
|
+
|
|
397
|
+
The SessionStart hook runs on startup, /clear, and compaction. Its only job is:
|
|
398
|
+
`cat .mdd/.startup.md`
|
|
399
|
+
|
|
400
|
+
One file. ~100-200 tokens. Claude is fully oriented before your first prompt.
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## MDD Dashboard — Terminal TUI
|
|
405
|
+
|
|
406
|
+
The `mdd` package is a companion terminal dashboard for MDD workspaces. Run it inside any project that has a `.mdd/` folder to get a real-time, interactive view of your workspace health — without leaving VS Code.
|
|
407
|
+
|
|
408
|
+

|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
npm install -g @thedecipherist/mdd-tui
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Then inside any project with a `.mdd/` folder:
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
mdd # opens the interactive TUI
|
|
418
|
+
mdd dashboard # same
|
|
419
|
+
mdd status # same — all three open the dashboard
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**What it shows:**
|
|
423
|
+
|
|
424
|
+
| Panel | Contents |
|
|
425
|
+
|-------|----------|
|
|
426
|
+
| Left | **INITIATIVES** (collapsible tree, shown when `.mdd/initiatives/` exists) · feature docs · audit reports · dep graph |
|
|
427
|
+
| Right | Initiative overview, wave detail, or full doc/audit content with drift info, frontmatter chips, and markdown |
|
|
428
|
+
| Top bar | Counts: docs · in-sync · drifted · broken · untracked · issues · audits · initiatives · active waves |
|
|
429
|
+
|
|
430
|
+
**Left panel sections (top to bottom):**
|
|
431
|
+
- **INITIATIVES** — collapsible tree of initiatives and their waves. `▸` collapsed, `▾` expanded. Wave rows show `●` active / `✓` complete / `○` planned with a feature progress count (e.g. `2/3`).
|
|
432
|
+
- **FEATURE DOCS** — all docs with drift icons: `✅` in sync · `⚠️` drifted · `❌` broken · `❓` untracked
|
|
433
|
+
- **AUDIT REPORTS** — audit files from `.mdd/audits/`
|
|
434
|
+
- **DEP GRAPH** — ASCII dependency map
|
|
435
|
+
|
|
436
|
+
**Keyboard shortcuts:**
|
|
437
|
+
|
|
438
|
+
| Key | Action |
|
|
439
|
+
|-----|--------|
|
|
440
|
+
| `↑` / `k` · `↓` / `j` | Navigate left panel / scroll right panel |
|
|
441
|
+
| `→` / `l` / `Enter` | Focus right panel (or expand initiative) |
|
|
442
|
+
| `←` / `h` / `Esc` | Focus left panel |
|
|
443
|
+
| `i` | Jump to first initiative |
|
|
444
|
+
| `Page Up` / `Page Down` | Scroll right panel one page |
|
|
445
|
+
| `Home` / `End` | Jump to top / bottom of right panel |
|
|
446
|
+
| `r` | Refresh and re-scan workspace |
|
|
447
|
+
| `q` / `Ctrl+C` | Quit |
|
|
448
|
+
|
|
449
|
+
The dashboard auto-detects drift by running `git log` against each doc's `last_synced` frontmatter field. Docs whose `source_files` have changed since last sync are marked ⚠️ drifted.
|
|
450
|
+
|
|
451
|
+
npm: [mdd-tui](https://www.npmjs.com/package/mdd-tui) · GitHub: [TheDecipherist/mdd-tui](https://github.com/TheDecipherist/mdd-tui)
|
|
452
|
+
|
|
453
|
+
> **Recommended: install MDD globally.** Run `/install-global` once and answer "yes" to the MDD prompt — `/mdd` is then available in every project on your machine with no per-project setup. Update the starter kit once and every project picks up the new version automatically on the next session. When you run `/mdd` for the first time in a fresh project, it auto-creates the `.mdd/` structure (docs, audits, ops, `.startup.md`) — no separate `/install-mdd` step needed.
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Ops Mode — Deployment Runbooks ✨ NEW
|
|
458
|
+
|
|
459
|
+
> **The flaw MDD had:** Deployment and infrastructure tasks had no documentation home. Running `/mdd dokploy-deploy` defaulted to Build Mode and skipped the documentation phases — because deploying services isn't a feature to build. Ops Mode fixes this.
|
|
460
|
+
|
|
461
|
+
MDD now treats deployments as first-class citizens. Every deployment target gets a structured runbook — either project-local or global. Write it once — then `runop` executes it every time, with live health checks, verified steps, and canary-gated multi-region rollout.
|
|
462
|
+
|
|
463
|
+
### Commands
|
|
464
|
+
|
|
465
|
+
| Command | What it does |
|
|
466
|
+
|---|---|
|
|
467
|
+
| `/mdd ops <description>` | Create a runbook — **first question is always: global or project?** |
|
|
468
|
+
| `/mdd ops list` | List all runbooks — global and project — with last-run health status |
|
|
469
|
+
| `/mdd runop <slug>` | Execute a runbook — checks project-local first, then global |
|
|
470
|
+
| `/mdd update-op <slug>` | Edit an existing runbook — same lookup order |
|
|
471
|
+
|
|
472
|
+
### Global vs Project Scope
|
|
473
|
+
|
|
474
|
+
The **first thing `/mdd ops` asks** is where the runbook should live:
|
|
475
|
+
|
|
476
|
+
| Scope | Location | Use for |
|
|
477
|
+
|---|---|---|
|
|
478
|
+
| **Project** | `.mdd/ops/<slug>.md` | This project only (e.g., deploy this specific app to Dokploy) |
|
|
479
|
+
| **Global** | `~/.claude/ops/<slug>.md` | Reusable across all projects (e.g., update Cloudflare DNS, renew SSL certs, Docker Hub login) |
|
|
480
|
+
|
|
481
|
+
> **Global ops cannot access project-local `.env` variables or project paths.** They use `~/.env` globals only — which is exactly right for infrastructure procedures that don't belong to any one project.
|
|
482
|
+
|
|
483
|
+
**Global is the authoritative namespace.** If a global runbook named `cloudflare-dns` exists, no project can create a local runbook with the same name. This prevents any ambiguity about which runbook `runop` will execute — you always know exactly what runs.
|
|
484
|
+
|
|
485
|
+
### Write Once, Runs Every Time
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# First time — creates the runbook
|
|
489
|
+
/mdd ops "deploy rulecatch services to dokploy US and EU"
|
|
490
|
+
|
|
491
|
+
# Every deployment after — reads the runbook, no questions asked
|
|
492
|
+
/mdd runop rulecatch-dokploy
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
`runop` reads `.mdd/ops/rulecatch-dokploy.md` and executes the full deployment: pre-flight checks, step-by-step procedure with verification at each step, and post-flight confirmation. No tribal knowledge. No forgotten steps. The doc IS the deployment.
|
|
496
|
+
|
|
497
|
+
### Canary-Gated Multi-Region Deployment
|
|
498
|
+
|
|
499
|
+
Deploy to your canary region first. Gate on full health verification. Only then touch primary. If canary fails — primary is never touched, still running the last good version.
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
Pre-flight Health Check — rulecatch-dokploy
|
|
503
|
+
──────────────────────────────────────────────────────────
|
|
504
|
+
eu-west (canary) us-east (primary)
|
|
505
|
+
api ✓ healthy ✓ healthy
|
|
506
|
+
dashboard ✗ failing ✓ healthy
|
|
507
|
+
worker ✓ healthy ✓ healthy
|
|
508
|
+
|
|
509
|
+
dashboard is failing in eu-west.
|
|
510
|
+
(a) Redeploy (b) Skip (c) Abort
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
```
|
|
514
|
+
── eu-west (canary) — gate check ───────────────────────
|
|
515
|
+
api ✓ healthy (rulecatch-api-eu:latest)
|
|
516
|
+
dashboard ✓ healthy (rulecatch-dashboard-eu:latest)
|
|
517
|
+
worker ✓ healthy
|
|
518
|
+
Gate: PASSED ✓ — advancing to us-east (primary)
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
```
|
|
522
|
+
runop complete — rulecatch-dokploy
|
|
523
|
+
|
|
524
|
+
eu-west (canary) us-east (primary)
|
|
525
|
+
api ✓ healthy ✓ healthy
|
|
526
|
+
dashboard ✓ healthy ✓ healthy
|
|
527
|
+
worker ✓ healthy ✓ healthy
|
|
528
|
+
|
|
529
|
+
Canary gate: PASSED ✓
|
|
530
|
+
Regions deployed: 2/2
|
|
531
|
+
Steps executed: 14/14 ✓
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### Per-Region Docker Image Overrides
|
|
535
|
+
|
|
536
|
+
Different image names for different regions? Fully supported. Each service has a default image plus per-region overrides:
|
|
537
|
+
|
|
538
|
+
```yaml
|
|
539
|
+
services:
|
|
540
|
+
- slug: api
|
|
541
|
+
image: theDecipherist/rulecatch-api:latest # default
|
|
542
|
+
regions:
|
|
543
|
+
eu-west:
|
|
544
|
+
image: theDecipherist/rulecatch-api-eu:latest # different name for EU
|
|
545
|
+
status: healthy
|
|
546
|
+
last_checked: 2026-04-18T10:00:00Z
|
|
547
|
+
us-east:
|
|
548
|
+
image: theDecipherist/rulecatch-api:latest # same as default
|
|
549
|
+
status: healthy
|
|
550
|
+
last_checked: 2026-04-18T10:05:00Z
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
All keys are always fully populated — no implicit inheritance that breaks when you add a second region.
|
|
554
|
+
|
|
555
|
+
### Deployment Strategy Control
|
|
556
|
+
|
|
557
|
+
```yaml
|
|
558
|
+
deployment_strategy:
|
|
559
|
+
order: sequential # sequential | parallel
|
|
560
|
+
gate: health_check # health_check | manual | none
|
|
561
|
+
on_gate_failure: stop # stop | skip_region | rollback
|
|
562
|
+
rollback_on_failure: false # auto-run rollback steps on failure
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
`on_gate_failure: stop` — canary fails, primary untouched. Investigate, fix, re-run.
|
|
566
|
+
`on_gate_failure: rollback` — canary fails, auto-rollback EU, primary untouched.
|
|
567
|
+
`on_gate_failure: skip_region` — skip the failed region and continue to primary (useful when EU is lower priority).
|
|
568
|
+
|
|
569
|
+
### Listing All Runbooks
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
/mdd ops list
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
```
|
|
576
|
+
📦 Ops Runbooks
|
|
577
|
+
|
|
578
|
+
Global (~/.claude/ops/)
|
|
579
|
+
cloudflare-dns DNS record updates via Cloudflare API last run: 2026-04-10
|
|
580
|
+
ssl-renewal Let's Encrypt cert renewal (Certbot) last run: never
|
|
581
|
+
|
|
582
|
+
Project (.mdd/ops/)
|
|
583
|
+
rulecatch-dokploy 10 services → eu-west (canary) + us-east last run: 2026-04-18 ✓ all healthy
|
|
584
|
+
swarmk-dokploy 7 services → eu-west (canary) + us-east last run: 2026-04-17 ⚠ api degraded
|
|
585
|
+
|
|
586
|
+
Run /mdd runop <slug> to execute any runbook.
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### Where Runbooks Live
|
|
590
|
+
|
|
591
|
+
```
|
|
592
|
+
~/.claude/ops/ ← global runbooks (all projects)
|
|
593
|
+
cloudflare-dns.md
|
|
594
|
+
ssl-renewal.md
|
|
595
|
+
|
|
596
|
+
.mdd/
|
|
597
|
+
├── docs/ ← feature docs (type: feature | task)
|
|
598
|
+
└── ops/ ← project runbooks (this project only)
|
|
599
|
+
├── rulecatch-dokploy.md
|
|
600
|
+
├── swarmk-dokploy.md
|
|
601
|
+
└── archive/
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
All existing modes are ops-aware: `/mdd status` shows ops runbook count, `/mdd scan` checks runbook drift, `/mdd graph` includes a runbook health summary, `/mdd audit` flags missing sections and credential security violations.
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## Featured Packages
|
|
609
|
+
|
|
610
|
+
Five open-source npm packages by [TheDecipherist](https://github.com/TheDecipherist) — the same developer behind this starter kit — are integrated into the default build. All are MIT-licensed.
|
|
611
|
+
|
|
612
|
+
> **Full disclosure:** These packages are developed by the same person who maintains this starter kit. They are completely open source (MIT license), and the starter kit works fully without them. ClassMCP and Classpresso are auto-included in CSS-enabled profiles because they directly complement the AI-assisted CSS workflow this kit teaches. StrictDB-MCP is auto-included in database-enabled profiles. TerseJSON is documented but not auto-included.
|
|
613
|
+
|
|
614
|
+
### ClassMCP — Semantic CSS for AI
|
|
615
|
+
|
|
616
|
+
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.
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
claude mcp add classmcp -- npx -y classmcp@latest
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
npm: [classmcp](https://www.npmjs.com/package/classmcp) · [Website](https://classmcp.com?utm_source=github&utm_medium=readme&utm_campaign=classmcp&utm_content=featured-packages)
|
|
623
|
+
|
|
624
|
+
### StrictDB-MCP (MCP Server) — Database Access for AI
|
|
625
|
+
|
|
626
|
+
Gives AI agents direct database access through 14 MCP tools with full guardrails, sanitization, and error handling. Auto-included in database-enabled profiles (`mcp` field in `claude-mastery-project.conf`).
|
|
627
|
+
|
|
628
|
+
```bash
|
|
629
|
+
claude mcp add strictdb -- npx -y strictdb-mcp@latest
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
npm: [strictdb-mcp](https://www.npmjs.com/package/strictdb-mcp)
|
|
633
|
+
|
|
634
|
+
### Classpresso — Post-Build CSS Optimization
|
|
635
|
+
|
|
636
|
+
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`.
|
|
637
|
+
|
|
638
|
+
```bash
|
|
639
|
+
pnpm add -D classpresso
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
npm: [classpresso](https://www.npmjs.com/package/classpresso) · [Website](https://classpresso.com?utm_source=github&utm_medium=readme&utm_campaign=classpresso&utm_content=featured-packages)
|
|
643
|
+
|
|
644
|
+
### TerseJSON — Memory-Efficient JSON (Optional)
|
|
645
|
+
|
|
646
|
+
Proxy-based lazy JSON expansion achieving ~70% memory reduction for large payloads. **Not auto-included** — install only if your project handles large JSON datasets.
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
pnpm add tersejson
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
npm: [tersejson](https://www.npmjs.com/package/tersejson) · [Website](https://tersejson.com?utm_source=github&utm_medium=readme&utm_campaign=tersejson&utm_content=featured-packages)
|
|
653
|
+
|
|
654
|
+
## Supported Technologies
|
|
655
|
+
|
|
656
|
+
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.
|
|
657
|
+
|
|
658
|
+
### Languages & Frameworks
|
|
659
|
+
|
|
660
|
+
| Category | Technologies | Notes |
|
|
661
|
+
|----------|-------------|-------|
|
|
662
|
+
| **Languages** | Node.js/TypeScript, Go, Python | Full scaffolding support for all three |
|
|
663
|
+
| **Frontend** | React, Vue 3, Svelte, SvelteKit, Angular, Next.js, Nuxt, Astro | CLI scaffold + CLAUDE.md rules per framework |
|
|
664
|
+
| **Backend (Node.js)** | Fastify, Express, Hono | API scaffolding with `/create-api` |
|
|
665
|
+
| **Backend (Go)** | Gin, Chi, Echo, Fiber, stdlib | Standard layout with cmd/internal/ |
|
|
666
|
+
| **Backend (Python)** | FastAPI, Django, Flask | Async support, Pydantic, pytest |
|
|
667
|
+
| **Database** | MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, Elasticsearch | StrictDB for all backends |
|
|
668
|
+
| **Hosting** | Dokploy, Vercel, Static (GitHub Pages, Netlify) | Deployment scripts + Docker |
|
|
669
|
+
| **Testing** | Vitest, Playwright, pytest, Go test | Framework-appropriate test setup |
|
|
670
|
+
| **CSS** | Tailwind CSS + ClassMCP + Classpresso | ClassMCP (MCP) + Classpresso (post-build) auto-included in CSS profiles |
|
|
671
|
+
|
|
672
|
+
### Recommended Stacks by Use Case
|
|
673
|
+
|
|
674
|
+
| Use Case | Stack | Profile |
|
|
675
|
+
|----------|-------|---------|
|
|
676
|
+
| SPA Dashboard | Vite + React + Fastify + MongoDB | `default` |
|
|
677
|
+
| REST API (Node.js) | Fastify + PostgreSQL | `api` with `postgres` |
|
|
678
|
+
| Go Microservice | Gin + PostgreSQL | `go` with `postgres` |
|
|
679
|
+
| Python API | FastAPI + PostgreSQL | `python-api` |
|
|
680
|
+
| Vue SPA | Vue 3 + Vite + Tailwind | `vue` |
|
|
681
|
+
| Nuxt Full-Stack | Nuxt + MongoDB + Docker | `nuxt` |
|
|
682
|
+
| Svelte SPA | Svelte + Vite + Tailwind | `svelte` |
|
|
683
|
+
| SvelteKit Full-Stack | SvelteKit + MongoDB + Docker | `sveltekit` |
|
|
684
|
+
| Angular App | Angular + Tailwind | `angular` |
|
|
685
|
+
| Django Web App | Django + PostgreSQL + Docker | `django` |
|
|
686
|
+
| Content Site | Astro or SvelteKit | `static-site` or `sveltekit` |
|
|
687
|
+
| AI goodies only | Any — you choose everything | `clean` |
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
## Quick Start
|
|
692
|
+
|
|
693
|
+
### 1. Clone and Customize
|
|
694
|
+
|
|
695
|
+
```bash
|
|
696
|
+
# Clone the starter kit
|
|
697
|
+
git clone https://github.com/TheDecipherist/claude-code-mastery-project-starter-kit my-project
|
|
698
|
+
cd my-project
|
|
699
|
+
|
|
700
|
+
# Remove git history and start fresh
|
|
701
|
+
rm -rf .git
|
|
702
|
+
git init
|
|
703
|
+
|
|
704
|
+
# Copy your .env
|
|
705
|
+
cp .env.example .env
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
### 2. Set Up Global Config (One Time)
|
|
709
|
+
|
|
710
|
+
```bash
|
|
711
|
+
# Run the install command — smart merges into existing config
|
|
712
|
+
/install-global
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
This installs global CLAUDE.md rules, settings.json hooks, and enforcement scripts (`verify-no-secrets.sh`, `check-rulecatch.sh`) into `~/.claude/`. If you already have a global config, it merges without overwriting.
|
|
716
|
+
|
|
717
|
+
<details>
|
|
718
|
+
<summary>Manual setup (if you prefer)</summary>
|
|
719
|
+
|
|
720
|
+
```bash
|
|
721
|
+
cp global-claude-md/CLAUDE.md ~/.claude/CLAUDE.md
|
|
722
|
+
cp global-claude-md/settings.json ~/.claude/settings.json
|
|
723
|
+
mkdir -p ~/.claude/hooks
|
|
724
|
+
cp .claude/hooks/verify-no-secrets.sh ~/.claude/hooks/
|
|
725
|
+
cp .claude/hooks/check-rulecatch.sh ~/.claude/hooks/
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
</details>
|
|
729
|
+
|
|
730
|
+
### 3. Customize for Your Project
|
|
731
|
+
|
|
732
|
+
1. Run `/setup` — Interactive .env configuration (database, GitHub, Docker, analytics)
|
|
733
|
+
2. Edit `CLAUDE.md` — Update port assignments, add your specific rules
|
|
734
|
+
3. Run `/diagram all` — Auto-generate architecture, API, database, and infrastructure diagrams
|
|
735
|
+
4. Edit `CLAUDE.local.md` — Add your personal preferences
|
|
736
|
+
|
|
737
|
+
StrictDB works out of the box — just set `STRICTDB_URI` in your `.env` and it connects to your database automatically. Built-in sanitization and guardrails run on all inputs: standard query operators pass through safely while dangerous operators are stripped. See the [Database — StrictDB](#database--strictdb) section for details.
|
|
738
|
+
|
|
739
|
+
### 4. Start Building
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
claude
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
That's it. Claude Code now has battle-tested rules, deterministic hooks, slash commands, and documentation templates all ready to go.
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
## Troubleshooting
|
|
750
|
+
|
|
751
|
+
### Hooks Not Firing
|
|
752
|
+
|
|
753
|
+
- Verify `.claude/settings.json` is valid JSON: `python3 -m json.tool .claude/settings.json`
|
|
754
|
+
- Check that hook file paths are correct and executable: `ls -la .claude/hooks/`
|
|
755
|
+
- Restart your Claude Code session — hooks are loaded at session start
|
|
756
|
+
|
|
757
|
+
### `pnpm dev` Fails or Does Nothing
|
|
758
|
+
|
|
759
|
+
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.
|
|
760
|
+
|
|
761
|
+
### Database Connection Errors
|
|
762
|
+
|
|
763
|
+
- Run `/setup` to configure your `.env` with a valid connection string
|
|
764
|
+
- Check that `STRICTDB_URI` is set in `.env`
|
|
765
|
+
- Verify your IP is whitelisted in your database provider's network access settings
|
|
766
|
+
|
|
767
|
+
### `/install-global` Reports Conflicts
|
|
768
|
+
|
|
769
|
+
This is normal. The command uses smart merge — it keeps your existing sections and only adds what's missing. If sections overlap, it preserves yours. Check the report output for details on what was added vs skipped.
|
|
770
|
+
|
|
771
|
+
### Port Already in Use
|
|
772
|
+
|
|
773
|
+
```bash
|
|
774
|
+
# Find what's using the port
|
|
775
|
+
lsof -i :3000
|
|
776
|
+
|
|
777
|
+
# Kill it
|
|
778
|
+
kill -9 <PID>
|
|
779
|
+
|
|
780
|
+
# Or kill all test ports at once
|
|
781
|
+
pnpm test:kill-ports
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
### E2E Tests Timing Out
|
|
785
|
+
|
|
786
|
+
- Kill stale processes on test ports: `pnpm test:kill-ports`
|
|
787
|
+
- Run headed to see what's happening: `pnpm test:e2e:headed`
|
|
788
|
+
- Check that `playwright.config.ts` has correct `webServer` commands and ports
|
|
789
|
+
|
|
790
|
+
### RuleCatch Not Monitoring
|
|
791
|
+
|
|
792
|
+
> **Free monitor mode requires no setup.** Run `pnpm ai:monitor` in a separate terminal — it works instantly with no API key.
|
|
793
|
+
|
|
794
|
+
- **Free monitor:** `pnpm ai:monitor` (or `npx @rulecatch/ai-pooler monitor --no-api-key`) — live view of tool calls, tokens, cost
|
|
795
|
+
- **Full experience:** Sign up at [rulecatch.ai](https://rulecatch.ai) for dashboards, violation tracking, and alerts, then run `npx @rulecatch/ai-pooler init --api-key=YOUR_KEY --region=us`
|
|
796
|
+
|
|
797
|
+
---
|
|
798
|
+
|
|
799
|
+
## Project Structure
|
|
800
|
+
|
|
801
|
+
```
|
|
802
|
+
project/
|
|
803
|
+
├── CLAUDE.md # Project instructions (customize this!)
|
|
804
|
+
├── CLAUDE.local.md # Personal overrides (gitignored)
|
|
805
|
+
├── .claude/
|
|
806
|
+
│ ├── settings.json # Hooks configuration
|
|
807
|
+
│ ├── commands/
|
|
808
|
+
│ │ │ # /mdd — installed globally via: npm install -g @thedecipherist/mdd && mdd install
|
|
809
|
+
│ │ ├── help.md # /help — list all commands and skills
|
|
810
|
+
│ │ ├── quickstart.md # /quickstart — interactive first-run walkthrough
|
|
811
|
+
│ │ ├── review.md # /review — code review
|
|
812
|
+
│ │ ├── commit.md # /commit — smart commit
|
|
813
|
+
│ │ ├── progress.md # /progress — project status
|
|
814
|
+
│ │ ├── test-plan.md # /test-plan — generate test plan
|
|
815
|
+
│ │ ├── architecture.md # /architecture — show system design
|
|
816
|
+
│ │ ├── new-project.md # /new-project — scaffold new project
|
|
817
|
+
│ │ ├── security-check.md # /security-check — scan for secrets
|
|
818
|
+
│ │ ├── optimize-docker.md # /optimize-docker — Docker best practices
|
|
819
|
+
│ │ ├── create-e2e.md # /create-e2e — generate E2E tests
|
|
820
|
+
│ │ ├── create-api.md # /create-api — scaffold API endpoints
|
|
821
|
+
│ │ ├── worktree.md # /worktree — isolated task branches
|
|
822
|
+
│ │ ├── what-is-my-ai-doing.md # /what-is-my-ai-doing — live AI monitor
|
|
823
|
+
│ │ ├── setup.md # /setup — interactive .env configuration
|
|
824
|
+
│ │ ├── refactor.md # /refactor — audit + refactor against all rules
|
|
825
|
+
│ │ ├── install-global.md # /install-global — merge global config into ~/.claude/
|
|
826
|
+
│ │ ├── install-mdd.md # /install-mdd — install MDD workflow into any project
|
|
827
|
+
│ │ ├── diagram.md # /diagram — generate diagrams from actual code
|
|
828
|
+
│ │ ├── set-project-profile-default.md # /set-project-profile-default — set default profile
|
|
829
|
+
│ │ ├── add-project-setup.md # /add-project-setup — create a named profile
|
|
830
|
+
│ │ ├── projects-created.md # /projects-created — list all created projects
|
|
831
|
+
│ │ ├── remove-project.md # /remove-project — remove a project from registry
|
|
832
|
+
│ │ ├── convert-project-to-starter-kit.md # /convert-project-to-starter-kit — merge into existing project
|
|
833
|
+
│ │ ├── update-project.md # /update-project — update a project with latest starter kit
|
|
834
|
+
│ │ ├── add-feature.md # /add-feature — add capabilities post-scaffolding
|
|
835
|
+
│ │ └── show-user-guide.md # /show-user-guide — open the User Guide in browser
|
|
836
|
+
│ ├── skills/
|
|
837
|
+
│ │ ├── api-conventions/SKILL.md # Service structure conventions
|
|
838
|
+
│ │ ├── code-review/SKILL.md # Triggered code review checklist
|
|
839
|
+
│ │ ├── create-service/SKILL.md # Service scaffolding template
|
|
840
|
+
│ │ ├── debugger/SKILL.md # Root-cause failure diagnosis
|
|
841
|
+
│ │ ├── dependency-vetting/SKILL.md # Supply-chain check before install
|
|
842
|
+
│ │ ├── design-review/SKILL.md # UI/UX + accessibility critique
|
|
843
|
+
│ │ ├── mcp-builder/SKILL.md # Build MCP servers with evals
|
|
844
|
+
│ │ ├── mongodb-rules/SKILL.md # Driver/StrictDB + data-modeling rules
|
|
845
|
+
│ │ └── test-writer/SKILL.md # Tests with explicit assertions
|
|
846
|
+
│ └── hooks/
|
|
847
|
+
│ ├── check-rybbit.sh # PreToolUse: block deploy without Rybbit
|
|
848
|
+
│ ├── check-branch.sh # PreToolUse: block commits on main
|
|
849
|
+
│ ├── check-ports.sh # PreToolUse: block if port in use
|
|
850
|
+
│ ├── check-e2e.sh # PreToolUse: block push without E2E tests
|
|
851
|
+
│ ├── block-dangerous-bash.py # PreToolUse: block destructive shell commands
|
|
852
|
+
│ ├── lint-on-save.sh # PostToolUse: lint after writes
|
|
853
|
+
│ ├── check-file-length.py # PostToolUse: enforce 300-line file limit
|
|
854
|
+
│ ├── verify-no-secrets.sh # Stop: scan staged files for secrets
|
|
855
|
+
│ ├── check-rulecatch.sh # Stop: report RuleCatch violations
|
|
856
|
+
│ └── check-env-sync.sh # Stop: warn on .env/.env.example drift
|
|
857
|
+
├── .mdd/ # MDD workflow directory (gitignored)
|
|
858
|
+
│ ├── docs/ # Feature documentation
|
|
859
|
+
│ └── audits/ # Audit notes, reports, results
|
|
860
|
+
├── project-docs/
|
|
861
|
+
│ ├── ARCHITECTURE.md # System overview (authoritative)
|
|
862
|
+
│ ├── INFRASTRUCTURE.md # Deployment details
|
|
863
|
+
│ └── DECISIONS.md # Architectural decision records
|
|
864
|
+
├── docs/ # GitHub Pages site
|
|
865
|
+
│ └── user-guide.html # Interactive User Guide (HTML)
|
|
866
|
+
├── src/
|
|
867
|
+
│ ├── handlers/ # Business logic
|
|
868
|
+
│ ├── adapters/ # External service adapters
|
|
869
|
+
│ └── types/ # Shared TypeScript types
|
|
870
|
+
├── scripts/
|
|
871
|
+
│ ├── db-query.ts # Test Query Master — dev/test query index
|
|
872
|
+
│ ├── queries/ # Individual dev/test query files
|
|
873
|
+
│ ├── build-content.ts # Markdown → HTML article builder
|
|
874
|
+
│ └── content.config.json # Article registry (SEO metadata)
|
|
875
|
+
├── content/ # Markdown source files for articles
|
|
876
|
+
├── tests/
|
|
877
|
+
│ ├── CHECKLIST.md # Master test tracker
|
|
878
|
+
│ ├── ISSUES_FOUND.md # User-guided testing log
|
|
879
|
+
│ ├── e2e/ # Playwright E2E tests
|
|
880
|
+
│ ├── unit/ # Vitest unit tests
|
|
881
|
+
│ └── integration/ # Integration tests
|
|
882
|
+
├── global-claude-md/ # Copy to ~/.claude/ (one-time setup)
|
|
883
|
+
│ ├── CLAUDE.md # Global security gatekeeper
|
|
884
|
+
│ └── settings.json # Global hooks config
|
|
885
|
+
├── USER_GUIDE.md # Comprehensive User Guide (Markdown)
|
|
886
|
+
├── .env.example
|
|
887
|
+
├── .gitignore
|
|
888
|
+
├── .dockerignore
|
|
889
|
+
├── package.json # All npm scripts (dev, test, db:query, etc.)
|
|
890
|
+
├── claude-mastery-project.conf # /new-project profiles + global root_dir
|
|
891
|
+
├── playwright.config.ts # E2E test config (test ports, webServer)
|
|
892
|
+
├── vitest.config.ts # Unit/integration test config
|
|
893
|
+
├── tsconfig.json
|
|
894
|
+
└── README.md
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
---
|
|
898
|
+
|
|
899
|
+
## Key Concepts
|
|
900
|
+
|
|
901
|
+
### Defense in Depth (V3)
|
|
902
|
+
|
|
903
|
+
Three layers of protection working together:
|
|
904
|
+
1. **CLAUDE.md rules** — Behavioral suggestions (weakest)
|
|
905
|
+
2. **Hooks** — Guaranteed to run, stronger than rules, but not bulletproof
|
|
906
|
+
3. **Git safety** — .gitignore as last line of defense (strongest)
|
|
907
|
+
|
|
908
|
+
### One Task, One Chat (V1-V3)
|
|
909
|
+
|
|
910
|
+
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.
|
|
911
|
+
|
|
912
|
+
### Quality Gates (V1/V2)
|
|
913
|
+
|
|
914
|
+
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.
|
|
915
|
+
|
|
916
|
+
### MCP Tool Search (V4)
|
|
917
|
+
|
|
918
|
+
With 10+ MCP servers, tool descriptions consume 50-70% of context. Tool Search lazy-loads on demand, saving **85% of context**.
|
|
919
|
+
|
|
920
|
+
### Plan First, Code Second (V5)
|
|
921
|
+
|
|
922
|
+
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.
|
|
923
|
+
|
|
924
|
+
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."
|
|
925
|
+
|
|
926
|
+
### CLAUDE.md Is Team Memory
|
|
927
|
+
|
|
928
|
+
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.
|
|
929
|
+
|
|
930
|
+
### Never Work on Main
|
|
931
|
+
|
|
932
|
+
**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.
|
|
933
|
+
|
|
934
|
+
### Every Command Enforces the Rules
|
|
935
|
+
|
|
936
|
+
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.
|
|
937
|
+
|
|
938
|
+
### TypeScript Is Non-Negotiable (V5)
|
|
939
|
+
|
|
940
|
+
Types are specs that tell Claude what functions accept and return. Without types, Claude guesses — and guesses become runtime errors.
|
|
941
|
+
|
|
942
|
+
### Windows? Use WSL Mode
|
|
943
|
+
|
|
944
|
+
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.
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
## CLAUDE.md — The Rulebook
|
|
949
|
+
|
|
950
|
+
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:
|
|
951
|
+
|
|
952
|
+
### Rule 0: NEVER Publish Sensitive Data
|
|
953
|
+
|
|
954
|
+
- NEVER commit passwords, API keys, tokens, or secrets to git/npm/docker
|
|
955
|
+
- NEVER commit `.env` files — ALWAYS verify `.env` is in `.gitignore`
|
|
956
|
+
- Before ANY commit: verify no secrets are included
|
|
957
|
+
|
|
958
|
+
### Rule 1: TypeScript Always
|
|
959
|
+
|
|
960
|
+
- ALWAYS use TypeScript for new files (strict mode)
|
|
961
|
+
- NEVER use `any` unless absolutely necessary and documented why
|
|
962
|
+
- When editing JavaScript files, convert to TypeScript first
|
|
963
|
+
- Types are specs — they tell you what functions accept and return
|
|
964
|
+
|
|
965
|
+
### Rule 2: API Versioning
|
|
966
|
+
|
|
967
|
+
```
|
|
968
|
+
CORRECT: /api/v1/users
|
|
969
|
+
WRONG: /api/users
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
Every API endpoint MUST use `/api/v1/` prefix. No exceptions.
|
|
973
|
+
|
|
974
|
+
### Rule 3: Database Access — StrictDB Only
|
|
975
|
+
|
|
976
|
+
- NEVER create direct database connections — ALWAYS use StrictDB
|
|
977
|
+
- NEVER import raw database drivers (`mongodb`, `pg`, `mysql2`) in business logic
|
|
978
|
+
- Built-in sanitization and guardrails: safe operators (`$gte`, `$in`, `$regex`) pass through, dangerous operators (`$where`, `$function`) are stripped
|
|
979
|
+
- Use `{ trusted: true }` only for non-standard operators not in the allowlist (rare)
|
|
980
|
+
- One connection pool. One place to change. One place to mock.
|
|
981
|
+
|
|
982
|
+
### Rule 4: Testing — Explicit Success Criteria
|
|
983
|
+
|
|
984
|
+
```typescript
|
|
985
|
+
// CORRECT — explicit success criteria
|
|
986
|
+
await expect(page).toHaveURL('/dashboard');
|
|
987
|
+
await expect(page.locator('h1')).toContainText('Welcome');
|
|
988
|
+
|
|
989
|
+
// WRONG — passes even if broken
|
|
990
|
+
await page.goto('/dashboard');
|
|
991
|
+
// no assertion!
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
### Rule 5: NEVER Hardcode Credentials
|
|
995
|
+
|
|
996
|
+
ALWAYS use environment variables. NEVER put API keys, passwords, or tokens directly in code. NEVER hardcode connection strings — use `STRICTDB_URI` from `.env`.
|
|
997
|
+
|
|
998
|
+
### Rule 6: ALWAYS Ask Before Deploying
|
|
999
|
+
|
|
1000
|
+
NEVER auto-deploy, even if the fix seems simple. NEVER assume approval — wait for explicit confirmation.
|
|
1001
|
+
|
|
1002
|
+
### Rule 7: Quality Gates
|
|
1003
|
+
|
|
1004
|
+
- No file > 300 lines (split if larger)
|
|
1005
|
+
- No function > 50 lines (extract helper functions)
|
|
1006
|
+
- All tests must pass before committing
|
|
1007
|
+
- TypeScript must compile with no errors (`tsc --noEmit`)
|
|
1008
|
+
|
|
1009
|
+
### Rule 8: Parallelize Independent Awaits
|
|
1010
|
+
|
|
1011
|
+
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?
|
|
1012
|
+
|
|
1013
|
+
```typescript
|
|
1014
|
+
// CORRECT — independent operations run in parallel
|
|
1015
|
+
const [users, products, orders] = await Promise.all([
|
|
1016
|
+
getUsers(),
|
|
1017
|
+
getProducts(),
|
|
1018
|
+
getOrders(),
|
|
1019
|
+
]);
|
|
1020
|
+
|
|
1021
|
+
// WRONG — sequential when they don't depend on each other
|
|
1022
|
+
const users = await getUsers();
|
|
1023
|
+
const products = await getProducts(); // waits unnecessarily
|
|
1024
|
+
const orders = await getOrders(); // waits unnecessarily
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
### Rule 9: Git Workflow — Auto-Branch on Main
|
|
1028
|
+
|
|
1029
|
+
- **Auto-branch is ON by default** — commands auto-create feature branches when on main
|
|
1030
|
+
- Branch names match the command: `refactor/<file>`, `test/<feature>`, `feat/<scope>`
|
|
1031
|
+
- Use `/worktree` for parallel sessions in separate directories
|
|
1032
|
+
- Review the full diff (`git diff main...HEAD`) before merging
|
|
1033
|
+
- If Claude screws up on a branch — delete it. Main was never touched.
|
|
1034
|
+
- Disable with `auto_branch = false` in `claude-mastery-project.conf`
|
|
1035
|
+
|
|
1036
|
+
### Rule 10: Docker Push Gate — Local Test First
|
|
1037
|
+
|
|
1038
|
+
**Disabled by default.** When enabled, NO `docker push` is allowed until the image passes local verification:
|
|
1039
|
+
|
|
1040
|
+
1. Build the image
|
|
1041
|
+
2. Run the container locally
|
|
1042
|
+
3. Verify it doesn't crash (still running after 5s)
|
|
1043
|
+
4. Health endpoint returns 200
|
|
1044
|
+
5. No fatal errors in logs
|
|
1045
|
+
6. Clean up, **then** push
|
|
1046
|
+
|
|
1047
|
+
Enable with `docker_test_before_push = true` in `claude-mastery-project.conf`. Applies to all commands that push Docker images.
|
|
1048
|
+
|
|
1049
|
+
### When Something Seems Wrong
|
|
1050
|
+
|
|
1051
|
+
The CLAUDE.md also includes a "Check Before Assuming" pattern:
|
|
1052
|
+
|
|
1053
|
+
- **Missing UI element?** → Check feature gates BEFORE assuming bug
|
|
1054
|
+
- **Empty data?** → Check if services are running BEFORE assuming broken
|
|
1055
|
+
- **404 error?** → Check service separation BEFORE adding endpoint
|
|
1056
|
+
- **Auth failing?** → Check which auth system BEFORE debugging
|
|
1057
|
+
- **Test failing?** → Read the error message fully BEFORE changing code
|
|
1058
|
+
|
|
1059
|
+
### Fixed Service Ports
|
|
1060
|
+
|
|
1061
|
+
| Service | Dev Port | Test Port |
|
|
1062
|
+
|---------|----------|-----------|
|
|
1063
|
+
| Website | 3000 | 4000 |
|
|
1064
|
+
| API | 3001 | 4010 |
|
|
1065
|
+
| Dashboard | 3002 | 4020 |
|
|
1066
|
+
|
|
1067
|
+
---
|
|
1068
|
+
|
|
1069
|
+
## Hooks — Stronger Than Rules
|
|
1070
|
+
|
|
1071
|
+
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.
|
|
1072
|
+
|
|
1073
|
+
### PreToolUse: `block-dangerous-bash.py`
|
|
1074
|
+
|
|
1075
|
+
Runs **before** any Bash command. Blocks destructive operations before they execute — recursive deletes of home/root, pipe-to-shell installs, force-pushes to main, world-writable permissions, database drops, and staging a `.env` secrets file.
|
|
1076
|
+
|
|
1077
|
+
```python
|
|
1078
|
+
# Command patterns that should never run
|
|
1079
|
+
DANGEROUS = [
|
|
1080
|
+
r'rm\s+-rf\s+[~/]', # recursive delete of home/root
|
|
1081
|
+
r'curl[^|]*\|\s*(sudo\s+)?sh', # pipe-to-shell install
|
|
1082
|
+
r'git\s+push\s+.*--force.*\b(main|master)\b', # force-push protected branch
|
|
1083
|
+
r'chmod\s+777', # world-writable
|
|
1084
|
+
r'git\s+add\s+(\.|.*\.env)\b', # staging a secrets file
|
|
1085
|
+
]
|
|
1086
|
+
|
|
1087
|
+
# Exit code 2 = block operation and tell Claude why
|
|
1088
|
+
if matches_any(command, DANGEROUS):
|
|
1089
|
+
print(f"BLOCKED: refusing to run '{command}'.", file=sys.stderr)
|
|
1090
|
+
sys.exit(2)
|
|
1091
|
+
```
|
|
1092
|
+
|
|
1093
|
+
> Note: this is a publish-time guard, not a read guard. Reading `.env` is how the app legitimately gets its config; the risk is *committing or exfiltrating* secrets, which `verify-no-secrets.sh` (on Stop) and the `git add .env` rule above cover.
|
|
1094
|
+
|
|
1095
|
+
### PostToolUse: `check-file-length.py`
|
|
1096
|
+
|
|
1097
|
+
Runs **after** Claude writes or edits a file. Flags source files over 300 lines — the point where a file is usually doing too much and should be split — so the codebase stays modular as Claude builds.
|
|
1098
|
+
|
|
1099
|
+
### PreToolUse: `check-rybbit.sh`
|
|
1100
|
+
|
|
1101
|
+
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 https://app.rybbit.io if missing. Skips projects that don't use Rybbit.
|
|
1102
|
+
|
|
1103
|
+
### PreToolUse: `check-branch.sh`
|
|
1104
|
+
|
|
1105
|
+
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`.
|
|
1106
|
+
|
|
1107
|
+
### PreToolUse: `check-ports.sh`
|
|
1108
|
+
|
|
1109
|
+
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.
|
|
1110
|
+
|
|
1111
|
+
### PreToolUse: `check-e2e.sh`
|
|
1112
|
+
|
|
1113
|
+
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.
|
|
1114
|
+
|
|
1115
|
+
### PostToolUse: `lint-on-save.sh`
|
|
1116
|
+
|
|
1117
|
+
Runs **after** Claude writes or edits a file. Automatically checks TypeScript compilation, ESLint, or Python linting depending on file extension.
|
|
1118
|
+
|
|
1119
|
+
```bash
|
|
1120
|
+
case "$EXTENSION" in
|
|
1121
|
+
ts|tsx)
|
|
1122
|
+
npx tsc --noEmit --pretty "$FILE_PATH" 2>&1 | head -20
|
|
1123
|
+
;;
|
|
1124
|
+
js|jsx)
|
|
1125
|
+
npx eslint "$FILE_PATH" 2>&1 | head -20
|
|
1126
|
+
;;
|
|
1127
|
+
py)
|
|
1128
|
+
ruff check "$FILE_PATH" 2>&1 | head -20
|
|
1129
|
+
;;
|
|
1130
|
+
esac
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
### Stop: `verify-no-secrets.sh`
|
|
1134
|
+
|
|
1135
|
+
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.
|
|
1136
|
+
|
|
1137
|
+
```bash
|
|
1138
|
+
# Check staged file contents for common secret patterns
|
|
1139
|
+
if grep -qEi '(api[_-]?key|secret[_-]?key|password|token)\s*[:=]\s*["\x27][A-Za-z0-9+/=_-]{16,}' "$file"; then
|
|
1140
|
+
VIOLATIONS="${VIOLATIONS}\n - POSSIBLE SECRET in $file"
|
|
1141
|
+
fi
|
|
1142
|
+
# Check for AWS keys
|
|
1143
|
+
if grep -qE 'AKIA[0-9A-Z]{16}' "$file"; then
|
|
1144
|
+
VIOLATIONS="${VIOLATIONS}\n - AWS ACCESS KEY in $file"
|
|
1145
|
+
fi
|
|
1146
|
+
```
|
|
1147
|
+
|
|
1148
|
+
### Stop: `check-rulecatch.sh`
|
|
1149
|
+
|
|
1150
|
+
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.
|
|
1151
|
+
|
|
1152
|
+
### Stop: `check-env-sync.sh`
|
|
1153
|
+
|
|
1154
|
+
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.
|
|
1155
|
+
|
|
1156
|
+
### Hook Configuration
|
|
1157
|
+
|
|
1158
|
+
Hooks are wired up in `.claude/settings.json`:
|
|
1159
|
+
|
|
1160
|
+
```json
|
|
1161
|
+
{
|
|
1162
|
+
"hooks": {
|
|
1163
|
+
"PreToolUse": [
|
|
1164
|
+
{
|
|
1165
|
+
"matcher": "Bash",
|
|
1166
|
+
"hooks": [
|
|
1167
|
+
{ "type": "command", "command": "bash .claude/hooks/check-rybbit.sh" },
|
|
1168
|
+
{ "type": "command", "command": "bash .claude/hooks/check-branch.sh" },
|
|
1169
|
+
{ "type": "command", "command": "bash .claude/hooks/check-ports.sh" },
|
|
1170
|
+
{ "type": "command", "command": "bash .claude/hooks/check-e2e.sh" },
|
|
1171
|
+
{ "type": "command", "command": "python3 .claude/hooks/block-dangerous-bash.py" }
|
|
1172
|
+
]
|
|
1173
|
+
}
|
|
1174
|
+
],
|
|
1175
|
+
"PostToolUse": [{
|
|
1176
|
+
"matcher": "Write|Edit",
|
|
1177
|
+
"hooks": [
|
|
1178
|
+
{ "type": "command", "command": "bash .claude/hooks/lint-on-save.sh" },
|
|
1179
|
+
{ "type": "command", "command": "python3 .claude/hooks/check-file-length.py" }
|
|
1180
|
+
]
|
|
1181
|
+
}],
|
|
1182
|
+
"Stop": [{
|
|
1183
|
+
"hooks": [
|
|
1184
|
+
{ "type": "command", "command": "bash .claude/hooks/verify-no-secrets.sh" },
|
|
1185
|
+
{ "type": "command", "command": "bash .claude/hooks/check-rulecatch.sh" },
|
|
1186
|
+
{ "type": "command", "command": "bash .claude/hooks/check-env-sync.sh" }
|
|
1187
|
+
]
|
|
1188
|
+
}]
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
---
|
|
1194
|
+
|
|
1195
|
+
## Slash Commands — On-Demand Tools
|
|
1196
|
+
|
|
1197
|
+
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.
|
|
1198
|
+
|
|
1199
|
+
### `/mdd`
|
|
1200
|
+
|
|
1201
|
+
The core MDD workflow command. Ten modes in one:
|
|
1202
|
+
|
|
1203
|
+
- **`/mdd <feature description>`** — Build mode. Context-adaptive interview → documentation → test skeletons → named build plan → implementation → verification. Tests are generated before code. Claude presents a plan with time estimates and waits for approval.
|
|
1204
|
+
- **`/mdd task <description>`** — Task mode. Identical to Build mode, but stamps the doc with `type: task` — frozen after completion, never appears as drifted in `/mdd scan`. Use for one-off investigations, refactors, or any work that is done-and-finished by definition.
|
|
1205
|
+
- **`/mdd audit [section]`** — Audit mode. Reads all source files, writes incremental notes (survives compaction), produces a severity-rated findings report, and fixes everything. Works on the whole project or a specific section.
|
|
1206
|
+
- **`/mdd status`** — Quick overview of feature docs, last audit date, test coverage, open findings, quality gate violations, and a lightweight drift summary.
|
|
1207
|
+
- **`/mdd scan`** — Drift detection. Uses `git log` to find source files that changed since each feature doc's `last_synced` date. Flags drifted, broken, and untracked features.
|
|
1208
|
+
- **`/mdd update <feature-id>`** — Re-sync an existing feature doc after code changes. Diffs code vs doc, rewrites affected sections, appends new test skeletons, updates `last_synced`.
|
|
1209
|
+
- **`/mdd reverse-engineer [path|id]`** — Generate MDD docs from existing code, or regenerate + compare against an existing doc. Always shows diff in regenerate mode.
|
|
1210
|
+
- **`/mdd graph`** — ASCII dependency map from `depends_on` fields, with broken and risky dependency warnings.
|
|
1211
|
+
- **`/mdd deprecate <feature-id>`** — Archive a feature: move doc to `.mdd/docs/archive/`, flag dependents, optionally delete source and test files.
|
|
1212
|
+
- **`/mdd upgrade`** — Batch-patch missing `last_synced`/`status`/`phase` frontmatter across all docs. The fix when the MDD Dashboard shows all docs as UNTRACKED (❓). Non-destructive; shows plan before writing.
|
|
1213
|
+
- **`/mdd commands`** — Print a reference table of every MDD mode and what it does. Output is derived from the mode-detection block in `mdd.md` so it stays in sync as new modes are added.
|
|
1214
|
+
|
|
1215
|
+
All artifacts are stored in `.mdd/` (docs in `.mdd/docs/`, audit reports in `.mdd/audits/`). See the [MDD Workflow](#mdd-workflow--manual-first-development--new) section above for full details and real results.
|
|
1216
|
+
|
|
1217
|
+
### `/help`
|
|
1218
|
+
|
|
1219
|
+
Lists every command and skill in the starter kit, grouped by category: Getting Started, Project Scaffold, Code Quality, Development, Infrastructure, and Monitoring. Also shows skill triggers. Run `/help` anytime to see what's available.
|
|
1220
|
+
|
|
1221
|
+
### `/quickstart`
|
|
1222
|
+
|
|
1223
|
+
Interactive first-run walkthrough for new users. Checks if global config is installed, asks for a project name and profile preference, then walks you through the first 5 minutes: scaffolding, setup, first dev server, first review, first commit. Designed for someone who just cloned the starter kit and doesn't know where to start.
|
|
1224
|
+
|
|
1225
|
+
### `/diagram`
|
|
1226
|
+
|
|
1227
|
+
Scans your actual code and generates ASCII diagrams automatically:
|
|
1228
|
+
|
|
1229
|
+
- `/diagram architecture` — services, connections, data flow (scans src/, routes, adapters)
|
|
1230
|
+
- `/diagram api` — all API endpoints grouped by resource with handler locations
|
|
1231
|
+
- `/diagram database` — collections, indexes, relationships (scans queries + types)
|
|
1232
|
+
- `/diagram infrastructure` — deployment topology, regions, containers (scans .env + Docker)
|
|
1233
|
+
- `/diagram all` — generate everything at once
|
|
1234
|
+
|
|
1235
|
+
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.
|
|
1236
|
+
|
|
1237
|
+
### `/install-global` ⭐ Recommended for MDD
|
|
1238
|
+
|
|
1239
|
+
One-time setup: installs the starter kit's global Claude config into `~/.claude/`. Also asks if you want to install MDD globally — **say yes**.
|
|
1240
|
+
|
|
1241
|
+
**Why global is the right choice for MDD:**
|
|
1242
|
+
- `/mdd` becomes available in **every project** on your machine — no per-project setup
|
|
1243
|
+
- Update the starter kit once → all projects automatically use the latest `/mdd` version on the next session
|
|
1244
|
+
- First `/mdd` run in any project **auto-bootstraps** the `.mdd/` structure (docs, audits, `.startup.md`, gitignore entry) — no separate `/install-mdd` needed
|
|
1245
|
+
- One place to maintain, one place to update
|
|
1246
|
+
|
|
1247
|
+
```bash
|
|
1248
|
+
/install-global # answer "yes" to the MDD global install prompt
|
|
1249
|
+
/install-global mdd # update only the global MDD commands — skips everything else
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1252
|
+
The `mdd` parameter installs or updates the `@thedecipherist/mdd` npm package and runs `mdd install` to deploy the latest Claude commands to `~/.claude/commands/`. Nothing else is touched.
|
|
1253
|
+
|
|
1254
|
+
Then in any project, just run:
|
|
1255
|
+
```bash
|
|
1256
|
+
/mdd <feature> # .mdd/ structure is created automatically on first use
|
|
1257
|
+
```
|
|
1258
|
+
|
|
1259
|
+
Other things `/install-global` installs:
|
|
1260
|
+
- **Smart merge** — if you already have a global `CLAUDE.md`, it appends missing sections without overwriting yours
|
|
1261
|
+
- **settings.json** — merges deny rules and hooks (never removes existing ones)
|
|
1262
|
+
- **Hooks** — copies `verify-no-secrets.sh` and `check-rulecatch.sh` to `~/.claude/hooks/`
|
|
1263
|
+
|
|
1264
|
+
Reports exactly what was added, skipped, and merged. Your existing config is never overwritten.
|
|
1265
|
+
|
|
1266
|
+
### `/install-mdd [path]`
|
|
1267
|
+
|
|
1268
|
+
Install the MDD workflow into a specific project explicitly — copies the `/mdd` slash command and scaffolds the `.mdd/` structure. Use this when you want the structure set up upfront (e.g. before a team session, or to configure gitignore before the first run). If you've already installed MDD globally, you don't need this — `/mdd` bootstraps itself.
|
|
1269
|
+
|
|
1270
|
+
```bash
|
|
1271
|
+
/install-mdd # install into current project
|
|
1272
|
+
/install-mdd /path/to/other-project # install into a specific path
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
### `/setup`
|
|
1276
|
+
|
|
1277
|
+
Interactive project configuration. Walks you through setting up your `.env` with real values:
|
|
1278
|
+
|
|
1279
|
+
- **Multi-region** — US + EU with isolated databases, VPS, and Dokploy per region
|
|
1280
|
+
- **Database** — MongoDB/PostgreSQL per region (`STRICTDB_URI_US`, `STRICTDB_URI_EU`)
|
|
1281
|
+
- **Deployment** — Dokploy on Hostinger VPS per region (IP, API key, app ID, webhook token)
|
|
1282
|
+
- **Docker** — Hub username, image name, region tagging (`:latest` for US, `:eu` for EU)
|
|
1283
|
+
- **GitHub** — username, SSH vs HTTPS
|
|
1284
|
+
- **Analytics** — Rybbit site ID
|
|
1285
|
+
- **RuleCatch** — API key, region
|
|
1286
|
+
- **Auth** — auto-generates JWT secret
|
|
1287
|
+
|
|
1288
|
+
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.
|
|
1289
|
+
|
|
1290
|
+
Skips variables that already have values. Use `/setup --reset` to re-configure everything. Never displays secrets back to you. Keeps `.env.example` in sync.
|
|
1291
|
+
|
|
1292
|
+
### `/what-is-my-ai-doing`
|
|
1293
|
+
|
|
1294
|
+
Launches the RuleCatch AI-Pooler live monitor in a **separate terminal**. Free monitor mode works instantly — no API key, no account, no setup required.
|
|
1295
|
+
|
|
1296
|
+
- Every tool call (Read, Write, Edit, Bash)
|
|
1297
|
+
- Token usage and cost per turn
|
|
1298
|
+
- Which files are being accessed
|
|
1299
|
+
- Cost per session
|
|
1300
|
+
|
|
1301
|
+
```bash
|
|
1302
|
+
# Run in a separate terminal — works immediately, no setup
|
|
1303
|
+
npx @rulecatch/ai-pooler monitor --no-api-key
|
|
1304
|
+
```
|
|
1305
|
+
|
|
1306
|
+
Zero token overhead — runs completely outside Claude's context. Also available as `pnpm ai:monitor`.
|
|
1307
|
+
|
|
1308
|
+
> **Want more?** With a [RuleCatch.AI](https://rulecatch.ai) API key you also get violation tracking, dashboards, trend reports, and the MCP server so Claude can query its own violations. See the [Monitor Your Rules](#monitor-your-rules-with-rulecatchai-optional) section below.
|
|
1309
|
+
|
|
1310
|
+
### `/review`
|
|
1311
|
+
|
|
1312
|
+
Systematic code review against a 7-point checklist:
|
|
1313
|
+
|
|
1314
|
+
1. **Security** — OWASP Top 10, no secrets in code
|
|
1315
|
+
2. **Types** — No `any`, proper null handling
|
|
1316
|
+
3. **Error Handling** — No swallowed errors
|
|
1317
|
+
4. **Performance** — No N+1 queries, no memory leaks
|
|
1318
|
+
5. **Testing** — New code has explicit assertions
|
|
1319
|
+
6. **Database** — Using StrictDB correctly
|
|
1320
|
+
7. **API Versioning** — All endpoints use `/api/v1/`
|
|
1321
|
+
|
|
1322
|
+
Issues are reported with severity (Critical / Warning / Info), file:line references, and suggested fixes.
|
|
1323
|
+
|
|
1324
|
+
### `/commit`
|
|
1325
|
+
|
|
1326
|
+
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.
|
|
1327
|
+
|
|
1328
|
+
### `/test-plan`
|
|
1329
|
+
|
|
1330
|
+
Generates a structured test plan for any feature with prerequisites, happy path scenarios with specific expected outcomes, error cases and edge cases, pass/fail criteria table, and sign-off tracker.
|
|
1331
|
+
|
|
1332
|
+
### `/security-check`
|
|
1333
|
+
|
|
1334
|
+
Scans the project for security vulnerabilities: secrets in code, `.gitignore` coverage, sensitive files tracked by git, `.env` handling audit, and dependency vulnerability scan (`npm audit`).
|
|
1335
|
+
|
|
1336
|
+
### `/progress`
|
|
1337
|
+
|
|
1338
|
+
Checks the actual filesystem state and reports project status — source file counts by type, test coverage, recent git activity, and prioritized next actions.
|
|
1339
|
+
|
|
1340
|
+
### `/architecture`
|
|
1341
|
+
|
|
1342
|
+
Reads `project-docs/ARCHITECTURE.md` and displays the system overview, data flow diagrams, and service responsibility maps. If docs don't exist, scaffolds them.
|
|
1343
|
+
|
|
1344
|
+
### `/worktree`
|
|
1345
|
+
|
|
1346
|
+
Creates an isolated git worktree + branch for a task:
|
|
1347
|
+
|
|
1348
|
+
```bash
|
|
1349
|
+
/worktree add-auth # → task/add-auth branch
|
|
1350
|
+
/worktree feat/new-dashboard # → uses prefix as-is
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
Each task gets its own branch and its own directory. Main stays untouched. Enables running **multiple Claude sessions in parallel** without conflicts. When done: merge into main (or open a PR), then `git worktree remove`.
|
|
1354
|
+
|
|
1355
|
+
### `/optimize-docker`
|
|
1356
|
+
|
|
1357
|
+
Audits your Dockerfile against 12 production best practices: multi-stage builds, layer caching, Alpine base images, non-root user, .dockerignore coverage, frozen lockfile, health checks, no secrets in build args, and pinned versions. Generates an optimized Dockerfile with before/after image size comparison.
|
|
1358
|
+
|
|
1359
|
+
### `/set-project-profile-default`
|
|
1360
|
+
|
|
1361
|
+
Sets the default profile for `/new-project`. Accepts any profile name: `clean`, `default`, `go`, `vue`, `python-api`, etc. Also supports shorthand to create a custom default: `/set-project-profile-default mongo next tailwind docker` creates a `[user-default]` profile with those settings.
|
|
1362
|
+
|
|
1363
|
+
### `/add-project-setup`
|
|
1364
|
+
|
|
1365
|
+
Interactive wizard that walks you through creating a named profile in `claude-mastery-project.conf`. Asks about language, framework, database, hosting, package manager, analytics, options, and MCP servers. The new profile can then be used with `/new-project my-app <profile-name>`.
|
|
1366
|
+
|
|
1367
|
+
### `/projects-created`
|
|
1368
|
+
|
|
1369
|
+
Lists every project scaffolded by `/new-project`, with creation date, profile used, language, framework, database, and location. Checks which projects still exist on disk and marks missing ones. Data is stored in `~/.claude/starter-kit-projects.json` (global — shared across all starter kit instances).
|
|
1370
|
+
|
|
1371
|
+
### `/remove-project`
|
|
1372
|
+
|
|
1373
|
+
Removes a project from the starter kit registry and optionally deletes its files from disk. Shows project details before taking action. Two options: remove from registry only (keep files) or delete everything (with safety checks for uncommitted git changes). Always asks for explicit confirmation before deleting.
|
|
1374
|
+
|
|
1375
|
+
### `/convert-project-to-starter-kit`
|
|
1376
|
+
|
|
1377
|
+
Merges all starter kit infrastructure into an existing project without destroying anything. Creates a safety commit first, detects your language and existing Claude setup, then asks how to handle conflicts (keep yours, replace, or choose per file). Copies commands, hooks, skills, merges CLAUDE.md sections, deep-merges settings.json hooks, and adds infrastructure files (.gitignore, .env.example, project-docs templates). Registers the project so it appears in `/projects-created`. Use `--force` to skip prompts and use "keep existing, add missing" for everything. Undo with `git revert HEAD`.
|
|
1378
|
+
|
|
1379
|
+
```bash
|
|
1380
|
+
/convert-project-to-starter-kit ~/projects/my-app
|
|
1381
|
+
/convert-project-to-starter-kit ~/projects/my-app --force
|
|
1382
|
+
```
|
|
1383
|
+
|
|
1384
|
+
### `/update-project`
|
|
1385
|
+
|
|
1386
|
+
Updates an existing starter-kit project with the latest commands, hooks, skills, and rules from the current starter kit source. Smart merge — replaces starter kit files with newer versions while preserving any custom files the user created. Shows a diff report before applying. Creates a safety commit first so you can `git revert HEAD` to undo.
|
|
1387
|
+
|
|
1388
|
+
```bash
|
|
1389
|
+
/update-project # Pick from registered projects
|
|
1390
|
+
/update-project --force # Skip confirmation prompts
|
|
1391
|
+
```
|
|
1392
|
+
|
|
1393
|
+
### `/add-feature`
|
|
1394
|
+
|
|
1395
|
+
Add capabilities (MongoDB, Docker, testing, etc.) to an existing project after scaffolding. Idempotent — safely updates already-installed features to the latest version. Maintains a feature manifest (`.claude/features.json`) so `/update-project` can sync feature files too.
|
|
1396
|
+
|
|
1397
|
+
```bash
|
|
1398
|
+
/add-feature mongo # Add StrictDB + query system (MongoDB backend)
|
|
1399
|
+
/add-feature vitest playwright # Add both test frameworks
|
|
1400
|
+
/add-feature --list # Show all available features
|
|
1401
|
+
```
|
|
1402
|
+
|
|
1403
|
+
### `/create-e2e`
|
|
1404
|
+
|
|
1405
|
+
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 before finishing.
|
|
1406
|
+
|
|
1407
|
+
### `/create-api`
|
|
1408
|
+
|
|
1409
|
+
Scaffolds a production-ready API endpoint with full CRUD:
|
|
1410
|
+
|
|
1411
|
+
- **Types** — `src/types/<resource>.ts` (document, request, response shapes)
|
|
1412
|
+
- **Handler** — `src/handlers/<resource>.ts` (business logic, indexes, CRUD)
|
|
1413
|
+
- **Route** — `src/routes/v1/<resource>.ts` (thin routes, proper HTTP status codes)
|
|
1414
|
+
- **Tests** — `tests/unit/<resource>.test.ts` (happy path, error cases, edge cases)
|
|
1415
|
+
|
|
1416
|
+
Uses StrictDB with shared pool, auto-sanitized inputs, pagination (max 100), registered indexes, and `/api/v1/` prefix. Pass `--no-mongo` to skip database integration.
|
|
1417
|
+
|
|
1418
|
+
### `/refactor`
|
|
1419
|
+
|
|
1420
|
+
Audit + refactor any file against **every rule** in CLAUDE.md:
|
|
1421
|
+
|
|
1422
|
+
1. **Branch check** — verifies you're not on main (suggests `/worktree`)
|
|
1423
|
+
2. **File size** — >300 lines = must split
|
|
1424
|
+
3. **Function size** — >50 lines = must extract
|
|
1425
|
+
4. **TypeScript** — no `any`, explicit types, strict mode
|
|
1426
|
+
5. **Import hygiene** — no barrel imports, proper `import type`
|
|
1427
|
+
6. **Error handling** — no swallowed errors, proper logging
|
|
1428
|
+
7. **Database access** — StrictDB only
|
|
1429
|
+
8. **API routes** — `/api/v1/` prefix
|
|
1430
|
+
9. **Promise.all** — parallelize independent awaits
|
|
1431
|
+
10. **Security + dead code** — no secrets, no unused code
|
|
1432
|
+
|
|
1433
|
+
Presents a **named-step plan** before making changes. Splits files by type (types → `src/types/`, validation → colocated, helpers → colocated). Updates all imports across the project.
|
|
1434
|
+
|
|
1435
|
+
```bash
|
|
1436
|
+
/refactor src/handlers/users.ts
|
|
1437
|
+
/refactor src/server.ts --dry-run # report only, no changes
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
### `/new-project`
|
|
1441
|
+
|
|
1442
|
+
Full project scaffolding with profiles:
|
|
1443
|
+
|
|
1444
|
+
```bash
|
|
1445
|
+
/new-project my-app clean
|
|
1446
|
+
/new-project my-app default
|
|
1447
|
+
/new-project my-app fullstack next dokploy seo tailwind pnpm
|
|
1448
|
+
/new-project my-api api fastify dokploy docker multiregion
|
|
1449
|
+
/new-project my-site static-site
|
|
1450
|
+
/new-project my-api go # Go API with Gin, MongoDB, Docker
|
|
1451
|
+
/new-project my-api go chi postgres # Go with Chi, PostgreSQL
|
|
1452
|
+
/new-project my-cli go cli # Go CLI with Cobra
|
|
1453
|
+
/new-project my-app vue # Vue 3 SPA with Tailwind
|
|
1454
|
+
/new-project my-app nuxt # Nuxt full-stack with MongoDB, Docker
|
|
1455
|
+
/new-project my-app sveltekit # SvelteKit full-stack
|
|
1456
|
+
/new-project my-api python-api # FastAPI with PostgreSQL, Docker
|
|
1457
|
+
/new-project my-app django # Django full-stack
|
|
1458
|
+
```
|
|
1459
|
+
|
|
1460
|
+
**`clean`** — All Claude infrastructure (commands, skills, hooks, project-docs, tests templates) with **zero coding opinions**. No TypeScript enforcement, no port assignments, no database setup, no quality gates. Your project, your rules — Claude just works.
|
|
1461
|
+
|
|
1462
|
+
**`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.
|
|
1463
|
+
|
|
1464
|
+
**`default`** and other profiles — Full opinionated scaffolding with project type, framework, SSR, hosting (Dokploy/Vercel/static), package manager, database, extras (Tailwind, Prisma, Docker, CI), and MCP servers. Use `claude-mastery-project.conf` to save your preferred stack.
|
|
1465
|
+
|
|
1466
|
+
---
|
|
1467
|
+
|
|
1468
|
+
## Skills — Triggered Expertise
|
|
1469
|
+
|
|
1470
|
+
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.
|
|
1471
|
+
|
|
1472
|
+
### What Triggers Skills?
|
|
1473
|
+
|
|
1474
|
+
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.
|
|
1475
|
+
|
|
1476
|
+
| Skill | Trigger Keywords | What It Does |
|
|
1477
|
+
|-------|-----------------|--------------|
|
|
1478
|
+
| Code Review | `review`, `audit`, `check code`, `security review` | Loads a systematic 7-point review checklist with severity ratings |
|
|
1479
|
+
| Create Service | `create service`, `new service`, `scaffold service` | Scaffolds a microservice with server/handlers/adapters pattern |
|
|
1480
|
+
|
|
1481
|
+
### How to Activate Skills
|
|
1482
|
+
|
|
1483
|
+
**You don't** — just use natural language. Say things like:
|
|
1484
|
+
|
|
1485
|
+
- "Review this file for security issues" → Code Review skill activates
|
|
1486
|
+
- "Audit the authentication module" → Code Review skill activates
|
|
1487
|
+
- "Create a new payment service" → Create Service skill activates
|
|
1488
|
+
- "Scaffold a notification service" → Create Service skill activates
|
|
1489
|
+
|
|
1490
|
+
### Skills vs Commands
|
|
1491
|
+
|
|
1492
|
+
| | Skills | Commands |
|
|
1493
|
+
|---|--------|---------|
|
|
1494
|
+
| **How to use** | Automatic — just use natural language | Explicit — type `/command` |
|
|
1495
|
+
| **When they load** | When Claude detects trigger keywords | When you invoke them |
|
|
1496
|
+
| **Example** | "Review this code" | `/review` |
|
|
1497
|
+
| **Best for** | Organic, conversational workflows | Deliberate, specific actions |
|
|
1498
|
+
|
|
1499
|
+
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.
|
|
1500
|
+
|
|
1501
|
+
### Code Review Skill
|
|
1502
|
+
|
|
1503
|
+
**Triggers:** `review`, `audit`, `check code`, `security review`
|
|
1504
|
+
|
|
1505
|
+
A systematic review checklist covering 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 usage, API versioning, service separation). Each issue is reported with severity, location, fix, and **why it matters**.
|
|
1506
|
+
|
|
1507
|
+
### Create Service Skill
|
|
1508
|
+
|
|
1509
|
+
**Triggers:** `create service`, `new service`, `scaffold service`
|
|
1510
|
+
|
|
1511
|
+
Generates a complete microservice following the server/handlers/adapters separation pattern:
|
|
1512
|
+
|
|
1513
|
+
```
|
|
1514
|
+
┌─────────────────────────────────────────────────────┐
|
|
1515
|
+
│ YOUR SERVICE │
|
|
1516
|
+
├─────────────────────────────────────────────────────┤
|
|
1517
|
+
│ SERVER (server.ts) │
|
|
1518
|
+
│ → Express/Fastify entry point, defines routes │
|
|
1519
|
+
│ → NEVER contains business logic │
|
|
1520
|
+
│ │ │
|
|
1521
|
+
│ ▼ │
|
|
1522
|
+
│ HANDLERS (handlers/) │
|
|
1523
|
+
│ → Business logic lives here │
|
|
1524
|
+
│ → One file per domain │
|
|
1525
|
+
│ │ │
|
|
1526
|
+
│ ▼ │
|
|
1527
|
+
│ ADAPTERS (adapters/) │
|
|
1528
|
+
│ → External service adapters │
|
|
1529
|
+
│ → Database, APIs, etc. │
|
|
1530
|
+
└─────────────────────────────────────────────────────┘
|
|
1531
|
+
```
|
|
1532
|
+
|
|
1533
|
+
Includes `package.json`, `tsconfig.json`, entry point with error handlers, health check endpoint, and a post-creation verification checklist.
|
|
1534
|
+
|
|
1535
|
+
### Debugger Skill
|
|
1536
|
+
|
|
1537
|
+
**Triggers:** `crash`, `stack trace`, `bug`, `fails in prod`, `root cause`
|
|
1538
|
+
|
|
1539
|
+
Diagnoses failures by root cause instead of symptom — reads the error, traces it to the actual fault, and proposes the minimal fix. Read-only, so it can't paper over a bug by editing around it.
|
|
1540
|
+
|
|
1541
|
+
### Design Review Skill
|
|
1542
|
+
|
|
1543
|
+
**Triggers:** `review UI`, `design feedback`, `layout`, `accessibility`, `does this look right`
|
|
1544
|
+
|
|
1545
|
+
Critiques UI/UX for usability, visual hierarchy, accessibility (contrast, focus states, semantics), and whether the result reads as intentional rather than templated. Read-only.
|
|
1546
|
+
|
|
1547
|
+
### Test Writer Skill
|
|
1548
|
+
|
|
1549
|
+
**Triggers:** `write tests`, `add a test`, `cover this`
|
|
1550
|
+
|
|
1551
|
+
Writes tests that CATCH BUGS, not tests that just pass. Every test has explicit assertions ("page loads" is not a test), tests behavior rather than implementation, covers happy path / error cases / edge cases, uses realistic data instead of `"test"`/`"asdf"`, and stays independent with no shared mutable state.
|
|
1552
|
+
|
|
1553
|
+
```typescript
|
|
1554
|
+
// GOOD — explicit, specific assertions
|
|
1555
|
+
expect(result.status).toBe(200);
|
|
1556
|
+
expect(result.body.user.email).toBe('test@example.com');
|
|
1557
|
+
|
|
1558
|
+
// BAD — passes even when broken
|
|
1559
|
+
expect(result).toBeTruthy(); // too vague
|
|
1560
|
+
```
|
|
1561
|
+
|
|
1562
|
+
### API Conventions Skill
|
|
1563
|
+
|
|
1564
|
+
**Triggers:** writing routes, handlers, or adapters
|
|
1565
|
+
|
|
1566
|
+
Service structure conventions — where routing, layering, and code placement go — so a service keeps the server/handlers/adapters separation instead of drifting into one oversized file.
|
|
1567
|
+
|
|
1568
|
+
### MongoDB Rules Skill
|
|
1569
|
+
|
|
1570
|
+
**Triggers:** queries, aggregations, indexes, connections, schema
|
|
1571
|
+
|
|
1572
|
+
The data-layer rulebook: one shared client, ObjectId/Date type round-trips, null-vs-missing, ESR index ordering, `bulkWrite` for multi-document writes, aggregation over `find`, and StrictDB when installed (native driver otherwise, never Mongoose).
|
|
1573
|
+
|
|
1574
|
+
### MCP Builder Skill
|
|
1575
|
+
|
|
1576
|
+
**Triggers:** `MCP server`, `expose as tools`, `wrap this API`
|
|
1577
|
+
|
|
1578
|
+
Builds an MCP server with well-designed tools, clear input schemas, and evals — so the tools are actually usable by an agent, not a thin wrapper over an API. Invoked explicitly.
|
|
1579
|
+
|
|
1580
|
+
### Dependency Vetting Skill
|
|
1581
|
+
|
|
1582
|
+
**Triggers:** `is this package safe`, `should I add`, `can I trust`
|
|
1583
|
+
|
|
1584
|
+
Vets a package for supply-chain risk before you install it — install scripts, network calls, maintainer and download signals, and manifest-vs-reality mismatches. Read-only.
|
|
1585
|
+
|
|
1586
|
+
---
|
|
1587
|
+
|
|
1588
|
+
## Database — StrictDB (if installed) or the native driver
|
|
1589
|
+
|
|
1590
|
+
When **StrictDB** is installed (it supports MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, and Elasticsearch), the kit routes database access through it — it enforces the best practices that prevent the most common database failures in AI-assisted development. When StrictDB isn't installed, the kit uses the **native database driver directly**. Either way, one rule never bends: **no ODM/ORM like Mongoose.**
|
|
1591
|
+
|
|
1592
|
+
### The Rule
|
|
1593
|
+
|
|
1594
|
+
If StrictDB is present, route all database access through it. If it isn't, use the native driver directly — never wrap it in Mongoose or another ODM, and never scatter ad-hoc connections through business logic.
|
|
1595
|
+
|
|
1596
|
+
```typescript
|
|
1597
|
+
// If StrictDB is installed — use it
|
|
1598
|
+
import { queryOne, insertOne, updateOne } from 'strictdb';
|
|
1599
|
+
|
|
1600
|
+
// Otherwise — the native driver, directly
|
|
1601
|
+
import { MongoClient } from 'mongodb';
|
|
1602
|
+
|
|
1603
|
+
// NEVER — no ODM/ORM, regardless of which of the above you're on
|
|
1604
|
+
import mongoose from 'mongoose'; // FORBIDDEN
|
|
1605
|
+
```
|
|
1606
|
+
|
|
1607
|
+
### Reading Data — Aggregation Only
|
|
1608
|
+
|
|
1609
|
+
```typescript
|
|
1610
|
+
// Single document (automatic $limit: 1)
|
|
1611
|
+
const user = await queryOne<User>('users', { email });
|
|
1612
|
+
|
|
1613
|
+
// Pipeline query
|
|
1614
|
+
const recent = await queryMany<Order>('orders', [
|
|
1615
|
+
{ $match: { userId, status: 'active' } },
|
|
1616
|
+
{ $sort: { createdAt: -1 } },
|
|
1617
|
+
{ $limit: 20 },
|
|
1618
|
+
]);
|
|
1619
|
+
|
|
1620
|
+
// Join — $limit enforced BEFORE $lookup automatically
|
|
1621
|
+
const userWithOrders = await queryWithLookup<UserWithOrders>('users', {
|
|
1622
|
+
match: { _id: userId },
|
|
1623
|
+
lookup: { from: 'orders', localField: '_id', foreignField: 'userId', as: 'orders' },
|
|
1624
|
+
});
|
|
1625
|
+
```
|
|
1626
|
+
|
|
1627
|
+
### Writing Data — BulkWrite Only
|
|
1628
|
+
|
|
1629
|
+
```typescript
|
|
1630
|
+
// Insert
|
|
1631
|
+
await insertOne('users', { email, name, createdAt: new Date() });
|
|
1632
|
+
await insertMany('events', batchOfEvents);
|
|
1633
|
+
|
|
1634
|
+
// Update — use $inc for counters (NEVER read-modify-write)
|
|
1635
|
+
await updateOne<Stats>('stats',
|
|
1636
|
+
{ date },
|
|
1637
|
+
{ $inc: { pageViews: 1 } },
|
|
1638
|
+
true // upsert
|
|
1639
|
+
);
|
|
1640
|
+
|
|
1641
|
+
// Complex batch (auto-retries E11000 concurrent races)
|
|
1642
|
+
await bulkOps('sessions', [
|
|
1643
|
+
{ updateOne: { filter: { sessionId }, update: { $inc: { events: 1 } }, upsert: true } },
|
|
1644
|
+
]);
|
|
1645
|
+
```
|
|
1646
|
+
|
|
1647
|
+
### Connection Pool Presets
|
|
1648
|
+
|
|
1649
|
+
| Preset | Max Pool | Min Pool | Use Case |
|
|
1650
|
+
|--------|----------|----------|----------|
|
|
1651
|
+
| `high` | 20 | 2 | APIs, high-traffic services |
|
|
1652
|
+
| `standard` | 10 | 2 | Default for most services |
|
|
1653
|
+
| `low` | 5 | 1 | Background workers, cron jobs |
|
|
1654
|
+
|
|
1655
|
+
### Built-in Sanitization and Guardrails
|
|
1656
|
+
|
|
1657
|
+
All query inputs are automatically sanitized to prevent injection attacks. The sanitizer uses an **allowlist** of known-safe query operators — standard operators pass through while dangerous ones are stripped.
|
|
1658
|
+
|
|
1659
|
+
**How it works:**
|
|
1660
|
+
|
|
1661
|
+
| Category | What happens |
|
|
1662
|
+
|----------|-------------|
|
|
1663
|
+
| **Safe operators** (`$gte`, `$lt`, `$in`, `$nin`, `$ne`, `$regex`, `$exists`, `$and`, `$or`, `$elemMatch`, `$expr`, geo, text, bitwise) | Key allowed through, value recursively sanitized |
|
|
1664
|
+
| **Dangerous operators** (`$where`, `$function`, `$accumulator` — execute arbitrary JS) | Stripped automatically |
|
|
1665
|
+
| **Unknown `$` keys** | Stripped (defense in depth) |
|
|
1666
|
+
| **Dot-notation keys** (`field.nested`) | Stripped (blocks path traversal) |
|
|
1667
|
+
|
|
1668
|
+
```typescript
|
|
1669
|
+
// These all work by default — no special options needed:
|
|
1670
|
+
const entries = await queryMany('logs', [
|
|
1671
|
+
{ $match: { timestamp: { $gte: new Date(since) } } },
|
|
1672
|
+
]);
|
|
1673
|
+
|
|
1674
|
+
const total = await count('waf_events', { event_at: { $gte: sinceDate } });
|
|
1675
|
+
|
|
1676
|
+
const latest = await queryOne('events', {
|
|
1677
|
+
level: { $in: ['error', 'fatal'] },
|
|
1678
|
+
timestamp: { $gte: cutoff },
|
|
1679
|
+
});
|
|
1680
|
+
|
|
1681
|
+
// Dangerous operators are automatically stripped:
|
|
1682
|
+
// { $where: 'this.isAdmin' } → stripped (JS execution)
|
|
1683
|
+
// { $function: { body: '...' } } → stripped (JS execution)
|
|
1684
|
+
```
|
|
1685
|
+
|
|
1686
|
+
**Disable entirely:** Set `sanitize: false` in `StrictDB.create()` config or `sanitize = false` in `claude-mastery-project.conf`.
|
|
1687
|
+
|
|
1688
|
+
### `{ trusted: true }` — Escape Hatch
|
|
1689
|
+
|
|
1690
|
+
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 find yourself using it frequently, add the operator to StrictDB's `SAFE_OPERATORS` configuration instead.
|
|
1691
|
+
|
|
1692
|
+
```typescript
|
|
1693
|
+
const results = await queryMany('collection', pipeline, { trusted: true });
|
|
1694
|
+
const total = await count('collection', match, { trusted: true });
|
|
1695
|
+
const one = await queryOne('collection', match, { trusted: true });
|
|
1696
|
+
```
|
|
1697
|
+
|
|
1698
|
+
**When to use `{ trusted: true }`:**
|
|
1699
|
+
- The query uses a non-standard operator not in the allowlist
|
|
1700
|
+
- You have validated/sanitized the input yourself at a higher layer
|
|
1701
|
+
|
|
1702
|
+
**When NOT to use it:**
|
|
1703
|
+
- Standard query operators (`$gte`, `$in`, `$regex`, etc.) — these work by default
|
|
1704
|
+
- Raw user input flows directly into `$match` values without validation
|
|
1705
|
+
|
|
1706
|
+
### Additional Features
|
|
1707
|
+
|
|
1708
|
+
- **Singleton per URI** — same URI always returns the same client, prevents pool exhaustion
|
|
1709
|
+
- **Next.js hot-reload safe** — persists connections via `globalThis` during development
|
|
1710
|
+
- **Transaction support** — `withTransaction()` for multi-document atomic operations
|
|
1711
|
+
- **Change Stream access** — `rawCollection()` for real-time event processing
|
|
1712
|
+
- **Graceful shutdown** — `gracefulShutdown()` closes all pools on `SIGTERM`, `SIGINT`, `uncaughtException`, and `unhandledRejection` — no zombie connections on crash
|
|
1713
|
+
- **E11000 auto-retry** — handles concurrent upsert race conditions automatically
|
|
1714
|
+
- **$limit before $lookup** — `queryWithLookup()` enforces this for join performance
|
|
1715
|
+
- **Index management** — `registerIndex()` + `ensureIndexes()` at startup
|
|
1716
|
+
|
|
1717
|
+
### Test Query Master — `scripts/db-query.ts`
|
|
1718
|
+
|
|
1719
|
+
**Every** dev/test database query gets its own file in `scripts/queries/` and is registered in the master index. Production code in `src/` stays clean.
|
|
1720
|
+
|
|
1721
|
+
```typescript
|
|
1722
|
+
// scripts/queries/find-expired-sessions.ts
|
|
1723
|
+
import { queryMany } from 'strictdb';
|
|
1724
|
+
|
|
1725
|
+
export default {
|
|
1726
|
+
name: 'find-expired-sessions',
|
|
1727
|
+
description: 'Find sessions that expired in the last 24 hours',
|
|
1728
|
+
async run(args: string[]): Promise<void> {
|
|
1729
|
+
const cutoff = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
1730
|
+
const sessions = await queryMany('sessions', [
|
|
1731
|
+
{ $match: { expiresAt: { $lt: cutoff } } },
|
|
1732
|
+
{ $sort: { expiresAt: -1 } },
|
|
1733
|
+
{ $limit: 50 },
|
|
1734
|
+
]);
|
|
1735
|
+
console.log(`Found ${sessions.length} expired sessions`);
|
|
1736
|
+
},
|
|
1737
|
+
};
|
|
1738
|
+
```
|
|
1739
|
+
|
|
1740
|
+
Register in `scripts/db-query.ts` and run: `npx tsx scripts/db-query.ts find-expired-sessions`
|
|
1741
|
+
|
|
1742
|
+
### Content Builder — `scripts/build-content.ts`
|
|
1743
|
+
|
|
1744
|
+
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. Each generated page includes Open Graph, Twitter Cards, Schema.org JSON-LD, syntax highlighting, and optional sidebar TOC.
|
|
1745
|
+
|
|
1746
|
+
```bash
|
|
1747
|
+
pnpm content:build # Build all published articles
|
|
1748
|
+
pnpm content:build:id my-post # Build a single article
|
|
1749
|
+
pnpm content:list # List all articles and status
|
|
1750
|
+
```
|
|
1751
|
+
|
|
1752
|
+
---
|
|
1753
|
+
|
|
1754
|
+
## Documentation Templates
|
|
1755
|
+
|
|
1756
|
+
Pre-structured docs that Claude actually follows. Each template uses the "STOP" pattern — explicit boundaries that prevent Claude from making unauthorized changes.
|
|
1757
|
+
|
|
1758
|
+
### ARCHITECTURE.md
|
|
1759
|
+
|
|
1760
|
+
`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, and an "If You Are About To... STOP" section that blocks scope creep.
|
|
1761
|
+
|
|
1762
|
+
```
|
|
1763
|
+
## If You Are About To...
|
|
1764
|
+
- Add an endpoint to the wrong service → STOP. Check the table above.
|
|
1765
|
+
- Create a direct database connection → STOP. Use StrictDB.
|
|
1766
|
+
- Skip TypeScript for a quick fix → STOP. TypeScript is non-negotiable.
|
|
1767
|
+
- Deploy without tests → STOP. Write tests first.
|
|
1768
|
+
```
|
|
1769
|
+
|
|
1770
|
+
### DECISIONS.md
|
|
1771
|
+
|
|
1772
|
+
`project-docs/DECISIONS.md` — Architectural Decision Records (ADRs) that document **why** you chose X over Y. Includes two starter decisions:
|
|
1773
|
+
- **ADR-001: TypeScript Over JavaScript** — AI needs explicit type contracts to avoid guessing
|
|
1774
|
+
- **ADR-002: StrictDB for Database Access** — prevents connection pool exhaustion
|
|
1775
|
+
|
|
1776
|
+
Each ADR has: Context, Decision, Alternatives Considered (with pros/cons table), and Consequences.
|
|
1777
|
+
|
|
1778
|
+
### INFRASTRUCTURE.md
|
|
1779
|
+
|
|
1780
|
+
`project-docs/INFRASTRUCTURE.md` — Deployment and environment details: environment overview diagram, environment variables table, deployment prerequisites and steps, rollback procedures, and monitoring setup.
|
|
1781
|
+
|
|
1782
|
+
---
|
|
1783
|
+
|
|
1784
|
+
## Testing Methodology
|
|
1785
|
+
|
|
1786
|
+
From the V5 testing methodology — a structured approach to testing that prevents the most common AI-assisted testing failures.
|
|
1787
|
+
|
|
1788
|
+
### CHECKLIST.md
|
|
1789
|
+
|
|
1790
|
+
`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 for every feature area.
|
|
1791
|
+
|
|
1792
|
+
### ISSUES_FOUND.md
|
|
1793
|
+
|
|
1794
|
+
`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.
|
|
1795
|
+
|
|
1796
|
+
### E2E Test Requirements
|
|
1797
|
+
|
|
1798
|
+
Every E2E test (Playwright) must verify:
|
|
1799
|
+
|
|
1800
|
+
1. Correct URL after navigation
|
|
1801
|
+
2. Key visible elements are present
|
|
1802
|
+
3. Correct data is displayed
|
|
1803
|
+
4. Error states show proper messages
|
|
1804
|
+
|
|
1805
|
+
### E2E Infrastructure
|
|
1806
|
+
|
|
1807
|
+
The Playwright config is pre-wired with test ports, automatic server spawning, and port cleanup:
|
|
1808
|
+
|
|
1809
|
+
1. `pnpm test:e2e` — kills anything on test ports (4000, 4010, 4020)
|
|
1810
|
+
2. Playwright spawns servers via `webServer` config on test ports
|
|
1811
|
+
3. Tests run against the test servers
|
|
1812
|
+
4. Servers shut down automatically when tests complete
|
|
1813
|
+
|
|
1814
|
+
```bash
|
|
1815
|
+
pnpm test # ALL tests (unit + E2E)
|
|
1816
|
+
pnpm test:unit # Unit/integration only (Vitest)
|
|
1817
|
+
pnpm test:e2e # E2E only (kills ports → spawns servers → Playwright)
|
|
1818
|
+
pnpm test:e2e:headed # E2E with visible browser
|
|
1819
|
+
pnpm test:e2e:ui # E2E with Playwright UI mode
|
|
1820
|
+
pnpm test:e2e:report # Open last HTML report
|
|
1821
|
+
```
|
|
1822
|
+
|
|
1823
|
+
---
|
|
1824
|
+
|
|
1825
|
+
## Windows Users — VS Code in WSL Mode
|
|
1826
|
+
|
|
1827
|
+
If you're developing on Windows, this is the single biggest performance improvement you can make.
|
|
1828
|
+
|
|
1829
|
+
**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.
|
|
1830
|
+
|
|
1831
|
+
| Without WSL Mode | With WSL Mode |
|
|
1832
|
+
|-------------------|---------------|
|
|
1833
|
+
| HMR takes 2-5 seconds per change | HMR is near-instant (<200ms) |
|
|
1834
|
+
| Playwright tests are slow and flaky | Native Linux speed |
|
|
1835
|
+
| File watching misses changes | Reliable and fast |
|
|
1836
|
+
| Node.js ops hit NTFS translation | Native ext4 filesystem |
|
|
1837
|
+
| `git status` takes seconds | Instant |
|
|
1838
|
+
|
|
1839
|
+
### Setup (One Time)
|
|
1840
|
+
|
|
1841
|
+
```bash
|
|
1842
|
+
# 1. Install WSL 2 (PowerShell as admin)
|
|
1843
|
+
wsl --install
|
|
1844
|
+
|
|
1845
|
+
# 2. Restart your computer
|
|
1846
|
+
|
|
1847
|
+
# 3. Install VS Code extension
|
|
1848
|
+
# Search for "WSL" by Microsoft (ms-vscode-remote.remote-wsl)
|
|
1849
|
+
|
|
1850
|
+
# 4. Connect VS Code to WSL
|
|
1851
|
+
# Click green "><" icon in bottom-left → "Connect to WSL"
|
|
1852
|
+
|
|
1853
|
+
# 5. Clone projects INSIDE WSL (not /mnt/c/)
|
|
1854
|
+
mkdir -p ~/projects
|
|
1855
|
+
cd ~/projects
|
|
1856
|
+
git clone git@github.com:YourUser/your-project.git
|
|
1857
|
+
code your-project # opens in WSL mode automatically
|
|
1858
|
+
```
|
|
1859
|
+
|
|
1860
|
+
### The Critical Mistake
|
|
1861
|
+
|
|
1862
|
+
**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.
|
|
1863
|
+
|
|
1864
|
+
```bash
|
|
1865
|
+
# Check your setup:
|
|
1866
|
+
pwd
|
|
1867
|
+
|
|
1868
|
+
# GOOD — native Linux filesystem
|
|
1869
|
+
/home/you/projects/my-app
|
|
1870
|
+
|
|
1871
|
+
# BAD — still hitting Windows filesystem through WSL
|
|
1872
|
+
/mnt/c/Users/you/projects/my-app
|
|
1873
|
+
```
|
|
1874
|
+
|
|
1875
|
+
Run `/setup` in Claude Code to auto-detect your environment and get specific instructions.
|
|
1876
|
+
|
|
1877
|
+
---
|
|
1878
|
+
|
|
1879
|
+
## Global CLAUDE.md — Security Gatekeeper
|
|
1880
|
+
|
|
1881
|
+
The global `CLAUDE.md` lives at `~/.claude/CLAUDE.md` and applies to **every project** you work on. It's your organization-wide security gatekeeper.
|
|
1882
|
+
|
|
1883
|
+
The starter kit includes a complete global config template in `global-claude-md/` with:
|
|
1884
|
+
|
|
1885
|
+
- **Absolute Rules** — NEVER publish sensitive data. NEVER commit `.env` files. NEVER auto-deploy. NEVER hardcode credentials. NEVER rename without a plan. These apply to every project, every session.
|
|
1886
|
+
- **New Project Standards** — Every new project automatically gets: `.env` + `.env.example`, proper `.gitignore`, `.dockerignore`, TypeScript strict mode, `src/tests/project-docs/.claude/` directory structure.
|
|
1887
|
+
- **Coding Standards** — Error handling requirements, testing standards, quality gates, StrictDB usage — all enforced across every project.
|
|
1888
|
+
- **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.
|
|
1889
|
+
|
|
1890
|
+
---
|
|
1891
|
+
|
|
1892
|
+
## Coding Standards
|
|
1893
|
+
|
|
1894
|
+
### Imports
|
|
1895
|
+
|
|
1896
|
+
```typescript
|
|
1897
|
+
// CORRECT — explicit, typed
|
|
1898
|
+
import { getUserById } from './handlers/users.js';
|
|
1899
|
+
import type { User } from './types/index.js';
|
|
1900
|
+
|
|
1901
|
+
// WRONG — barrel imports that pull everything
|
|
1902
|
+
import * as everything from './index.js';
|
|
1903
|
+
```
|
|
1904
|
+
|
|
1905
|
+
### Error Handling
|
|
1906
|
+
|
|
1907
|
+
```typescript
|
|
1908
|
+
// CORRECT — handle errors explicitly
|
|
1909
|
+
try {
|
|
1910
|
+
const user = await getUserById(id);
|
|
1911
|
+
if (!user) throw new NotFoundError('User not found');
|
|
1912
|
+
return user;
|
|
1913
|
+
} catch (err) {
|
|
1914
|
+
logger.error('Failed to get user', { id, error: err });
|
|
1915
|
+
throw err;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
// WRONG — swallow errors silently
|
|
1919
|
+
try {
|
|
1920
|
+
return await getUserById(id);
|
|
1921
|
+
} catch {
|
|
1922
|
+
return null; // silent failure
|
|
1923
|
+
}
|
|
1924
|
+
```
|
|
1925
|
+
|
|
1926
|
+
### Naming Safety
|
|
1927
|
+
|
|
1928
|
+
Renaming packages, modules, or key variables mid-project causes cascading failures. If you must rename:
|
|
1929
|
+
|
|
1930
|
+
1. Create a checklist of ALL files and references first
|
|
1931
|
+
2. Use IDE semantic rename (not search-and-replace)
|
|
1932
|
+
3. Full project search for old name after renaming
|
|
1933
|
+
4. Check: `.md`, `.txt`, `.env`, comments, strings, paths
|
|
1934
|
+
5. Start a FRESH Claude session after renaming
|
|
1935
|
+
|
|
1936
|
+
### Plan Mode — Named Steps + Replace, Don't Append
|
|
1937
|
+
|
|
1938
|
+
Every plan step MUST have a unique, descriptive name:
|
|
1939
|
+
|
|
1940
|
+
```
|
|
1941
|
+
Step 1 (Project Setup): Initialize repo with TypeScript
|
|
1942
|
+
Step 2 (Database Layer): Set up StrictDB
|
|
1943
|
+
Step 3 (Auth System): Implement JWT authentication
|
|
1944
|
+
```
|
|
1945
|
+
|
|
1946
|
+
When modifying a plan:
|
|
1947
|
+
- **REPLACE** the named step entirely: "Change Step 3 (Auth System) to use session cookies"
|
|
1948
|
+
- **NEVER** just append: "Also, use session cookies" ← Step 3 still says JWT
|
|
1949
|
+
- After any change, Claude must **rewrite the full updated plan**
|
|
1950
|
+
- If the plan contradicts itself, tell Claude: "Rewrite the full plan — Step 3 and Step 7 contradict"
|
|
1951
|
+
- If fundamentally changing direction: `/clear` → state requirements fresh
|
|
1952
|
+
|
|
1953
|
+
---
|
|
1954
|
+
|
|
1955
|
+
## All npm Scripts
|
|
1956
|
+
|
|
1957
|
+
| Command | What it does |
|
|
1958
|
+
|---------|-------------|
|
|
1959
|
+
| **Development** | |
|
|
1960
|
+
| `pnpm dev` | Dev server with hot reload |
|
|
1961
|
+
| `pnpm dev:website` | Dev server on port 3000 |
|
|
1962
|
+
| `pnpm dev:api` | Dev server on port 3001 |
|
|
1963
|
+
| `pnpm dev:dashboard` | Dev server on port 3002 |
|
|
1964
|
+
| `pnpm build` | Type-check + compile TypeScript |
|
|
1965
|
+
| `pnpm build:optimize` | Post-build CSS class consolidation via Classpresso (auto-runs after build) |
|
|
1966
|
+
| `pnpm start` | Run production build |
|
|
1967
|
+
| `pnpm typecheck` | TypeScript check only (no emit) |
|
|
1968
|
+
| **Testing** | |
|
|
1969
|
+
| `pnpm test` | Run ALL tests (unit + E2E) |
|
|
1970
|
+
| `pnpm test:unit` | Unit/integration tests (Vitest) |
|
|
1971
|
+
| `pnpm test:unit:watch` | Unit tests in watch mode |
|
|
1972
|
+
| `pnpm test:coverage` | Unit tests with coverage report |
|
|
1973
|
+
| `pnpm test:e2e` | E2E tests (kills ports → spawns servers → Playwright) |
|
|
1974
|
+
| `pnpm test:e2e:headed` | E2E with visible browser |
|
|
1975
|
+
| `pnpm test:e2e:ui` | E2E with Playwright UI mode |
|
|
1976
|
+
| `pnpm test:e2e:chromium` | E2E on Chromium only (fast) |
|
|
1977
|
+
| `pnpm test:e2e:report` | Open last Playwright HTML report |
|
|
1978
|
+
| `pnpm test:kill-ports` | Kill processes on test ports (4000, 4010, 4020) |
|
|
1979
|
+
| **Database** | |
|
|
1980
|
+
| `pnpm db:query <name>` | Run a dev/test database query |
|
|
1981
|
+
| `pnpm db:query:list` | List all registered queries |
|
|
1982
|
+
| **Content** | |
|
|
1983
|
+
| `pnpm content:build` | Build all published MD → HTML |
|
|
1984
|
+
| `pnpm content:build:id <id>` | Build a single article by ID |
|
|
1985
|
+
| `pnpm content:list` | List all articles |
|
|
1986
|
+
| **Monitoring & Docker** | |
|
|
1987
|
+
| `pnpm ai:monitor` | Free monitor mode — live AI activity (run in separate terminal, no API key needed) |
|
|
1988
|
+
| `pnpm docker:optimize` | Audit Dockerfile (use `/optimize-docker` in Claude) |
|
|
1989
|
+
| **Utility** | |
|
|
1990
|
+
| `pnpm clean` | Remove dist/, coverage/, test-results/ |
|
|
1991
|
+
|
|
1992
|
+
---
|
|
1993
|
+
|
|
1994
|
+
## Monitor Your Rules with RuleCatch.AI (Optional)
|
|
1995
|
+
|
|
1996
|
+
> **Full disclosure:** RuleCatch.AI is built by [TheDecipherist](https://github.com/TheDecipherist) — the same developer behind this starter kit. It's included because it's an integral part of the workflow this kit teaches, and it's purpose-built for catching the exact issues AI-assisted development introduces.
|
|
1997
|
+
|
|
1998
|
+
### Try It Now — Free Monitor Mode
|
|
1999
|
+
|
|
2000
|
+
See what your AI is doing in real-time. No API key, no account, no setup — just open a **separate terminal** and run:
|
|
2001
|
+
|
|
2002
|
+
```bash
|
|
2003
|
+
# Open a separate terminal and run this while Claude works
|
|
2004
|
+
npx @rulecatch/ai-pooler monitor --no-api-key
|
|
2005
|
+
```
|
|
2006
|
+
|
|
2007
|
+
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 — runs completely outside Claude's context.
|
|
2008
|
+
|
|
2009
|
+
This is the free preview that lets you see what you've been missing. Once you see the stream of activity, you'll understand why monitoring matters.
|
|
2010
|
+
|
|
2011
|
+
### Unlock the Full Experience
|
|
2012
|
+
|
|
2013
|
+
**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](https://rulecatch.ai?utm_source=github-pages&utm_medium=article&utm_campaign=rulecatch&utm_content=tutorial) bridges the gap between detecting these violations and fixing them.
|
|
2014
|
+
|
|
2015
|
+
**What you get with an API key:**
|
|
2016
|
+
|
|
2017
|
+
| Component | What it does |
|
|
2018
|
+
|-----------|-------------|
|
|
2019
|
+
| **[AI-Pooler](https://www.npmjs.com/package/@rulecatch/ai-pooler)** | Everything in free monitor mode PLUS persistent violation tracking, session history, and cost analytics |
|
|
2020
|
+
| **[Dashboard](https://rulecatch.ai?utm_source=github-pages&utm_medium=article&utm_campaign=rulecatch&utm_content=tutorial)** | Violations across 18 rule categories, session analytics (tokens, cost, lines/hour), trend reports, and per-file attribution. Alerts via Slack, Discord, PagerDuty, and more |
|
|
2021
|
+
| **[MCP Server](https://www.npmjs.com/package/@rulecatch/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 |
|
|
2022
|
+
|
|
2023
|
+
- **200+ pre-built rules** across security, TypeScript, React, Next.js, StrictDB, Docker, and more — violations detected in under 100ms
|
|
2024
|
+
- **Privacy-first** — AES-256-GCM client-side encryption. You hold the key — RuleCatch never sees your plaintext data. US and EU data isolation, fully GDPR compliant
|
|
2025
|
+
|
|
2026
|
+
**Full setup (with API key):**
|
|
2027
|
+
|
|
2028
|
+
```bash
|
|
2029
|
+
# Install the AI-Pooler with your API key (hooks into Claude Code automatically)
|
|
2030
|
+
npx @rulecatch/ai-pooler init --api-key=dc_your_key --region=us
|
|
2031
|
+
|
|
2032
|
+
# Add the MCP server to query violations from Claude
|
|
2033
|
+
npx @rulecatch/mcp-server init
|
|
2034
|
+
```
|
|
2035
|
+
|
|
2036
|
+
npm: [@rulecatch/ai-pooler](https://www.npmjs.com/package/@rulecatch/ai-pooler) · [@rulecatch/mcp-server](https://www.npmjs.com/package/@rulecatch/mcp-server)
|
|
2037
|
+
|
|
2038
|
+
[Explore RuleCatch.AI →](https://rulecatch.ai?utm_source=github-pages&utm_medium=article&utm_campaign=rulecatch&utm_content=tutorial) · 7-day free trial - no credit card required
|
|
2039
|
+
|
|
2040
|
+
---
|
|
2041
|
+
|
|
2042
|
+
## Recommended MCP Servers
|
|
2043
|
+
|
|
2044
|
+
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.
|
|
2045
|
+
|
|
2046
|
+
### Context7 — Live Documentation
|
|
2047
|
+
|
|
2048
|
+
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 fixes this by fetching up-to-date, version-specific documentation and code examples directly from official sources and injecting them into Claude's context.
|
|
2049
|
+
|
|
2050
|
+
**What it solves:** Hallucinated APIs, outdated code patterns, version mismatches
|
|
2051
|
+
**How to use:** Add `use context7` to your prompt — Context7 automatically identifies the relevant library and fetches current docs
|
|
2052
|
+
|
|
2053
|
+
```bash
|
|
2054
|
+
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
|
2055
|
+
```
|
|
2056
|
+
|
|
2057
|
+
npm: [@upstash/context7-mcp](https://www.npmjs.com/package/@upstash/context7-mcp) · [GitHub](https://github.com/upstash/context7)
|
|
2058
|
+
|
|
2059
|
+
---
|
|
2060
|
+
|
|
2061
|
+
### GitHub MCP — Repository Management
|
|
2062
|
+
|
|
2063
|
+
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.
|
|
2064
|
+
|
|
2065
|
+
**What it solves:** Context-switching between Claude and GitHub for PR reviews, issue management, and CI/CD
|
|
2066
|
+
**Toolsets:** Repository management, issues, pull requests, actions, code security, discussions, notifications
|
|
2067
|
+
|
|
2068
|
+
```bash
|
|
2069
|
+
claude mcp add github -- npx -y @modelcontextprotocol/server-github
|
|
2070
|
+
```
|
|
2071
|
+
|
|
2072
|
+
> **Note:** GitHub has also released an [official GitHub MCP Server](https://github.com/github/github-mcp-server) with expanded toolsets. Either works — the official server offers more granular control via `--toolsets` flags.
|
|
2073
|
+
|
|
2074
|
+
npm: [@modelcontextprotocol/server-github](https://www.npmjs.com/package/@modelcontextprotocol/server-github) · [GitHub (official)](https://github.com/github/github-mcp-server)
|
|
2075
|
+
|
|
2076
|
+
---
|
|
2077
|
+
|
|
2078
|
+
### Playwright MCP — Browser Automation
|
|
2079
|
+
|
|
2080
|
+
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, which is faster and more deterministic than pixel-based approaches.
|
|
2081
|
+
|
|
2082
|
+
**What it solves:** E2E test debugging, verifying UI behavior, interacting with web apps during development
|
|
2083
|
+
**How it works:** Uses Playwright's accessibility tree (not screenshots) — fast, lightweight, and LLM-friendly. Supports Chrome, Firefox, WebKit, and 143+ device emulation profiles
|
|
2084
|
+
|
|
2085
|
+
```bash
|
|
2086
|
+
claude mcp add playwright -- npx -y @playwright/mcp@latest
|
|
2087
|
+
```
|
|
2088
|
+
|
|
2089
|
+
npm: [@playwright/mcp](https://www.npmjs.com/package/@playwright/mcp) · [GitHub](https://github.com/microsoft/playwright-mcp)
|
|
2090
|
+
|
|
2091
|
+
---
|
|
2092
|
+
|
|
2093
|
+
### ClassMCP — Semantic CSS for AI
|
|
2094
|
+
|
|
2095
|
+
> **Developed by [TheDecipherist](https://github.com/TheDecipherist)** — the same developer behind this starter kit. Open source (MIT license).
|
|
2096
|
+
|
|
2097
|
+
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.
|
|
2098
|
+
|
|
2099
|
+
**What it solves:** Hallucinated CSS class names, inconsistent styling patterns, wasted tokens on style guessing
|
|
2100
|
+
**How to use:** Install once — ClassMCP automatically provides CSS context when Claude works with styles
|
|
2101
|
+
|
|
2102
|
+
```bash
|
|
2103
|
+
claude mcp add classmcp -- npx -y classmcp@latest
|
|
2104
|
+
```
|
|
2105
|
+
|
|
2106
|
+
npm: [classmcp](https://www.npmjs.com/package/classmcp) · [Website](https://classmcp.com?utm_source=github&utm_medium=readme&utm_campaign=classmcp&utm_content=mcp-servers)
|
|
2107
|
+
|
|
2108
|
+
---
|
|
2109
|
+
|
|
2110
|
+
### StrictDB-MCP — Database Access for AI
|
|
2111
|
+
|
|
2112
|
+
> **Developed by [TheDecipherist](https://github.com/TheDecipherist)** — the same developer behind this starter kit. Open source (MIT license).
|
|
2113
|
+
|
|
2114
|
+
Gives AI agents direct database access through 14 MCP tools with full guardrails, sanitization, and error handling. Instead of Claude generating raw queries or connection code, StrictDB-MCP provides structured tools for reading, writing, and managing data across all supported backends. Auto-included in database-enabled profiles.
|
|
2115
|
+
|
|
2116
|
+
**What it solves:** Connection pool exhaustion, unsanitized queries, missing graceful shutdown, and type round-trip bugs
|
|
2117
|
+
**How to use:** Install once — StrictDB-MCP provides database tools when Claude works with data
|
|
2118
|
+
|
|
2119
|
+
```bash
|
|
2120
|
+
claude mcp add strictdb -- npx -y strictdb-mcp@latest
|
|
2121
|
+
```
|
|
2122
|
+
|
|
2123
|
+
npm: [strictdb-mcp](https://www.npmjs.com/package/strictdb-mcp)
|
|
2124
|
+
|
|
2125
|
+
---
|
|
2126
|
+
|
|
2127
|
+
### RuleCatch MCP — AI Session Analytics
|
|
2128
|
+
|
|
2129
|
+
Already covered in detail in the [Monitor Your Rules](#monitor-your-rules-with-rulecatchai-optional) section above. Gives Claude direct read access to violation data so it can query what rules it's breaking and generate fix plans.
|
|
2130
|
+
|
|
2131
|
+
```bash
|
|
2132
|
+
npx @rulecatch/mcp-server init
|
|
2133
|
+
```
|
|
2134
|
+
|
|
2135
|
+
npm: [@rulecatch/mcp-server](https://www.npmjs.com/package/@rulecatch/mcp-server) · [RuleCatch.AI](https://rulecatch.ai?utm_source=github-pages&utm_medium=article&utm_campaign=rulecatch&utm_content=tutorial)
|
|
2136
|
+
|
|
2137
|
+
---
|
|
2138
|
+
|
|
2139
|
+
See the [Claude Code Mastery Guide](https://github.com/TheDecipherist/claude-code-mastery) for the complete MCP server directory.
|
|
2140
|
+
|
|
2141
|
+
---
|
|
2142
|
+
|
|
2143
|
+
## Credits
|
|
2144
|
+
|
|
2145
|
+
Based on the [Claude Code Mastery Guide](https://github.com/TheDecipherist/claude-code-mastery) series by [TheDecipherist](https://thedecipherist.com):
|
|
2146
|
+
- V1: Global CLAUDE.md, Security Gatekeeper, Project Scaffolding, Context7
|
|
2147
|
+
- V2: Skills & Hooks, Enforcement over Suggestion, Quality Gates
|
|
2148
|
+
- V3: LSP, CLAUDE.md, MCP, Skills & Hooks
|
|
2149
|
+
- V4: 85% Context Reduction, Custom Agents & Session Teleportation
|
|
2150
|
+
- V5: Renaming Problem, Plan Mode, Testing Methodology & Rules That Stick
|
|
2151
|
+
|
|
2152
|
+
Community contributors: u/BlueVajra, u/stratofax, u/antoniocs, u/GeckoLogic, u/headset38, u/tulensrma, u/jcheroske, u/ptinsley, u/Keksy, u/lev606
|