@yeongjaeyou/claude-code-config 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/code-review-handler.md +79 -0
- package/.claude/agents/issue-resolver.md +123 -0
- package/.claude/agents/python-pro.md +7 -2
- package/.claude/agents/web-researcher.md +5 -1
- package/.claude/commands/ask-deepwiki.md +46 -11
- package/.claude/commands/gh/auto-review-loop.md +178 -0
- package/.claude/commands/gh/create-issue-label.md +4 -0
- package/.claude/commands/gh/decompose-issue.md +24 -2
- package/.claude/commands/gh/post-merge.md +52 -10
- package/.claude/commands/gh/resolve-and-review.md +69 -0
- package/.claude/commands/gh/resolve-issue.md +3 -0
- package/.claude/commands/tm/convert-prd.md +4 -0
- package/.claude/commands/tm/post-merge.md +7 -1
- package/.claude/commands/tm/resolve-issue.md +4 -0
- package/.claude/commands/tm/sync-to-github.md +4 -0
- package/.claude/settings.json +15 -0
- package/.claude/skills/claude-md-generator/SKILL.md +130 -0
- package/.claude/skills/claude-md-generator/references/examples.md +261 -0
- package/.claude/skills/claude-md-generator/references/templates.md +156 -0
- package/.claude/skills/hook-creator/SKILL.md +88 -0
- package/.claude/skills/hook-creator/references/examples.md +339 -0
- package/.claude/skills/hook-creator/references/hook-events.md +193 -0
- package/.claude/skills/skill-creator/SKILL.md +160 -13
- package/.claude/skills/skill-creator/references/output-patterns.md +82 -0
- package/.claude/skills/skill-creator/references/workflows.md +28 -0
- package/.claude/skills/skill-creator/scripts/package_skill.py +10 -10
- package/.claude/skills/skill-creator/scripts/quick_validate.py +45 -15
- package/.claude/skills/slash-command-creator/SKILL.md +108 -0
- package/.claude/skills/slash-command-creator/references/examples.md +161 -0
- package/.claude/skills/slash-command-creator/references/frontmatter.md +74 -0
- package/.claude/skills/slash-command-creator/scripts/init_command.py +221 -0
- package/.claude/skills/subagent-creator/SKILL.md +127 -0
- package/.claude/skills/subagent-creator/assets/subagent-template.md +31 -0
- package/.claude/skills/subagent-creator/references/available-tools.md +63 -0
- package/.claude/skills/subagent-creator/references/examples.md +213 -0
- package/.claude/skills/youtube-collector/README.md +107 -0
- package/.claude/skills/youtube-collector/SKILL.md +158 -0
- package/.claude/skills/youtube-collector/references/data-schema.md +110 -0
- package/.claude/skills/youtube-collector/scripts/collect_videos.py +304 -0
- package/.claude/skills/youtube-collector/scripts/fetch_transcript.py +138 -0
- package/.claude/skills/youtube-collector/scripts/fetch_videos.py +229 -0
- package/.claude/skills/youtube-collector/scripts/register_channel.py +247 -0
- package/.claude/skills/youtube-collector/scripts/setup_api_key.py +151 -0
- package/package.json +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Post-Merge Cleanup (TaskMaster Integration)
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# Post-Merge Cleanup (TaskMaster Integration)
|
|
2
6
|
|
|
3
7
|
After PR merge, perform branch cleanup, TaskMaster status update, and CLAUDE.md update.
|
|
@@ -12,7 +16,9 @@ Follow project guidelines in `@CLAUDE.md`.
|
|
|
12
16
|
|
|
13
17
|
## Arguments
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
`$ARGUMENTS` parsing:
|
|
20
|
+
- If provided: Use as PR number (e.g., `/tm:post-merge 42`)
|
|
21
|
+
- If empty: Determine from conversation context or show recent merged PR list for selection
|
|
16
22
|
|
|
17
23
|
---
|
|
18
24
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-md-generator
|
|
3
|
+
description: Generate or restructure CLAUDE.md systems for any project. This skill should be used when starting new projects (provide project description + tech stack), reorganizing existing CLAUDE.md files into modular .claude/rules/ structures, or creating team coding standards with central control and delegation patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLAUDE.md Generator
|
|
7
|
+
|
|
8
|
+
This skill designs optimized CLAUDE.md systems following Claude Code official patterns with central control and delegation structure.
|
|
9
|
+
|
|
10
|
+
## Role
|
|
11
|
+
|
|
12
|
+
Act as an AI Context Architect with authority to design and implement CLAUDE.md systems. Analyze project structure, identify high-context zones, and create modular rule files.
|
|
13
|
+
|
|
14
|
+
## Core Philosophy
|
|
15
|
+
|
|
16
|
+
1. **500-Line Limit** - All context files must remain under 500 lines for readability and token efficiency
|
|
17
|
+
2. **No Emojis** - Never use emojis anywhere for maximum context efficiency
|
|
18
|
+
3. **Central Control + Delegation** - Root file serves as control tower; details delegate to `.claude/rules/`
|
|
19
|
+
4. **Golden Rules** - Provide Do's/Don'ts format for clear behavioral guidance
|
|
20
|
+
5. **@import Syntax** - Use `@path/to/file.md` for referencing modular rules
|
|
21
|
+
|
|
22
|
+
## Operation Modes
|
|
23
|
+
|
|
24
|
+
### Mode 1: New Project
|
|
25
|
+
|
|
26
|
+
When no CLAUDE.md exists:
|
|
27
|
+
|
|
28
|
+
1. Collect project description (1-2 sentences) and tech stack
|
|
29
|
+
2. Analyze directory structure to identify boundaries
|
|
30
|
+
3. Propose file list with paths and roles
|
|
31
|
+
4. Wait for user confirmation
|
|
32
|
+
5. Generate files sequentially
|
|
33
|
+
6. Summarize created structure
|
|
34
|
+
|
|
35
|
+
### Mode 2: Restructure Existing
|
|
36
|
+
|
|
37
|
+
When CLAUDE.md already exists:
|
|
38
|
+
|
|
39
|
+
1. Read and analyze current CLAUDE.md content
|
|
40
|
+
2. Identify sections that should delegate to `.claude/rules/`
|
|
41
|
+
3. Propose restructuring plan showing before/after
|
|
42
|
+
4. Preserve existing information while improving structure
|
|
43
|
+
5. Wait for user confirmation
|
|
44
|
+
6. Execute restructuring
|
|
45
|
+
7. Summarize changes
|
|
46
|
+
|
|
47
|
+
## Execution Flow
|
|
48
|
+
|
|
49
|
+
1. **Analyze** - Scan project structure, identify Dependency/Framework/Logical boundaries
|
|
50
|
+
2. **Propose** - List files to create with paths and brief descriptions
|
|
51
|
+
3. **Confirm** - Wait for user approval before any file operations
|
|
52
|
+
4. **Generate** - Create files sequentially after approval
|
|
53
|
+
5. **Summarize** - Report created files and provide next steps
|
|
54
|
+
|
|
55
|
+
## Boundary Detection
|
|
56
|
+
|
|
57
|
+
Create separate `.claude/rules/*.md` files when these signals appear:
|
|
58
|
+
|
|
59
|
+
**Dependency Boundary**
|
|
60
|
+
- Separate package.json, requirements.txt, Cargo.toml, etc.
|
|
61
|
+
- Indicates isolated dependency scope
|
|
62
|
+
|
|
63
|
+
**Framework Boundary**
|
|
64
|
+
- Tech stack transition points (frontend/backend, API/infra)
|
|
65
|
+
- Different tooling or patterns required
|
|
66
|
+
|
|
67
|
+
**Logical Boundary**
|
|
68
|
+
- High business logic density modules
|
|
69
|
+
- Core engine, billing, auth, ML pipeline, etc.
|
|
70
|
+
|
|
71
|
+
## Agent Rules
|
|
72
|
+
|
|
73
|
+
1. **Analyze First** - Always scan project structure before proposing
|
|
74
|
+
2. **Propose Before Execute** - Present file list and wait for confirmation
|
|
75
|
+
3. **Preserve Existing** - When restructuring, keep existing information intact
|
|
76
|
+
4. **Markdown Only** - Output valid Markdown without unnecessary prose
|
|
77
|
+
|
|
78
|
+
## Official Patterns
|
|
79
|
+
|
|
80
|
+
### Folder Structure
|
|
81
|
+
|
|
82
|
+
Claude Code recognizes this hierarchy:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
.claude/
|
|
86
|
+
├── CLAUDE.md # Alternative to root CLAUDE.md
|
|
87
|
+
├── CLAUDE.local.md # Personal overrides (auto-gitignored)
|
|
88
|
+
├── rules/ # Modular rules (AUTO-LOADED)
|
|
89
|
+
│ ├── code-style.md
|
|
90
|
+
│ ├── testing.md
|
|
91
|
+
│ └── security.md
|
|
92
|
+
├── agents/ # Custom subagents
|
|
93
|
+
├── skills/ # Project skills
|
|
94
|
+
└── settings.json # Project settings
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### @import Syntax
|
|
98
|
+
|
|
99
|
+
Reference other files using `@` syntax:
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
See @.claude/rules/models.md for model architecture guidance
|
|
103
|
+
See @README.md for project overview
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Path-Specific Rules
|
|
107
|
+
|
|
108
|
+
Use `paths:` frontmatter for conditional loading:
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
---
|
|
112
|
+
paths: src/models/**/*.py
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
# Model Rules
|
|
116
|
+
[These rules only apply when working on matching files]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Maintenance Policy
|
|
120
|
+
|
|
121
|
+
When rules and actual code diverge:
|
|
122
|
+
- Report the discrepancy to user
|
|
123
|
+
- Propose update (either modify rules or suggest code changes)
|
|
124
|
+
- Apply changes only after confirmation
|
|
125
|
+
|
|
126
|
+
## References
|
|
127
|
+
|
|
128
|
+
For detailed templates and examples, see:
|
|
129
|
+
- @references/templates.md - Root and rules file templates
|
|
130
|
+
- @references/examples.md - Project type examples (ML, Web, CLI, Monorepo)
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Project Type Examples
|
|
2
|
+
|
|
3
|
+
## Python ML/DL Project
|
|
4
|
+
|
|
5
|
+
**Input:**
|
|
6
|
+
```
|
|
7
|
+
Project: Deepfake detection using DINOv3-ViT with LoRA adaptation
|
|
8
|
+
Tech: Python, PyTorch, Optuna, YOLO, Gradio
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Output Structure:**
|
|
12
|
+
```
|
|
13
|
+
./CLAUDE.md (root - overview + @imports)
|
|
14
|
+
.claude/rules/
|
|
15
|
+
- models.md # paths: src/models/**/*.py
|
|
16
|
+
- data.md # paths: src/data/**/*.py
|
|
17
|
+
- inference.md # paths: src/inference/**/*.py
|
|
18
|
+
- optimization.md # paths: src/optimization/**/*.py
|
|
19
|
+
- labeling.md # paths: src/labeling/**/*.py
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Sample Root CLAUDE.md:**
|
|
23
|
+
```markdown
|
|
24
|
+
# CLAUDE.md
|
|
25
|
+
|
|
26
|
+
## Project Context
|
|
27
|
+
|
|
28
|
+
Deepfake detection competition project using DINOv3-ViT with LoRA adaptation.
|
|
29
|
+
Tech: Python 3.11, PyTorch, Optuna, YOLO-Face, Gradio
|
|
30
|
+
|
|
31
|
+
## Operational Commands
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv sync
|
|
35
|
+
uv run python run_inference.py
|
|
36
|
+
uv run pytest tests/
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Golden Rules
|
|
40
|
+
|
|
41
|
+
### Immutable
|
|
42
|
+
|
|
43
|
+
- BGR to RGB conversion required for all OpenCV inputs
|
|
44
|
+
- LoRA rank/alpha must match checkpoint exactly
|
|
45
|
+
|
|
46
|
+
### Do's
|
|
47
|
+
|
|
48
|
+
- Use albumentations for image augmentation
|
|
49
|
+
- Back-half sampling for video inference
|
|
50
|
+
|
|
51
|
+
### Don'ts
|
|
52
|
+
|
|
53
|
+
- Optimize solely for local metrics (inverse LDB correlation)
|
|
54
|
+
- Use system Python directly
|
|
55
|
+
|
|
56
|
+
## Modular Rules
|
|
57
|
+
|
|
58
|
+
See @.claude/rules/models.md for detector architecture and checkpoints
|
|
59
|
+
See @.claude/rules/data.md for preprocessing, caching, face detection
|
|
60
|
+
See @.claude/rules/inference.md for prediction pipeline and aggregation
|
|
61
|
+
See @.claude/rules/optimization.md for Optuna hyperparameter tuning
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Web Application (Fullstack)
|
|
67
|
+
|
|
68
|
+
**Input:**
|
|
69
|
+
```
|
|
70
|
+
Project: SaaS dashboard with user auth and billing
|
|
71
|
+
Tech: Next.js 14, TypeScript, Prisma, Stripe, Tailwind
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Output Structure:**
|
|
75
|
+
```
|
|
76
|
+
./CLAUDE.md (root)
|
|
77
|
+
.claude/rules/
|
|
78
|
+
- api.md # paths: app/api/**/*
|
|
79
|
+
- components.md # paths: components/**/*
|
|
80
|
+
- auth.md # paths: lib/auth/**/*
|
|
81
|
+
- billing.md # paths: lib/billing/**/*
|
|
82
|
+
- db.md # paths: prisma/**/*
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Sample Root CLAUDE.md:**
|
|
86
|
+
```markdown
|
|
87
|
+
# CLAUDE.md
|
|
88
|
+
|
|
89
|
+
## Project Context
|
|
90
|
+
|
|
91
|
+
SaaS dashboard with authentication, team management, and Stripe billing.
|
|
92
|
+
Tech: Next.js 14 (App Router), TypeScript, Prisma, Stripe, Tailwind CSS
|
|
93
|
+
|
|
94
|
+
## Operational Commands
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm install
|
|
98
|
+
pnpm dev
|
|
99
|
+
pnpm test
|
|
100
|
+
pnpm db:push
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Golden Rules
|
|
104
|
+
|
|
105
|
+
### Immutable
|
|
106
|
+
|
|
107
|
+
- Never commit .env files
|
|
108
|
+
- All API routes require authentication middleware
|
|
109
|
+
|
|
110
|
+
### Do's
|
|
111
|
+
|
|
112
|
+
- Use server components by default
|
|
113
|
+
- Validate all inputs with Zod
|
|
114
|
+
|
|
115
|
+
### Don'ts
|
|
116
|
+
|
|
117
|
+
- Store API keys in client code
|
|
118
|
+
- Skip error boundaries
|
|
119
|
+
|
|
120
|
+
## Modular Rules
|
|
121
|
+
|
|
122
|
+
See @.claude/rules/api.md for API route patterns
|
|
123
|
+
See @.claude/rules/components.md for UI component guidelines
|
|
124
|
+
See @.claude/rules/auth.md for authentication flow
|
|
125
|
+
See @.claude/rules/billing.md for Stripe integration
|
|
126
|
+
See @.claude/rules/db.md for Prisma schema conventions
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## CLI Tool
|
|
132
|
+
|
|
133
|
+
**Input:**
|
|
134
|
+
```
|
|
135
|
+
Project: CLI for managing cloud infrastructure
|
|
136
|
+
Tech: Rust, clap, tokio, AWS SDK
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Output Structure:**
|
|
140
|
+
```
|
|
141
|
+
./CLAUDE.md (root)
|
|
142
|
+
.claude/rules/
|
|
143
|
+
- commands.md # paths: src/commands/**/*
|
|
144
|
+
- core.md # paths: src/core/**/*
|
|
145
|
+
- aws.md # paths: src/aws/**/*
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Sample Root CLAUDE.md:**
|
|
149
|
+
```markdown
|
|
150
|
+
# CLAUDE.md
|
|
151
|
+
|
|
152
|
+
## Project Context
|
|
153
|
+
|
|
154
|
+
CLI tool for managing AWS infrastructure with declarative configs.
|
|
155
|
+
Tech: Rust, clap (CLI parsing), tokio (async), AWS SDK
|
|
156
|
+
|
|
157
|
+
## Operational Commands
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
cargo build --release
|
|
161
|
+
cargo test
|
|
162
|
+
cargo run -- --help
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Golden Rules
|
|
166
|
+
|
|
167
|
+
### Immutable
|
|
168
|
+
|
|
169
|
+
- All AWS operations must be idempotent
|
|
170
|
+
- Never store credentials in code
|
|
171
|
+
|
|
172
|
+
### Do's
|
|
173
|
+
|
|
174
|
+
- Use structured logging with tracing
|
|
175
|
+
- Provide --dry-run for destructive operations
|
|
176
|
+
|
|
177
|
+
### Don'ts
|
|
178
|
+
|
|
179
|
+
- Block the async runtime
|
|
180
|
+
- Panic in library code
|
|
181
|
+
|
|
182
|
+
## Modular Rules
|
|
183
|
+
|
|
184
|
+
See @.claude/rules/commands.md for CLI command structure
|
|
185
|
+
See @.claude/rules/core.md for business logic patterns
|
|
186
|
+
See @.claude/rules/aws.md for AWS SDK usage
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Monorepo
|
|
192
|
+
|
|
193
|
+
**Input:**
|
|
194
|
+
```
|
|
195
|
+
Project: E-commerce platform with web, mobile API, and shared packages
|
|
196
|
+
Tech: Turborepo, Next.js, Fastify, React Native, TypeScript
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Output Structure:**
|
|
200
|
+
```
|
|
201
|
+
./CLAUDE.md (root - routing only)
|
|
202
|
+
apps/
|
|
203
|
+
web/CLAUDE.md # Next.js storefront
|
|
204
|
+
api/CLAUDE.md # Fastify backend
|
|
205
|
+
mobile/CLAUDE.md # React Native app
|
|
206
|
+
packages/
|
|
207
|
+
shared/CLAUDE.md # Shared utilities
|
|
208
|
+
ui/CLAUDE.md # Component library
|
|
209
|
+
infra/CLAUDE.md # Terraform/Pulumi
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Sample Root CLAUDE.md:**
|
|
213
|
+
```markdown
|
|
214
|
+
# CLAUDE.md
|
|
215
|
+
|
|
216
|
+
## Project Context
|
|
217
|
+
|
|
218
|
+
E-commerce platform monorepo with web storefront, API, mobile app, and shared packages.
|
|
219
|
+
Tech: Turborepo, pnpm workspaces, TypeScript throughout
|
|
220
|
+
|
|
221
|
+
## Operational Commands
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
pnpm install
|
|
225
|
+
pnpm dev # Run all apps
|
|
226
|
+
pnpm build # Build all packages
|
|
227
|
+
pnpm test # Test all packages
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Golden Rules
|
|
231
|
+
|
|
232
|
+
### Immutable
|
|
233
|
+
|
|
234
|
+
- All packages must have explicit dependencies (no implicit imports)
|
|
235
|
+
- Shared types live in @repo/shared only
|
|
236
|
+
|
|
237
|
+
### Do's
|
|
238
|
+
|
|
239
|
+
- Use workspace protocol for internal deps
|
|
240
|
+
- Run affected tests before PR
|
|
241
|
+
|
|
242
|
+
### Don'ts
|
|
243
|
+
|
|
244
|
+
- Import directly from other apps
|
|
245
|
+
- Skip the build step for packages
|
|
246
|
+
|
|
247
|
+
## App-Specific Rules
|
|
248
|
+
|
|
249
|
+
Web storefront: @apps/web/CLAUDE.md
|
|
250
|
+
API server: @apps/api/CLAUDE.md
|
|
251
|
+
Mobile app: @apps/mobile/CLAUDE.md
|
|
252
|
+
|
|
253
|
+
## Package Rules
|
|
254
|
+
|
|
255
|
+
Shared utilities: @packages/shared/CLAUDE.md
|
|
256
|
+
UI components: @packages/ui/CLAUDE.md
|
|
257
|
+
|
|
258
|
+
## Infrastructure
|
|
259
|
+
|
|
260
|
+
Terraform configs: @infra/CLAUDE.md
|
|
261
|
+
```
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Templates
|
|
2
|
+
|
|
3
|
+
## Root CLAUDE.md Template
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
# CLAUDE.md
|
|
7
|
+
|
|
8
|
+
## Project Context
|
|
9
|
+
|
|
10
|
+
[1-2 line business goal + tech stack summary]
|
|
11
|
+
|
|
12
|
+
## Operational Commands
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# [Package manager commands]
|
|
16
|
+
[install command]
|
|
17
|
+
[run command]
|
|
18
|
+
[test command]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Golden Rules
|
|
22
|
+
|
|
23
|
+
### Immutable
|
|
24
|
+
|
|
25
|
+
- [Non-negotiable security/architecture constraints]
|
|
26
|
+
- [Critical patterns that must never be violated]
|
|
27
|
+
|
|
28
|
+
### Do's
|
|
29
|
+
|
|
30
|
+
- [Clear positive actions]
|
|
31
|
+
- [Required patterns]
|
|
32
|
+
|
|
33
|
+
### Don'ts
|
|
34
|
+
|
|
35
|
+
- [Clear prohibitions]
|
|
36
|
+
- [Anti-patterns to avoid]
|
|
37
|
+
|
|
38
|
+
## Modular Rules
|
|
39
|
+
|
|
40
|
+
See @.claude/rules/[module].md for [description]
|
|
41
|
+
See @.claude/rules/[module].md for [description]
|
|
42
|
+
|
|
43
|
+
## [Project-Specific Sections]
|
|
44
|
+
|
|
45
|
+
[Data locations, submission tracking, deployment info, etc.]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Rules File Template (General)
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
---
|
|
52
|
+
paths: [glob pattern, optional]
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
# [Module] Rules
|
|
56
|
+
|
|
57
|
+
## Role
|
|
58
|
+
|
|
59
|
+
[What this module does, 1-2 lines]
|
|
60
|
+
|
|
61
|
+
## Dependencies
|
|
62
|
+
|
|
63
|
+
- [Key external libraries]
|
|
64
|
+
- [Internal module dependencies]
|
|
65
|
+
|
|
66
|
+
## Patterns
|
|
67
|
+
|
|
68
|
+
- [Common code patterns]
|
|
69
|
+
- [File naming conventions]
|
|
70
|
+
- [Directory structure expectations]
|
|
71
|
+
|
|
72
|
+
## Do's
|
|
73
|
+
|
|
74
|
+
- [Module-specific positive actions]
|
|
75
|
+
- [Required patterns for this area]
|
|
76
|
+
|
|
77
|
+
### Don'ts
|
|
78
|
+
|
|
79
|
+
- [Module-specific prohibitions]
|
|
80
|
+
- [Common mistakes to avoid]
|
|
81
|
+
|
|
82
|
+
## Testing
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
[Module-specific test commands]
|
|
86
|
+
```
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Rules File Template (Path-Specific)
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
---
|
|
93
|
+
paths: src/api/**/*.ts, src/api/**/*.tsx
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
# API Development Rules
|
|
97
|
+
|
|
98
|
+
## Role
|
|
99
|
+
|
|
100
|
+
Handle all backend API routes and server-side logic.
|
|
101
|
+
|
|
102
|
+
## Patterns
|
|
103
|
+
|
|
104
|
+
- All endpoints follow REST conventions
|
|
105
|
+
- Use standard error response format
|
|
106
|
+
- Include input validation on all routes
|
|
107
|
+
|
|
108
|
+
## Do's
|
|
109
|
+
|
|
110
|
+
- Validate all incoming data
|
|
111
|
+
- Return consistent error structures
|
|
112
|
+
- Log meaningful error context
|
|
113
|
+
|
|
114
|
+
## Don'ts
|
|
115
|
+
|
|
116
|
+
- Expose internal error details to clients
|
|
117
|
+
- Skip authentication checks
|
|
118
|
+
- Use raw SQL without parameterization
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Restructured Root Template
|
|
122
|
+
|
|
123
|
+
When converting a large CLAUDE.md to modular structure:
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
# CLAUDE.md
|
|
127
|
+
|
|
128
|
+
## Project Context
|
|
129
|
+
|
|
130
|
+
[Keep existing overview, condensed to 2-3 lines]
|
|
131
|
+
|
|
132
|
+
## Operational Commands
|
|
133
|
+
|
|
134
|
+
[Keep essential commands only]
|
|
135
|
+
|
|
136
|
+
## Golden Rules
|
|
137
|
+
|
|
138
|
+
### Immutable
|
|
139
|
+
|
|
140
|
+
[Extract from existing, keep only critical rules]
|
|
141
|
+
|
|
142
|
+
### Do's / Don'ts
|
|
143
|
+
|
|
144
|
+
[Keep top 5-7 most important rules here]
|
|
145
|
+
|
|
146
|
+
## Modular Rules
|
|
147
|
+
|
|
148
|
+
Architecture and core pipeline: @.claude/rules/architecture.md
|
|
149
|
+
Data processing and caching: @.claude/rules/data.md
|
|
150
|
+
Model and inference: @.claude/rules/inference.md
|
|
151
|
+
[Add more as needed based on existing sections]
|
|
152
|
+
|
|
153
|
+
## [Keep minimal project-specific sections]
|
|
154
|
+
|
|
155
|
+
[Submission tracking, data locations - things that change rarely]
|
|
156
|
+
```
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hook-creator
|
|
3
|
+
description: Create and configure Claude Code hooks for customizing agent behavior. Use when the user wants to (1) create a new hook, (2) configure automatic formatting, logging, or notifications, (3) add file protection or custom permissions, (4) set up pre/post tool execution actions, or (5) asks about hook events like PreToolUse, PostToolUse, Notification, etc.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hook Creator
|
|
7
|
+
|
|
8
|
+
Create Claude Code hooks that execute shell commands at specific lifecycle events.
|
|
9
|
+
|
|
10
|
+
## Hook Creation Workflow
|
|
11
|
+
|
|
12
|
+
1. **Identify the use case** - Determine what the hook should accomplish
|
|
13
|
+
2. **Select the appropriate event** - Choose from available hook events (see references/hook-events.md)
|
|
14
|
+
3. **Design the hook command** - Write shell command that processes JSON input from stdin
|
|
15
|
+
4. **Configure the matcher** - Set tool/event filter (use `*` for all, or specific tool names like `Bash`, `Edit|Write`)
|
|
16
|
+
5. **Choose storage location** - User settings (`~/.claude/settings.json`) or project (`.claude/settings.json`)
|
|
17
|
+
6. **Test the hook** - Verify behavior with a simple test case
|
|
18
|
+
|
|
19
|
+
## Hook Configuration Structure
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"hooks": {
|
|
24
|
+
"<EventName>": [
|
|
25
|
+
{
|
|
26
|
+
"matcher": "<ToolPattern>",
|
|
27
|
+
"hooks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "<shell-command>"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Common Patterns
|
|
40
|
+
|
|
41
|
+
### Reading Input Data
|
|
42
|
+
|
|
43
|
+
Hooks receive JSON via stdin. Use `jq` to extract fields:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Extract tool input field
|
|
47
|
+
jq -r '.tool_input.file_path'
|
|
48
|
+
|
|
49
|
+
# Extract with fallback
|
|
50
|
+
jq -r '.tool_input.description // "No description"'
|
|
51
|
+
|
|
52
|
+
# Conditional processing
|
|
53
|
+
jq -r 'if .tool_input.file_path then .tool_input.file_path else empty end'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Exit Codes for PreToolUse
|
|
57
|
+
|
|
58
|
+
- `0` - Allow the tool to proceed
|
|
59
|
+
- `2` - Block the tool and provide feedback to Claude
|
|
60
|
+
|
|
61
|
+
### Matcher Patterns
|
|
62
|
+
|
|
63
|
+
- `*` - Match all tools
|
|
64
|
+
- `Bash` - Match only Bash tool
|
|
65
|
+
- `Edit|Write` - Match Edit or Write tools
|
|
66
|
+
- `Read` - Match Read tool
|
|
67
|
+
|
|
68
|
+
## Quick Examples
|
|
69
|
+
|
|
70
|
+
**Log all bash commands:**
|
|
71
|
+
```bash
|
|
72
|
+
jq -r '"\(.tool_input.command)"' >> ~/.claude/bash-log.txt
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Auto-format TypeScript after edit:**
|
|
76
|
+
```bash
|
|
77
|
+
jq -r '.tool_input.file_path' | { read f; [[ "$f" == *.ts ]] && npx prettier --write "$f"; }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Block edits to .env files:**
|
|
81
|
+
```bash
|
|
82
|
+
python3 -c "import json,sys; p=json.load(sys.stdin).get('tool_input',{}).get('file_path',''); sys.exit(2 if '.env' in p else 0)"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Resources
|
|
86
|
+
|
|
87
|
+
- **Hook Events Reference**: See `references/hook-events.md` for detailed event documentation with input/output schemas
|
|
88
|
+
- **Example Configurations**: See `references/examples.md` for complete, tested hook configurations
|