clauderc 1.0.6 → 1.1.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/bin/cli.js +8 -4
- package/package.json +1 -1
- package/src/providers/claude.js +90 -1
- package/src/providers/cursor.js +62 -1
- package/templates/commands/fix.md +73 -0
- package/templates/commands/worktree.md +66 -0
- package/templates/hooks/auto-approve.json +16 -0
- package/templates/manifest.json +55 -6
- package/templates/project-setup/CLAUDE_MD_TEMPLATE.md +41 -4
- package/templates/skills/evolve-claude-md/SKILL.md +121 -0
- package/templates/skills/explain/SKILL.md +130 -0
package/bin/cli.js
CHANGED
|
@@ -180,7 +180,8 @@ function showSuccessBanner(stats, providerNames) {
|
|
|
180
180
|
${c.bold}Try these commands in Claude Code:${c.reset}
|
|
181
181
|
|
|
182
182
|
${c.cyan}Ask Claude:${c.reset} "Use project-setup-wizard to configure this project"
|
|
183
|
-
${c.cyan}Slash commands:${c.reset} /test, /lint, /verify, /pr
|
|
183
|
+
${c.cyan}Slash commands:${c.reset} /test, /lint, /verify, /pr, /fix, /worktree
|
|
184
|
+
${c.cyan}Skills:${c.reset} /evolve-claude-md, /explain
|
|
184
185
|
`);
|
|
185
186
|
|
|
186
187
|
if (providerNames && providerNames.includes('cursor')) {
|
|
@@ -218,6 +219,7 @@ function listInstalled() {
|
|
|
218
219
|
{ name: 'Agents', path: join(CLAUDE_DIR, 'agents') },
|
|
219
220
|
{ name: 'Skills', path: join(CLAUDE_DIR, 'skills') },
|
|
220
221
|
{ name: 'Commands', path: join(CLAUDE_DIR, 'commands') },
|
|
222
|
+
{ name: 'Hooks', path: join(CLAUDE_DIR, 'hooks') },
|
|
221
223
|
{ name: 'Templates', path: join(CLAUDE_DIR, 'templates') },
|
|
222
224
|
];
|
|
223
225
|
|
|
@@ -241,8 +243,9 @@ function listInstalled() {
|
|
|
241
243
|
console.log(` ${c.green}●${c.reset} ${entry.name}`);
|
|
242
244
|
found = true;
|
|
243
245
|
}
|
|
244
|
-
} else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
245
|
-
|
|
246
|
+
} else if (entry.isFile() && (entry.name.endsWith('.md') || entry.name.endsWith('.json'))) {
|
|
247
|
+
const displayName = entry.name.replace(/\.(md|json)$/, '');
|
|
248
|
+
console.log(` ${c.green}●${c.reset} ${displayName}`);
|
|
246
249
|
found = true;
|
|
247
250
|
} else if (entry.isDirectory()) {
|
|
248
251
|
console.log(` ${c.green}●${c.reset} ${entry.name}/`);
|
|
@@ -333,7 +336,7 @@ async function init(options = {}) {
|
|
|
333
336
|
|
|
334
337
|
// Create base directories
|
|
335
338
|
if (providerIds.includes('claude')) {
|
|
336
|
-
const dirs = ['agents', 'skills', 'commands', 'templates'];
|
|
339
|
+
const dirs = ['agents', 'skills', 'commands', 'templates', 'hooks'];
|
|
337
340
|
for (const dir of dirs) {
|
|
338
341
|
ensureDir(join(CLAUDE_DIR, dir));
|
|
339
342
|
}
|
|
@@ -638,6 +641,7 @@ function showHelp() {
|
|
|
638
641
|
├── agents/ ${c.dim}# Reusable agents${c.reset}
|
|
639
642
|
├── skills/ ${c.dim}# Reusable skills${c.reset}
|
|
640
643
|
├── commands/ ${c.dim}# Default commands${c.reset}
|
|
644
|
+
├── hooks/ ${c.dim}# Pre/post tool use hooks${c.reset}
|
|
641
645
|
└── templates/ ${c.dim}# Templates for project setup${c.reset}
|
|
642
646
|
|
|
643
647
|
${c.cyan}Global (~/.cursor/rules/)${c.reset}
|
package/package.json
CHANGED
package/src/providers/claude.js
CHANGED
|
@@ -59,9 +59,24 @@ Use Plan Mode (Shift+Tab 2x) for:
|
|
|
59
59
|
- Architecture changes
|
|
60
60
|
- Database migrations
|
|
61
61
|
|
|
62
|
+
### Parallel Workflow (Worktrees)
|
|
63
|
+
For parallel tasks, use git worktrees:
|
|
64
|
+
- Run \`/worktree\` to set up parallel workspaces
|
|
65
|
+
- Use aliases: \`za\` (feature), \`zb\` (bugfix), \`zc\` (experiment), \`z0\` (main)
|
|
66
|
+
- Each worktree runs its own Claude Code session independently
|
|
67
|
+
|
|
62
68
|
### Verification
|
|
63
69
|
- ALWAYS run \`${commands.verify || 'tests'}\` before committing
|
|
64
70
|
- NEVER skip tests without explicit approval
|
|
71
|
+
|
|
72
|
+
### Advanced Prompting
|
|
73
|
+
- Grill your changes: "Is this the best approach? What are the edge cases?"
|
|
74
|
+
- Ask Claude to reimplement elegantly after a working prototype
|
|
75
|
+
- Use subagents for focused tasks (security review, test writing)
|
|
76
|
+
|
|
77
|
+
### Self-Improvement
|
|
78
|
+
- Run \`/evolve-claude-md\` after fixing bugs to capture learnings
|
|
79
|
+
- Claude is good at writing rules for itself - review its suggestions
|
|
65
80
|
`;
|
|
66
81
|
|
|
67
82
|
content += `
|
|
@@ -324,6 +339,80 @@ Create a well-structured commit following Conventional Commits.
|
|
|
324
339
|
4. Write subject in imperative mood
|
|
325
340
|
5. Add body if change needs explanation
|
|
326
341
|
6. Execute \`git commit -m "<message>"\`
|
|
342
|
+
`,
|
|
343
|
+
|
|
344
|
+
worktree: `# Git Worktree Management
|
|
345
|
+
|
|
346
|
+
Manage parallel workspaces using git worktrees for concurrent Claude Code sessions.
|
|
347
|
+
|
|
348
|
+
## Setup Worktrees
|
|
349
|
+
|
|
350
|
+
\`\`\`bash
|
|
351
|
+
REPO_NAME="$(basename "$(git rev-parse --show-toplevel)")"
|
|
352
|
+
WORKTREE_BASE="../\${REPO_NAME}-worktrees"
|
|
353
|
+
mkdir -p "\$WORKTREE_BASE"
|
|
354
|
+
|
|
355
|
+
CURRENT="$(git branch --show-current)"
|
|
356
|
+
for SUFFIX in a b c; do
|
|
357
|
+
BRANCH="\${CURRENT}-wt-\${SUFFIX}"
|
|
358
|
+
TREE_PATH="\${WORKTREE_BASE}/\${SUFFIX}"
|
|
359
|
+
if [ ! -d "\$TREE_PATH" ]; then
|
|
360
|
+
git worktree add -b "\$BRANCH" "\$TREE_PATH" HEAD
|
|
361
|
+
echo "Created worktree: \$TREE_PATH (\$BRANCH)"
|
|
362
|
+
else
|
|
363
|
+
echo "Worktree exists: \$TREE_PATH"
|
|
364
|
+
fi
|
|
365
|
+
done
|
|
366
|
+
\`\`\`
|
|
367
|
+
|
|
368
|
+
## Shell Aliases
|
|
369
|
+
|
|
370
|
+
Add to your shell profile:
|
|
371
|
+
|
|
372
|
+
\`\`\`bash
|
|
373
|
+
alias za='cd "\$(git rev-parse --show-toplevel)/../\$(basename "\$(git rev-parse --show-toplevel)")-worktrees/a"'
|
|
374
|
+
alias zb='cd "\$(git rev-parse --show-toplevel)/../\$(basename "\$(git rev-parse --show-toplevel)")-worktrees/b"'
|
|
375
|
+
alias zc='cd "\$(git rev-parse --show-toplevel)/../\$(basename "\$(git rev-parse --show-toplevel)")-worktrees/c"'
|
|
376
|
+
alias z0='cd "\$(git rev-parse --show-toplevel)"'
|
|
377
|
+
\`\`\`
|
|
378
|
+
|
|
379
|
+
## Parallel Workflow
|
|
380
|
+
|
|
381
|
+
1. Main tree (z0): Primary development
|
|
382
|
+
2. Worktree A (za): Feature work with Claude Code
|
|
383
|
+
3. Worktree B (zb): Bug fixes with Claude Code
|
|
384
|
+
4. Worktree C (zc): Experiments
|
|
385
|
+
|
|
386
|
+
## Cleanup
|
|
387
|
+
|
|
388
|
+
\`\`\`bash
|
|
389
|
+
git worktree remove "../\${REPO_NAME}-worktrees/a"
|
|
390
|
+
git worktree prune
|
|
391
|
+
\`\`\`
|
|
392
|
+
`,
|
|
393
|
+
|
|
394
|
+
fix: `# Autonomous Bug Fix
|
|
395
|
+
|
|
396
|
+
Investigate and fix a bug from a description or issue link.
|
|
397
|
+
|
|
398
|
+
## Input
|
|
399
|
+
|
|
400
|
+
Accepts: bug description, GitHub issue link, or error message/stack trace.
|
|
401
|
+
|
|
402
|
+
## Workflow
|
|
403
|
+
|
|
404
|
+
1. **Understand** - Fetch issue details, search for related errors
|
|
405
|
+
2. **Reproduce** - Confirm the bug exists with a test or manual steps
|
|
406
|
+
3. **Investigate** - Trace code path, identify root cause
|
|
407
|
+
4. **Fix** - Write failing test, implement minimal fix, verify
|
|
408
|
+
5. **Commit** - Use \`fix(<scope>): <description>\` format
|
|
409
|
+
|
|
410
|
+
## Rules
|
|
411
|
+
|
|
412
|
+
- ALWAYS write a reproducing test before fixing
|
|
413
|
+
- NEVER fix more than the reported issue
|
|
414
|
+
- ALWAYS run \`/verify\` after the fix
|
|
415
|
+
- If fix spans > 5 files, stop and plan first
|
|
327
416
|
`,
|
|
328
417
|
};
|
|
329
418
|
|
|
@@ -347,7 +436,7 @@ export function generateProjectFiles(config) {
|
|
|
347
436
|
type: 'settings.json',
|
|
348
437
|
});
|
|
349
438
|
|
|
350
|
-
for (const cmd of ['test', 'lint', 'verify', 'setup', 'pr', 'commit']) {
|
|
439
|
+
for (const cmd of ['test', 'lint', 'verify', 'setup', 'pr', 'commit', 'worktree', 'fix']) {
|
|
351
440
|
files.push({
|
|
352
441
|
path: join(claudeDir, 'commands', `${cmd}.md`),
|
|
353
442
|
content: generateCommandFile(cmd, config),
|
package/src/providers/cursor.js
CHANGED
|
@@ -13,6 +13,8 @@ const RULE_DESCRIPTIONS = {
|
|
|
13
13
|
setup: 'Install dependencies and setup project',
|
|
14
14
|
pr: 'Create a semantic pull request',
|
|
15
15
|
commit: 'Create a semantic commit',
|
|
16
|
+
worktree: 'Manage git worktrees for parallel development',
|
|
17
|
+
fix: 'Autonomous bug investigation and fixing',
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
function mdcFrontmatter({ description, globs, alwaysApply }) {
|
|
@@ -255,6 +257,65 @@ Create a well-structured commit following Conventional Commits.
|
|
|
255
257
|
4. Write subject in imperative mood
|
|
256
258
|
5. Add body if change needs explanation
|
|
257
259
|
6. Execute \`git commit -m "<message>"\`
|
|
260
|
+
`,
|
|
261
|
+
|
|
262
|
+
worktree: mdcFrontmatter({ description, alwaysApply: false }) +
|
|
263
|
+
`# Git Worktree Management
|
|
264
|
+
|
|
265
|
+
Manage parallel workspaces using git worktrees.
|
|
266
|
+
|
|
267
|
+
## Setup
|
|
268
|
+
\`\`\`bash
|
|
269
|
+
REPO_NAME="$(basename "$(git rev-parse --show-toplevel)")"
|
|
270
|
+
WORKTREE_BASE="../\${REPO_NAME}-worktrees"
|
|
271
|
+
mkdir -p "\$WORKTREE_BASE"
|
|
272
|
+
CURRENT="$(git branch --show-current)"
|
|
273
|
+
for SUFFIX in a b c; do
|
|
274
|
+
BRANCH="\${CURRENT}-wt-\${SUFFIX}"
|
|
275
|
+
TREE_PATH="\${WORKTREE_BASE}/\${SUFFIX}"
|
|
276
|
+
if [ ! -d "\$TREE_PATH" ]; then
|
|
277
|
+
git worktree add -b "\$BRANCH" "\$TREE_PATH" HEAD
|
|
278
|
+
echo "Created worktree: \$TREE_PATH (\$BRANCH)"
|
|
279
|
+
else
|
|
280
|
+
echo "Worktree exists: \$TREE_PATH"
|
|
281
|
+
fi
|
|
282
|
+
done
|
|
283
|
+
\`\`\`
|
|
284
|
+
|
|
285
|
+
## Aliases
|
|
286
|
+
\`\`\`bash
|
|
287
|
+
alias za='cd "\$(git rev-parse --show-toplevel)/../\$(basename "\$(git rev-parse --show-toplevel)")-worktrees/a"'
|
|
288
|
+
alias zb='cd "\$(git rev-parse --show-toplevel)/../\$(basename "\$(git rev-parse --show-toplevel)")-worktrees/b"'
|
|
289
|
+
alias zc='cd "\$(git rev-parse --show-toplevel)/../\$(basename "\$(git rev-parse --show-toplevel)")-worktrees/c"'
|
|
290
|
+
alias z0='cd "\$(git rev-parse --show-toplevel)"'
|
|
291
|
+
\`\`\`
|
|
292
|
+
|
|
293
|
+
## Cleanup
|
|
294
|
+
\`\`\`bash
|
|
295
|
+
git worktree remove "../\${REPO_NAME}-worktrees/a"
|
|
296
|
+
git worktree prune
|
|
297
|
+
\`\`\`
|
|
298
|
+
`,
|
|
299
|
+
|
|
300
|
+
fix: mdcFrontmatter({ description, alwaysApply: false }) +
|
|
301
|
+
`# Autonomous Bug Fix
|
|
302
|
+
|
|
303
|
+
Investigate and fix a bug from a description or issue link.
|
|
304
|
+
|
|
305
|
+
## Workflow
|
|
306
|
+
|
|
307
|
+
1. **Understand** - Fetch issue details, search for related errors
|
|
308
|
+
2. **Reproduce** - Confirm the bug exists
|
|
309
|
+
3. **Investigate** - Trace code path, identify root cause
|
|
310
|
+
4. **Fix** - Write failing test, implement minimal fix, verify
|
|
311
|
+
5. **Commit** - Use \`fix(<scope>): <description>\` format
|
|
312
|
+
|
|
313
|
+
## Rules
|
|
314
|
+
|
|
315
|
+
- ALWAYS write a reproducing test before fixing
|
|
316
|
+
- NEVER fix more than the reported issue
|
|
317
|
+
- Run full verification after the fix
|
|
318
|
+
- If fix spans > 5 files, stop and plan first
|
|
258
319
|
`,
|
|
259
320
|
};
|
|
260
321
|
|
|
@@ -272,7 +333,7 @@ export function generateProjectFiles(config) {
|
|
|
272
333
|
type: '.cursorrules',
|
|
273
334
|
});
|
|
274
335
|
|
|
275
|
-
for (const name of ['test', 'lint', 'verify', 'setup', 'pr', 'commit']) {
|
|
336
|
+
for (const name of ['test', 'lint', 'verify', 'setup', 'pr', 'commit', 'worktree', 'fix']) {
|
|
276
337
|
files.push({
|
|
277
338
|
path: join(cursorDir, `${name}.mdc`),
|
|
278
339
|
content: generateRule(name, config),
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Autonomous Bug Fix
|
|
2
|
+
|
|
3
|
+
Investigate and fix a bug from a description or issue link. Works autonomously through investigation, root cause analysis, fix, and verification.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
Accepts one of:
|
|
8
|
+
- Bug description in natural language
|
|
9
|
+
- GitHub issue link (`gh issue view <number>`)
|
|
10
|
+
- Error message or stack trace
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Understand the Bug
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# If given an issue number, fetch details
|
|
18
|
+
gh issue view <number> --json title,body,comments
|
|
19
|
+
|
|
20
|
+
# Search for related error messages in codebase
|
|
21
|
+
grep -r "error message" src/ --include="*.{js,ts,py,go,rs}" -l
|
|
22
|
+
|
|
23
|
+
# Check recent commits that might have introduced the bug
|
|
24
|
+
git log --oneline -20 --all
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Reproduce
|
|
28
|
+
|
|
29
|
+
- Identify the reproduction steps from the bug report
|
|
30
|
+
- Run the relevant test or command to confirm the bug exists
|
|
31
|
+
- If no test exists, note the manual reproduction steps
|
|
32
|
+
|
|
33
|
+
### 3. Investigate Root Cause
|
|
34
|
+
|
|
35
|
+
- Read the relevant source files identified from error traces
|
|
36
|
+
- Trace the code path from entry point to error
|
|
37
|
+
- Identify the exact line/logic causing the issue
|
|
38
|
+
- Check git blame to understand when/why the code was written this way
|
|
39
|
+
|
|
40
|
+
### 4. Implement Fix
|
|
41
|
+
|
|
42
|
+
- Write a failing test that reproduces the bug
|
|
43
|
+
- Implement the minimal fix
|
|
44
|
+
- Run the test to verify it passes
|
|
45
|
+
- Run the full test suite to check for regressions
|
|
46
|
+
|
|
47
|
+
### 5. Verify
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Run full verification
|
|
51
|
+
/verify
|
|
52
|
+
|
|
53
|
+
# Check that the fix doesn't break anything
|
|
54
|
+
git diff --stat
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 6. Commit
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Commit with fix type and reference the issue
|
|
61
|
+
git add <specific-files>
|
|
62
|
+
git commit -m "fix(<scope>): <description>
|
|
63
|
+
|
|
64
|
+
Fixes #<issue-number>"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Rules
|
|
68
|
+
|
|
69
|
+
- ALWAYS write a test that reproduces the bug before fixing
|
|
70
|
+
- NEVER fix more than the reported issue (avoid scope creep)
|
|
71
|
+
- ALWAYS run full verification after the fix
|
|
72
|
+
- If the fix requires changes to more than 5 files, stop and plan first
|
|
73
|
+
- Reference the issue number in the commit message
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Git Worktree Management
|
|
2
|
+
|
|
3
|
+
Manage parallel workspaces using git worktrees for concurrent Claude Code sessions.
|
|
4
|
+
|
|
5
|
+
## Setup Worktrees
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Create worktree directory structure
|
|
9
|
+
REPO_NAME="$(basename "$(git rev-parse --show-toplevel)")"
|
|
10
|
+
WORKTREE_BASE="../${REPO_NAME}-worktrees"
|
|
11
|
+
mkdir -p "$WORKTREE_BASE"
|
|
12
|
+
|
|
13
|
+
# Create worktrees (a, b, c) from current branch
|
|
14
|
+
CURRENT="$(git branch --show-current)"
|
|
15
|
+
for SUFFIX in a b c; do
|
|
16
|
+
BRANCH="${CURRENT}-wt-${SUFFIX}"
|
|
17
|
+
TREE_PATH="${WORKTREE_BASE}/${SUFFIX}"
|
|
18
|
+
if [ ! -d "$TREE_PATH" ]; then
|
|
19
|
+
git worktree add -b "$BRANCH" "$TREE_PATH" HEAD
|
|
20
|
+
echo "Created worktree: $TREE_PATH ($BRANCH)"
|
|
21
|
+
else
|
|
22
|
+
echo "Worktree exists: $TREE_PATH"
|
|
23
|
+
fi
|
|
24
|
+
done
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Shell Aliases
|
|
28
|
+
|
|
29
|
+
Add these to your `~/.zshrc` or `~/.bashrc`:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Quick worktree switching
|
|
33
|
+
alias za='cd "$(git rev-parse --show-toplevel)/../$(basename "$(git rev-parse --show-toplevel)")-worktrees/a"'
|
|
34
|
+
alias zb='cd "$(git rev-parse --show-toplevel)/../$(basename "$(git rev-parse --show-toplevel)")-worktrees/b"'
|
|
35
|
+
alias zc='cd "$(git rev-parse --show-toplevel)/../$(basename "$(git rev-parse --show-toplevel)")-worktrees/c"'
|
|
36
|
+
alias z0='cd "$(git rev-parse --show-toplevel)"' # back to main
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Parallel Workflow
|
|
40
|
+
|
|
41
|
+
1. **Main tree (z0):** Primary development, integration
|
|
42
|
+
2. **Worktree A (za):** Feature work - run `claude` here
|
|
43
|
+
3. **Worktree B (zb):** Bug fixes - run `claude` here
|
|
44
|
+
4. **Worktree C (zc):** Experiments/spikes - run `claude` here
|
|
45
|
+
|
|
46
|
+
Each worktree runs its own Claude Code session independently.
|
|
47
|
+
|
|
48
|
+
## Cleanup
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Remove a specific worktree
|
|
52
|
+
git worktree remove "../${REPO_NAME}-worktrees/a"
|
|
53
|
+
|
|
54
|
+
# Remove all worktrees
|
|
55
|
+
git worktree list | grep -v "bare\|$(git rev-parse --show-toplevel)$" | awk '{print $1}' | xargs -I{} git worktree remove {}
|
|
56
|
+
|
|
57
|
+
# Prune stale worktree references
|
|
58
|
+
git worktree prune
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Tips
|
|
62
|
+
|
|
63
|
+
- Each worktree has its own working directory but shares git history
|
|
64
|
+
- Install dependencies separately in each worktree (`npm install` etc.)
|
|
65
|
+
- Commits in any worktree are visible from all others
|
|
66
|
+
- Merge worktree branches back when done: `git merge feature-wt-a`
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PreToolUse": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "Bash",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node -e \"const cmd = process.env.CLAUDE_TOOL_INPUT || '{}'; const parsed = JSON.parse(cmd); const cmdStr = parsed.command || ''; if (/[;&|`$()]/.test(cmdStr)) process.exit(1); const safe = /^(git\\s+(status|log|diff|branch|show|stash)|ls|cat|head|tail|wc|find|grep|echo|pwd|which|node\\s+--version|npm\\s+(test|list|outdated)|npm\\s+run\\s+(test|lint|format|check|typecheck|build)|pnpm\\s+(test|list)|pnpm\\s+run\\s+(test|lint|format|check|typecheck|build)|bun\\s+(test|run\\s+(test|lint|format|check|typecheck|build))|yarn\\s+(test|run\\s+(test|lint|format|check|typecheck|build))|pytest|go\\s+(test|vet|build)|cargo\\s+(test|build|check|clippy)|dotnet\\s+(test|build)|mix\\s+(test|deps)|bundle\\s+exec\\s+(rspec|rubocop))$/.test(cmdStr); process.exit(safe ? 0 : 1)\""
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"_comment": "Auto-approves read-only and test commands. Installed by clauderc to ~/.claude/hooks/. Customize by editing this file."
|
|
16
|
+
}
|
package/templates/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
3
|
-
"generatedAt": "
|
|
2
|
+
"version": "1.1.0",
|
|
3
|
+
"generatedAt": "2026-02-03T00:00:00.000Z",
|
|
4
4
|
"files": {
|
|
5
5
|
"agents/project-setup-wizard.md": {
|
|
6
6
|
"version": "1.0.0",
|
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
"added": "1.0.0",
|
|
18
18
|
"description": "Quick reference for Claude Code templates"
|
|
19
19
|
},
|
|
20
|
+
"skills/evolve-claude-md/SKILL.md": {
|
|
21
|
+
"version": "1.0.0",
|
|
22
|
+
"added": "1.1.0",
|
|
23
|
+
"description": "Self-improving CLAUDE.md - analyzes errors and suggests rule updates"
|
|
24
|
+
},
|
|
25
|
+
"skills/explain/SKILL.md": {
|
|
26
|
+
"version": "1.0.0",
|
|
27
|
+
"added": "1.1.0",
|
|
28
|
+
"description": "Codebase visualization and architecture explanation skill"
|
|
29
|
+
},
|
|
20
30
|
"commands/test.md": {
|
|
21
31
|
"version": "1.0.0",
|
|
22
32
|
"added": "1.0.0",
|
|
@@ -47,6 +57,21 @@
|
|
|
47
57
|
"added": "1.1.0",
|
|
48
58
|
"description": "Semantic commit command"
|
|
49
59
|
},
|
|
60
|
+
"commands/worktree.md": {
|
|
61
|
+
"version": "1.0.0",
|
|
62
|
+
"added": "1.1.0",
|
|
63
|
+
"description": "Git worktree management for parallel Claude Code sessions"
|
|
64
|
+
},
|
|
65
|
+
"commands/fix.md": {
|
|
66
|
+
"version": "1.0.0",
|
|
67
|
+
"added": "1.1.0",
|
|
68
|
+
"description": "Autonomous bug investigation and fixing"
|
|
69
|
+
},
|
|
70
|
+
"hooks/auto-approve.json": {
|
|
71
|
+
"version": "1.0.0",
|
|
72
|
+
"added": "1.1.0",
|
|
73
|
+
"description": "Auto-approve hooks for safe read-only and test commands"
|
|
74
|
+
},
|
|
50
75
|
"templates/project-setup/CLAUDE_MD_TEMPLATE.md": {
|
|
51
76
|
"version": "1.0.0",
|
|
52
77
|
"added": "1.0.0",
|
|
@@ -74,26 +99,50 @@
|
|
|
74
99
|
},
|
|
75
100
|
"cursor/rules/project-analysis.mdc": {
|
|
76
101
|
"version": "1.0.0",
|
|
77
|
-
"added": "
|
|
102
|
+
"added": "1.0.5",
|
|
78
103
|
"provider": "cursor",
|
|
79
104
|
"description": "Project analysis rule for Cursor"
|
|
80
105
|
},
|
|
81
106
|
"cursor/rules/code-templates.mdc": {
|
|
82
107
|
"version": "1.0.0",
|
|
83
|
-
"added": "
|
|
108
|
+
"added": "1.0.5",
|
|
84
109
|
"provider": "cursor",
|
|
85
110
|
"description": "Code templates reference for Cursor"
|
|
86
111
|
},
|
|
87
112
|
"cursor/rules/setup-wizard.mdc": {
|
|
88
113
|
"version": "1.0.0",
|
|
89
|
-
"added": "
|
|
114
|
+
"added": "1.0.5",
|
|
90
115
|
"provider": "cursor",
|
|
91
116
|
"description": "Setup wizard rule for Cursor"
|
|
92
117
|
}
|
|
93
118
|
},
|
|
94
119
|
"changelog": [
|
|
95
120
|
{
|
|
96
|
-
"version": "
|
|
121
|
+
"version": "1.1.0",
|
|
122
|
+
"date": "2026-02-03",
|
|
123
|
+
"changes": {
|
|
124
|
+
"added": [
|
|
125
|
+
"skills/evolve-claude-md - Self-improving CLAUDE.md from error analysis",
|
|
126
|
+
"skills/explain - Codebase visualization and architecture explanation",
|
|
127
|
+
"commands/worktree.md - Git worktree management for parallel sessions",
|
|
128
|
+
"commands/fix.md - Autonomous bug investigation and fixing",
|
|
129
|
+
"hooks/auto-approve.json - Auto-approval for safe commands",
|
|
130
|
+
"Worktree workflow section in generated CLAUDE.md",
|
|
131
|
+
"Advanced prompting section in generated CLAUDE.md",
|
|
132
|
+
"Self-improvement section in generated CLAUDE.md",
|
|
133
|
+
"Subagent pattern guidance in CLAUDE_MD_TEMPLATE"
|
|
134
|
+
],
|
|
135
|
+
"changed": [
|
|
136
|
+
"CLAUDE_MD_TEMPLATE.md updated with Boris Cherny productivity insights",
|
|
137
|
+
"CLI init now creates hooks/ directory",
|
|
138
|
+
"CLI list now shows installed hooks"
|
|
139
|
+
],
|
|
140
|
+
"removed": [],
|
|
141
|
+
"deprecated": []
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"version": "1.0.5",
|
|
97
146
|
"date": "2025-01-25",
|
|
98
147
|
"changes": {
|
|
99
148
|
"added": [
|
|
@@ -21,22 +21,57 @@ Use this template as base for generating project-specific CLAUDE.md files.
|
|
|
21
21
|
|
|
22
22
|
# Build
|
|
23
23
|
{{BUILD_COMMANDS}}
|
|
24
|
+
|
|
25
|
+
# Full verification
|
|
26
|
+
{{VERIFY_COMMAND}}
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
## Code Style
|
|
27
30
|
{{CODE_STYLE_RULES}}
|
|
28
31
|
|
|
29
32
|
## Workflow
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
### Plan Mode
|
|
35
|
+
Use Plan Mode (Shift+Tab 2x) for:
|
|
36
|
+
- Refactoring > 3 files
|
|
37
|
+
- New feature implementation
|
|
38
|
+
- Architecture changes
|
|
39
|
+
- Database migrations
|
|
40
|
+
|
|
41
|
+
### Parallel Workflow (Worktrees)
|
|
42
|
+
For parallel tasks, use git worktrees:
|
|
43
|
+
- Run `/worktree` to set up parallel workspaces
|
|
44
|
+
- Use aliases: `za` (feature), `zb` (bugfix), `zc` (experiment), `z0` (main)
|
|
45
|
+
- Each worktree runs its own Claude Code session independently
|
|
46
|
+
- Merge branches back when done
|
|
47
|
+
|
|
48
|
+
### Verification
|
|
49
|
+
- ALWAYS run `{{VERIFY_COMMAND}}` before committing
|
|
50
|
+
- NEVER skip tests without explicit approval
|
|
51
|
+
|
|
52
|
+
### Advanced Prompting
|
|
53
|
+
- When reviewing changes, grill them: "Is this the best approach? What are the edge cases?"
|
|
54
|
+
- Ask Claude to reimplement elegantly after a working prototype
|
|
55
|
+
- Use subagents for focused tasks (security review, test writing, code review)
|
|
56
|
+
|
|
57
|
+
### Subagents as Default Pattern
|
|
58
|
+
For complex tasks, prefer dispatching subagents:
|
|
59
|
+
- Security review: dedicated security reviewer agent
|
|
60
|
+
- Test generation: dedicated test writer agent
|
|
61
|
+
- Code review: dedicated code reviewer agent
|
|
62
|
+
- Each agent has focused context and expertise
|
|
33
63
|
|
|
34
64
|
## Conventions
|
|
35
65
|
- Commits: [Conventional Commits](https://conventionalcommits.org) — `<type>(<scope>): <subject>`
|
|
36
66
|
- Types: feat, fix, docs, style, refactor, perf, test, chore, ci
|
|
37
67
|
- Breaking changes: `!` suffix or `BREAKING CHANGE:` footer
|
|
38
68
|
- PRs: same title format, structured body (Summary, Changes, Test Plan)
|
|
39
|
-
- Versioning: feat
|
|
69
|
+
- Versioning: feat -> MINOR, fix -> PATCH, breaking -> MAJOR
|
|
70
|
+
|
|
71
|
+
## Self-Improvement
|
|
72
|
+
- After fixing bugs, run `/evolve-claude-md` to capture learnings
|
|
73
|
+
- Claude is good at writing rules for itself - let it suggest CLAUDE.md updates
|
|
74
|
+
- Review and approve suggestions before applying
|
|
40
75
|
|
|
41
76
|
## Architecture
|
|
42
77
|
{{ARCHITECTURE_NOTES}}
|
|
@@ -54,3 +89,5 @@ Use this template as base for generating project-specific CLAUDE.md files.
|
|
|
54
89
|
3. **Focus on what's different** - Don't repeat language defaults
|
|
55
90
|
4. **Use @imports for details** - `@docs/architecture.md` instead of inline
|
|
56
91
|
5. **Update the date** - Add `Last updated: YYYY-MM-DD` at bottom
|
|
92
|
+
6. **Self-improve** - Run `/evolve-claude-md` after incidents to capture learnings
|
|
93
|
+
7. **Parallel-ready** - Document worktree workflow if team uses it
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Evolve CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Analyze recent errors, PR feedback, and debugging sessions to suggest improvements to the project's CLAUDE.md. Claude is surprisingly good at writing rules for itself.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- After fixing a bug that could have been prevented by better instructions
|
|
8
|
+
- After a PR review reveals missing conventions
|
|
9
|
+
- After a debugging session uncovers undocumented patterns
|
|
10
|
+
- Periodically (weekly/sprint) to refine project rules
|
|
11
|
+
- After onboarding a new team member who hit friction
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
### 1. Gather Context
|
|
16
|
+
|
|
17
|
+
Collect recent signals about what went wrong or could be improved:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Recent commits (look for fix/refactor patterns)
|
|
21
|
+
git log --oneline -20 --grep="fix\|refactor\|revert"
|
|
22
|
+
|
|
23
|
+
# Recent PR comments (if using GitHub)
|
|
24
|
+
gh pr list --state merged --limit 5 --json number,title | head -20
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Analyze Current CLAUDE.md
|
|
28
|
+
|
|
29
|
+
Read the existing CLAUDE.md and identify:
|
|
30
|
+
- Missing commands or outdated commands
|
|
31
|
+
- Missing conventions that caused recent bugs
|
|
32
|
+
- Missing architecture notes that led to wrong approaches
|
|
33
|
+
- Missing workflow guidance
|
|
34
|
+
|
|
35
|
+
### 3. Identify Improvement Categories
|
|
36
|
+
|
|
37
|
+
| Category | Signal | Example Rule to Add |
|
|
38
|
+
|----------|--------|---------------------|
|
|
39
|
+
| **Missing Convention** | Repeated style fixes in PRs | "Always use named exports" |
|
|
40
|
+
| **Undocumented Pattern** | Bug from wrong usage | "Use `trx` for DB transactions" |
|
|
41
|
+
| **Outdated Command** | Command fails or changed | Update test/build commands |
|
|
42
|
+
| **Missing Guard Rail** | Repeated mistake | "Never modify migration files" |
|
|
43
|
+
| **Architecture Gap** | Wrong file placement | "API routes go in `src/routes/`" |
|
|
44
|
+
| **Missing Context** | Wrong assumptions | "This is a multi-tenant app" |
|
|
45
|
+
|
|
46
|
+
### 4. Generate Suggestions
|
|
47
|
+
|
|
48
|
+
For each improvement, provide:
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
## Suggested Addition: [Category]
|
|
52
|
+
|
|
53
|
+
**Signal:** [What happened that revealed this gap]
|
|
54
|
+
|
|
55
|
+
**Current CLAUDE.md:** [What it says now, or "missing"]
|
|
56
|
+
|
|
57
|
+
**Proposed Change:**
|
|
58
|
+
[Exact text to add/modify in CLAUDE.md]
|
|
59
|
+
|
|
60
|
+
**Rationale:** [Why this prevents future issues]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 5. Apply Changes
|
|
64
|
+
|
|
65
|
+
After approval, update CLAUDE.md with the accepted suggestions.
|
|
66
|
+
Keep CLAUDE.md under 100 lines - use @imports for detailed docs.
|
|
67
|
+
|
|
68
|
+
## Rules
|
|
69
|
+
|
|
70
|
+
- NEVER remove existing rules without explicit approval
|
|
71
|
+
- ALWAYS explain WHY a rule is being added (cite the incident)
|
|
72
|
+
- PREFER specific rules over vague guidelines
|
|
73
|
+
- KEEP rules actionable - "do X" not "consider X"
|
|
74
|
+
- GROUP related rules under existing sections when possible
|
|
75
|
+
- USE @imports if CLAUDE.md exceeds 100 lines
|
|
76
|
+
|
|
77
|
+
## Examples
|
|
78
|
+
|
|
79
|
+
### Example 1: After a bug fix
|
|
80
|
+
|
|
81
|
+
**Signal:** Fixed a bug where API response wasn't validated
|
|
82
|
+
|
|
83
|
+
**Proposed Addition to CLAUDE.md:**
|
|
84
|
+
```markdown
|
|
85
|
+
## API Conventions
|
|
86
|
+
- Always validate API responses with zod schemas before using data
|
|
87
|
+
- Never trust external API response shapes - they can change
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Example 2: After PR feedback
|
|
91
|
+
|
|
92
|
+
**Signal:** PR reviewer noted inconsistent error handling
|
|
93
|
+
|
|
94
|
+
**Proposed Addition to CLAUDE.md:**
|
|
95
|
+
```markdown
|
|
96
|
+
## Error Handling
|
|
97
|
+
- Use `AppError` class for all application errors
|
|
98
|
+
- Always include error code, message, and context
|
|
99
|
+
- Log errors with structured logging (`logger.error({ err, context })`)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Example 3: After debugging session
|
|
103
|
+
|
|
104
|
+
**Signal:** Spent 30 minutes debugging because test DB wasn't reset
|
|
105
|
+
|
|
106
|
+
**Proposed Addition to CLAUDE.md:**
|
|
107
|
+
```markdown
|
|
108
|
+
## Testing
|
|
109
|
+
- Run `npm run db:reset:test` before test suites
|
|
110
|
+
- Tests use isolated DB transactions (auto-rolled back)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Checklist
|
|
114
|
+
|
|
115
|
+
- [ ] Reviewed recent git history for fix/refactor commits
|
|
116
|
+
- [ ] Checked recent PR comments for recurring feedback
|
|
117
|
+
- [ ] Identified gaps in current CLAUDE.md
|
|
118
|
+
- [ ] Generated specific, actionable suggestions
|
|
119
|
+
- [ ] Each suggestion cites the originating signal
|
|
120
|
+
- [ ] CLAUDE.md stays under 100 lines (use @imports if needed)
|
|
121
|
+
- [ ] No existing rules were removed without approval
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Explain Codebase
|
|
2
|
+
|
|
3
|
+
Learning mode - generates visual explanations of codebase architecture, data flows, and component relationships using ASCII diagrams or HTML presentations.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Onboarding to a new codebase
|
|
8
|
+
- Understanding a complex module before modifying it
|
|
9
|
+
- Documenting architecture for the team
|
|
10
|
+
- Before a major refactoring to understand current state
|
|
11
|
+
- Explaining a subsystem to a colleague
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
### 1. Identify Scope
|
|
16
|
+
|
|
17
|
+
Ask: "What part of the codebase do you want to understand?"
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
- **Full architecture** - High-level system overview
|
|
21
|
+
- **Module deep-dive** - One module/package in detail
|
|
22
|
+
- **Data flow** - How data moves through the system
|
|
23
|
+
- **Dependency map** - What depends on what
|
|
24
|
+
- **API surface** - Public interfaces and endpoints
|
|
25
|
+
|
|
26
|
+
### 2. Gather Information
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Project structure
|
|
30
|
+
find . -type f -name "*.{js,ts,py,go,rs}" | head -50
|
|
31
|
+
|
|
32
|
+
# Entry points
|
|
33
|
+
ls src/index.* src/main.* src/app.* app/main.* cmd/main.* 2>/dev/null
|
|
34
|
+
|
|
35
|
+
# Dependencies between modules
|
|
36
|
+
grep -r "import.*from" src/ --include="*.{js,ts}" | head -30
|
|
37
|
+
# or for Python
|
|
38
|
+
grep -r "^from\|^import" src/ --include="*.py" | head -30
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. Generate Explanation
|
|
42
|
+
|
|
43
|
+
Choose output format based on complexity:
|
|
44
|
+
|
|
45
|
+
#### ASCII Diagram (default - works everywhere)
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
+------------------+ +------------------+
|
|
49
|
+
| API Gateway |---->| Auth Service |
|
|
50
|
+
+------------------+ +------------------+
|
|
51
|
+
| |
|
|
52
|
+
v v
|
|
53
|
+
+------------------+ +------------------+
|
|
54
|
+
| Request Router | | User Store |
|
|
55
|
+
+------------------+ +------------------+
|
|
56
|
+
|
|
|
57
|
+
+----+----+
|
|
58
|
+
| |
|
|
59
|
+
v v
|
|
60
|
+
+------+ +------+
|
|
61
|
+
| Users | | Posts |
|
|
62
|
+
+------+ +------+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Data Flow Diagram
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Request -> Middleware -> Controller -> Service -> Repository -> Database
|
|
69
|
+
|
|
|
70
|
+
v
|
|
71
|
+
Cache
|
|
72
|
+
|
|
|
73
|
+
v
|
|
74
|
+
Response
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Module Dependency Map
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
src/
|
|
81
|
+
index.js ─────────> app.js
|
|
82
|
+
|
|
|
83
|
+
+-----+-----+
|
|
84
|
+
| |
|
|
85
|
+
routes/ middleware/
|
|
86
|
+
| |
|
|
87
|
+
controllers/ auth.js
|
|
88
|
+
|
|
|
89
|
+
services/
|
|
90
|
+
|
|
|
91
|
+
models/
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 4. Add Context
|
|
95
|
+
|
|
96
|
+
For each component in the diagram, provide:
|
|
97
|
+
|
|
98
|
+
| Component | Purpose | Key Files | Dependencies |
|
|
99
|
+
|-----------|---------|-----------|--------------|
|
|
100
|
+
| API Gateway | HTTP entry point | `src/app.js` | express, cors |
|
|
101
|
+
| Auth Service | JWT validation | `src/auth/` | jsonwebtoken |
|
|
102
|
+
| User Store | User CRUD | `src/models/user.js` | mongoose |
|
|
103
|
+
|
|
104
|
+
### 5. Generate HTML (optional, for richer output)
|
|
105
|
+
|
|
106
|
+
If requested, generate a self-contained HTML file with:
|
|
107
|
+
- Interactive component diagram (SVG)
|
|
108
|
+
- Collapsible sections for each module
|
|
109
|
+
- Color-coded dependency visualization
|
|
110
|
+
- Search functionality
|
|
111
|
+
|
|
112
|
+
Save to: `docs/architecture-explanation.html`
|
|
113
|
+
|
|
114
|
+
## Output Formats
|
|
115
|
+
|
|
116
|
+
| Format | Best For | Command |
|
|
117
|
+
|--------|----------|---------|
|
|
118
|
+
| ASCII | Quick overview, terminal | Default |
|
|
119
|
+
| Markdown table | Documentation | "explain as markdown" |
|
|
120
|
+
| HTML | Presentations, sharing | "explain as HTML" |
|
|
121
|
+
| Mermaid | GitHub-rendered diagrams | "explain as mermaid" |
|
|
122
|
+
|
|
123
|
+
## Checklist
|
|
124
|
+
|
|
125
|
+
- [ ] Identified the scope (full/module/flow/deps/api)
|
|
126
|
+
- [ ] Gathered file structure and imports
|
|
127
|
+
- [ ] Generated appropriate diagram type
|
|
128
|
+
- [ ] Added context table for each component
|
|
129
|
+
- [ ] Verified diagram matches actual code structure
|
|
130
|
+
- [ ] Saved output in requested format
|