@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
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Slash Command Examples
|
|
2
|
+
|
|
3
|
+
## Simple Commands
|
|
4
|
+
|
|
5
|
+
### Code Review Command
|
|
6
|
+
```markdown
|
|
7
|
+
---
|
|
8
|
+
description: Review code for bugs and improvements
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Review this code for:
|
|
12
|
+
- Security vulnerabilities
|
|
13
|
+
- Performance issues
|
|
14
|
+
- Code style violations
|
|
15
|
+
- Potential bugs
|
|
16
|
+
|
|
17
|
+
$ARGUMENTS
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Explain Command
|
|
21
|
+
```markdown
|
|
22
|
+
---
|
|
23
|
+
description: Explain code in simple terms
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Explain the following code in simple, easy-to-understand terms:
|
|
27
|
+
|
|
28
|
+
$ARGUMENTS
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Commands with Arguments
|
|
32
|
+
|
|
33
|
+
### Single Argument (`$ARGUMENTS`)
|
|
34
|
+
```markdown
|
|
35
|
+
---
|
|
36
|
+
description: Fix a GitHub issue
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
Fix issue #$ARGUMENTS following our coding standards.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Positional Arguments (`$1`, `$2`, etc.)
|
|
43
|
+
```markdown
|
|
44
|
+
---
|
|
45
|
+
argument-hint: [pr-number] [priority] [assignee]
|
|
46
|
+
description: Review pull request
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
Review PR #$1 with priority $2 and assign to $3.
|
|
50
|
+
Focus on security, performance, and code style.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Commands with Bash Execution
|
|
54
|
+
|
|
55
|
+
Use `!` prefix to execute bash commands and include output in context.
|
|
56
|
+
|
|
57
|
+
### Git Commit Command
|
|
58
|
+
```markdown
|
|
59
|
+
---
|
|
60
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
61
|
+
description: Create a git commit
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Context
|
|
65
|
+
|
|
66
|
+
- Current git status: !`git status`
|
|
67
|
+
- Current git diff: !`git diff HEAD`
|
|
68
|
+
- Current branch: !`git branch --show-current`
|
|
69
|
+
- Recent commits: !`git log --oneline -10`
|
|
70
|
+
|
|
71
|
+
## Task
|
|
72
|
+
|
|
73
|
+
Based on the above changes, create a single git commit.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Deploy Command
|
|
77
|
+
```markdown
|
|
78
|
+
---
|
|
79
|
+
allowed-tools: Bash(npm:*), Bash(docker:*)
|
|
80
|
+
argument-hint: [environment]
|
|
81
|
+
description: Deploy to specified environment
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Current State
|
|
85
|
+
|
|
86
|
+
- Branch: !`git branch --show-current`
|
|
87
|
+
- Last commit: !`git log -1 --oneline`
|
|
88
|
+
|
|
89
|
+
## Deploy to $1
|
|
90
|
+
|
|
91
|
+
Run the deployment process for the $1 environment.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Commands with File References
|
|
95
|
+
|
|
96
|
+
Use `@` prefix to include file contents.
|
|
97
|
+
|
|
98
|
+
### Review Implementation
|
|
99
|
+
```markdown
|
|
100
|
+
---
|
|
101
|
+
description: Review implementation against spec
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
Review the implementation in @src/utils/helpers.js against the specification.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Compare Files
|
|
108
|
+
```markdown
|
|
109
|
+
---
|
|
110
|
+
argument-hint: [old-file] [new-file]
|
|
111
|
+
description: Compare two files
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
Compare @$1 with @$2 and summarize the differences.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Namespaced Commands
|
|
118
|
+
|
|
119
|
+
Commands in subdirectories appear with namespace in description.
|
|
120
|
+
|
|
121
|
+
### Frontend Component (`.claude/commands/frontend/component.md`)
|
|
122
|
+
```markdown
|
|
123
|
+
---
|
|
124
|
+
description: Generate a React component
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
Generate a React component with the following requirements:
|
|
128
|
+
|
|
129
|
+
$ARGUMENTS
|
|
130
|
+
|
|
131
|
+
Follow our frontend coding standards and use TypeScript.
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Backend API (`.claude/commands/backend/api.md`)
|
|
135
|
+
```markdown
|
|
136
|
+
---
|
|
137
|
+
description: Generate API endpoint
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
Generate a REST API endpoint for:
|
|
141
|
+
|
|
142
|
+
$ARGUMENTS
|
|
143
|
+
|
|
144
|
+
Include validation, error handling, and documentation.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Extended Thinking Commands
|
|
148
|
+
|
|
149
|
+
Include thinking keywords to trigger extended thinking.
|
|
150
|
+
|
|
151
|
+
```markdown
|
|
152
|
+
---
|
|
153
|
+
description: Analyze architecture deeply
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
Think step by step about the architecture implications of:
|
|
157
|
+
|
|
158
|
+
$ARGUMENTS
|
|
159
|
+
|
|
160
|
+
Consider scalability, maintainability, and performance.
|
|
161
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Slash Command Frontmatter Reference
|
|
2
|
+
|
|
3
|
+
## Required Fields
|
|
4
|
+
|
|
5
|
+
### `description`
|
|
6
|
+
Brief description of what the command does. Shown in `/help` output.
|
|
7
|
+
|
|
8
|
+
```yaml
|
|
9
|
+
description: Create a git commit with staged changes
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Optional Fields
|
|
13
|
+
|
|
14
|
+
### `allowed-tools`
|
|
15
|
+
Specifies which tools the command can use. Format: `ToolName(pattern:*)` or just `ToolName`.
|
|
16
|
+
|
|
17
|
+
```yaml
|
|
18
|
+
# Single tool
|
|
19
|
+
allowed-tools: Bash(git status:*)
|
|
20
|
+
|
|
21
|
+
# Multiple tools
|
|
22
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
23
|
+
|
|
24
|
+
# Tool without pattern
|
|
25
|
+
allowed-tools: Read, Write, Edit
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Common tool patterns:
|
|
29
|
+
- `Bash(command:*)` - Allow specific bash commands
|
|
30
|
+
- `Read` - File reading
|
|
31
|
+
- `Write` - File writing
|
|
32
|
+
- `Edit` - File editing
|
|
33
|
+
- `Grep` - Content search
|
|
34
|
+
- `Glob` - File pattern matching
|
|
35
|
+
|
|
36
|
+
### `argument-hint`
|
|
37
|
+
Shows expected arguments when auto-completing the command.
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
# Single argument
|
|
41
|
+
argument-hint: [message]
|
|
42
|
+
|
|
43
|
+
# Multiple arguments
|
|
44
|
+
argument-hint: [pr-number] [priority] [assignee]
|
|
45
|
+
|
|
46
|
+
# Alternative syntax
|
|
47
|
+
argument-hint: add [tagId] | remove [tagId] | list
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### `model`
|
|
51
|
+
Specific model to use for this command. See [Models overview](https://docs.claude.com/en/docs/about-claude/models/overview).
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
model: claude-3-5-haiku-20241022
|
|
55
|
+
model: claude-sonnet-4-5-20250929
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `disable-model-invocation`
|
|
59
|
+
Prevents the `SlashCommand` tool from calling this command programmatically.
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
disable-model-invocation: true
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Complete Frontmatter Example
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
---
|
|
69
|
+
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
|
|
70
|
+
argument-hint: [message]
|
|
71
|
+
description: Create a git commit with staged changes
|
|
72
|
+
model: claude-3-5-haiku-20241022
|
|
73
|
+
---
|
|
74
|
+
```
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Slash Command Initializer - Creates a new slash command from template
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
init_command.py <command-name> [--scope project|personal] [--path <custom-path>]
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
init_command.py review # Creates .claude/commands/review.md
|
|
10
|
+
init_command.py deploy --scope personal # Creates ~/.claude/commands/deploy.md
|
|
11
|
+
init_command.py test --path ./my-commands # Creates ./my-commands/test.md
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
import os
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
import argparse
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
COMMAND_TEMPLATE = '''---
|
|
21
|
+
description: {description}
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# {command_title}
|
|
25
|
+
|
|
26
|
+
{body}
|
|
27
|
+
'''
|
|
28
|
+
|
|
29
|
+
COMMAND_TEMPLATE_WITH_TOOLS = '''---
|
|
30
|
+
allowed-tools: {allowed_tools}
|
|
31
|
+
description: {description}
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# {command_title}
|
|
35
|
+
|
|
36
|
+
{body}
|
|
37
|
+
'''
|
|
38
|
+
|
|
39
|
+
COMMAND_TEMPLATE_FULL = '''---
|
|
40
|
+
allowed-tools: {allowed_tools}
|
|
41
|
+
argument-hint: {argument_hint}
|
|
42
|
+
description: {description}
|
|
43
|
+
model: {model}
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
# {command_title}
|
|
47
|
+
|
|
48
|
+
{body}
|
|
49
|
+
'''
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def title_case(name: str) -> str:
|
|
53
|
+
"""Convert hyphenated name to Title Case."""
|
|
54
|
+
return ' '.join(word.capitalize() for word in name.replace('-', ' ').split())
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_project_commands_path() -> Path:
|
|
58
|
+
"""Get the project-level commands directory."""
|
|
59
|
+
return Path.cwd() / '.claude' / 'commands'
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_personal_commands_path() -> Path:
|
|
63
|
+
"""Get the user-level commands directory."""
|
|
64
|
+
return Path.home() / '.claude' / 'commands'
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def init_command(
|
|
68
|
+
command_name: str,
|
|
69
|
+
scope: str = 'project',
|
|
70
|
+
custom_path: str = None,
|
|
71
|
+
description: str = None,
|
|
72
|
+
body: str = None,
|
|
73
|
+
allowed_tools: str = None,
|
|
74
|
+
argument_hint: str = None,
|
|
75
|
+
model: str = None,
|
|
76
|
+
namespace: str = None
|
|
77
|
+
) -> Path:
|
|
78
|
+
"""
|
|
79
|
+
Initialize a new slash command.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
command_name: Name of the command (without .md extension)
|
|
83
|
+
scope: 'project' or 'personal'
|
|
84
|
+
custom_path: Optional custom path override
|
|
85
|
+
description: Command description
|
|
86
|
+
body: Command body content
|
|
87
|
+
allowed_tools: Comma-separated list of allowed tools
|
|
88
|
+
argument_hint: Hint for command arguments
|
|
89
|
+
model: Specific model to use
|
|
90
|
+
namespace: Optional subdirectory namespace
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Path to created command file, or None if error
|
|
94
|
+
"""
|
|
95
|
+
# Determine base path
|
|
96
|
+
if custom_path:
|
|
97
|
+
base_path = Path(custom_path).resolve()
|
|
98
|
+
elif scope == 'personal':
|
|
99
|
+
base_path = get_personal_commands_path()
|
|
100
|
+
else:
|
|
101
|
+
base_path = get_project_commands_path()
|
|
102
|
+
|
|
103
|
+
# Add namespace subdirectory if specified
|
|
104
|
+
if namespace:
|
|
105
|
+
base_path = base_path / namespace
|
|
106
|
+
|
|
107
|
+
# Create directory if it doesn't exist
|
|
108
|
+
try:
|
|
109
|
+
base_path.mkdir(parents=True, exist_ok=True)
|
|
110
|
+
except Exception as e:
|
|
111
|
+
print(f"Error creating directory {base_path}: {e}")
|
|
112
|
+
return None
|
|
113
|
+
|
|
114
|
+
# Create command file path
|
|
115
|
+
command_file = base_path / f'{command_name}.md'
|
|
116
|
+
|
|
117
|
+
# Check if file already exists
|
|
118
|
+
if command_file.exists():
|
|
119
|
+
print(f"Error: Command already exists: {command_file}")
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
# Prepare content
|
|
123
|
+
command_title = title_case(command_name)
|
|
124
|
+
description = description or f"[TODO: Brief description of /{command_name}]"
|
|
125
|
+
body = body or f"[TODO: Add instructions for /{command_name}]\n\n$ARGUMENTS"
|
|
126
|
+
|
|
127
|
+
# Choose template based on options
|
|
128
|
+
if allowed_tools and argument_hint and model:
|
|
129
|
+
content = COMMAND_TEMPLATE_FULL.format(
|
|
130
|
+
allowed_tools=allowed_tools,
|
|
131
|
+
argument_hint=argument_hint,
|
|
132
|
+
description=description,
|
|
133
|
+
model=model,
|
|
134
|
+
command_title=command_title,
|
|
135
|
+
body=body
|
|
136
|
+
)
|
|
137
|
+
elif allowed_tools:
|
|
138
|
+
content = COMMAND_TEMPLATE_WITH_TOOLS.format(
|
|
139
|
+
allowed_tools=allowed_tools,
|
|
140
|
+
description=description,
|
|
141
|
+
command_title=command_title,
|
|
142
|
+
body=body
|
|
143
|
+
)
|
|
144
|
+
else:
|
|
145
|
+
content = COMMAND_TEMPLATE.format(
|
|
146
|
+
description=description,
|
|
147
|
+
command_title=command_title,
|
|
148
|
+
body=body
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# Write command file
|
|
152
|
+
try:
|
|
153
|
+
command_file.write_text(content)
|
|
154
|
+
print(f"Created: {command_file}")
|
|
155
|
+
return command_file
|
|
156
|
+
except Exception as e:
|
|
157
|
+
print(f"Error writing command file: {e}")
|
|
158
|
+
return None
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def main():
|
|
162
|
+
parser = argparse.ArgumentParser(
|
|
163
|
+
description='Initialize a new Claude Code slash command',
|
|
164
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
165
|
+
epilog='''
|
|
166
|
+
Examples:
|
|
167
|
+
%(prog)s review
|
|
168
|
+
Creates .claude/commands/review.md (project command)
|
|
169
|
+
|
|
170
|
+
%(prog)s deploy --scope personal
|
|
171
|
+
Creates ~/.claude/commands/deploy.md (personal command)
|
|
172
|
+
|
|
173
|
+
%(prog)s component --namespace frontend
|
|
174
|
+
Creates .claude/commands/frontend/component.md
|
|
175
|
+
|
|
176
|
+
%(prog)s commit --allowed-tools "Bash(git add:*), Bash(git commit:*)"
|
|
177
|
+
Creates command with specific tool permissions
|
|
178
|
+
|
|
179
|
+
Command naming:
|
|
180
|
+
- Use lowercase with hyphens (e.g., 'review-pr', 'run-tests')
|
|
181
|
+
- Avoid spaces and special characters
|
|
182
|
+
- Keep names concise and descriptive
|
|
183
|
+
'''
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
parser.add_argument('command_name', help='Name of the slash command (without .md)')
|
|
187
|
+
parser.add_argument('--scope', choices=['project', 'personal'], default='project',
|
|
188
|
+
help='Command scope: project (.claude/commands) or personal (~/.claude/commands)')
|
|
189
|
+
parser.add_argument('--path', dest='custom_path', help='Custom path for command file')
|
|
190
|
+
parser.add_argument('--namespace', help='Subdirectory namespace (e.g., frontend, backend)')
|
|
191
|
+
parser.add_argument('--description', help='Command description')
|
|
192
|
+
parser.add_argument('--allowed-tools', dest='allowed_tools', help='Comma-separated list of allowed tools')
|
|
193
|
+
parser.add_argument('--argument-hint', dest='argument_hint', help='Hint for command arguments')
|
|
194
|
+
parser.add_argument('--model', help='Specific model to use (e.g., claude-3-5-haiku-20241022)')
|
|
195
|
+
|
|
196
|
+
args = parser.parse_args()
|
|
197
|
+
|
|
198
|
+
result = init_command(
|
|
199
|
+
command_name=args.command_name,
|
|
200
|
+
scope=args.scope,
|
|
201
|
+
custom_path=args.custom_path,
|
|
202
|
+
description=args.description,
|
|
203
|
+
allowed_tools=args.allowed_tools,
|
|
204
|
+
argument_hint=args.argument_hint,
|
|
205
|
+
model=args.model,
|
|
206
|
+
namespace=args.namespace
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
if result:
|
|
210
|
+
print(f"\nSlash command '/{args.command_name}' initialized successfully!")
|
|
211
|
+
print("\nNext steps:")
|
|
212
|
+
print("1. Edit the command file to update the description and body")
|
|
213
|
+
print("2. Test the command by running it in Claude Code")
|
|
214
|
+
print(f"\nUsage: /{args.command_name} [arguments]")
|
|
215
|
+
sys.exit(0)
|
|
216
|
+
else:
|
|
217
|
+
sys.exit(1)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
if __name__ == "__main__":
|
|
221
|
+
main()
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: subagent-creator
|
|
3
|
+
description: Create specialized Claude Code sub-agents with custom system prompts and tool configurations. Use when users ask to create a new sub-agent, custom agent, specialized assistant, or want to configure task-specific AI workflows for Claude Code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sub-agent Creator
|
|
7
|
+
|
|
8
|
+
Create specialized AI sub-agents for Claude Code that handle specific tasks with customized prompts and tool access.
|
|
9
|
+
|
|
10
|
+
## Sub-agent File Format
|
|
11
|
+
|
|
12
|
+
Sub-agents are Markdown files with YAML frontmatter stored in:
|
|
13
|
+
- **Project**: `.claude/agents/` (higher priority)
|
|
14
|
+
- **User**: `~/.claude/agents/` (lower priority)
|
|
15
|
+
|
|
16
|
+
### Structure
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
---
|
|
20
|
+
name: subagent-name
|
|
21
|
+
description: When to use this subagent (include "use proactively" for auto-delegation)
|
|
22
|
+
tools: Tool1, Tool2, Tool3 # Optional - inherits all if omitted
|
|
23
|
+
model: sonnet # Optional - sonnet/opus/haiku/inherit
|
|
24
|
+
permissionMode: default # Optional - default/acceptEdits/bypassPermissions/plan
|
|
25
|
+
skills: skill1, skill2 # Optional - auto-load skills
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
System prompt goes here. Define role, responsibilities, and behavior.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Configuration Fields
|
|
32
|
+
|
|
33
|
+
| Field | Required | Description |
|
|
34
|
+
|-------|----------|-------------|
|
|
35
|
+
| `name` | Yes | Lowercase with hyphens |
|
|
36
|
+
| `description` | Yes | Purpose and when to use (key for auto-delegation) |
|
|
37
|
+
| `tools` | No | Comma-separated tool list (omit to inherit all) |
|
|
38
|
+
| `model` | No | `sonnet`, `opus`, `haiku`, or `inherit` |
|
|
39
|
+
| `permissionMode` | No | `default`, `acceptEdits`, `bypassPermissions`, `plan` |
|
|
40
|
+
| `skills` | No | Skills to auto-load |
|
|
41
|
+
|
|
42
|
+
## Creation Workflow
|
|
43
|
+
|
|
44
|
+
1. **Gather requirements**: Ask about the sub-agent's purpose, when to use it, and required capabilities
|
|
45
|
+
2. **Choose scope**: Project (`.claude/agents/`) or user (`~/.claude/agents/`)
|
|
46
|
+
3. **Define configuration**: Name, description, tools, model
|
|
47
|
+
4. **Write system prompt**: Clear role, responsibilities, and output format
|
|
48
|
+
5. **Create file**: Write the `.md` file to the appropriate location
|
|
49
|
+
|
|
50
|
+
## Writing Effective Sub-agents
|
|
51
|
+
|
|
52
|
+
### Description Best Practices
|
|
53
|
+
|
|
54
|
+
The `description` field is critical for automatic delegation:
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
# Good - specific triggers
|
|
58
|
+
description: Expert code reviewer. Use PROACTIVELY after writing or modifying code.
|
|
59
|
+
|
|
60
|
+
# Good - clear use cases
|
|
61
|
+
description: Debugging specialist for errors, test failures, and unexpected behavior.
|
|
62
|
+
|
|
63
|
+
# Bad - too vague
|
|
64
|
+
description: Helps with code
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### System Prompt Guidelines
|
|
68
|
+
|
|
69
|
+
1. **Define role clearly**: "You are a [specific expert role]"
|
|
70
|
+
2. **List actions on invocation**: What to do first
|
|
71
|
+
3. **Specify responsibilities**: What the sub-agent handles
|
|
72
|
+
4. **Include guidelines**: Constraints and best practices
|
|
73
|
+
5. **Define output format**: How to structure responses
|
|
74
|
+
|
|
75
|
+
### Tool Selection
|
|
76
|
+
|
|
77
|
+
- **Read-only tasks**: `Read, Grep, Glob, Bash`
|
|
78
|
+
- **Code modification**: `Read, Write, Edit, Grep, Glob, Bash`
|
|
79
|
+
- **Full access**: Omit `tools` field
|
|
80
|
+
|
|
81
|
+
See [references/available-tools.md](references/available-tools.md) for complete tool list.
|
|
82
|
+
|
|
83
|
+
## Example Sub-agents
|
|
84
|
+
|
|
85
|
+
See [references/examples.md](references/examples.md) for complete examples:
|
|
86
|
+
- Code Reviewer
|
|
87
|
+
- Debugger
|
|
88
|
+
- Data Scientist
|
|
89
|
+
- Test Runner
|
|
90
|
+
- Documentation Writer
|
|
91
|
+
- Security Auditor
|
|
92
|
+
|
|
93
|
+
## Template
|
|
94
|
+
|
|
95
|
+
Copy from [assets/subagent-template.md](assets/subagent-template.md) to start a new sub-agent.
|
|
96
|
+
|
|
97
|
+
## Quick Start Example
|
|
98
|
+
|
|
99
|
+
Create a code reviewer sub-agent:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
mkdir -p .claude/agents
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Write to `.claude/agents/code-reviewer.md`:
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
---
|
|
109
|
+
name: code-reviewer
|
|
110
|
+
description: Reviews code for quality and security. Use proactively after code changes.
|
|
111
|
+
tools: Read, Grep, Glob, Bash
|
|
112
|
+
model: inherit
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
You are a senior code reviewer.
|
|
116
|
+
|
|
117
|
+
When invoked:
|
|
118
|
+
1. Run git diff to see changes
|
|
119
|
+
2. Review modified files
|
|
120
|
+
3. Report issues by priority
|
|
121
|
+
|
|
122
|
+
Focus on:
|
|
123
|
+
- Code readability
|
|
124
|
+
- Security vulnerabilities
|
|
125
|
+
- Error handling
|
|
126
|
+
- Best practices
|
|
127
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: your-subagent-name
|
|
3
|
+
description: Clear description of what this subagent does and when to use it. Include "use proactively" or "MUST BE USED" for automatic delegation.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are an expert [role/specialty].
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
|
|
12
|
+
1. [First action to take]
|
|
13
|
+
2. [Second action]
|
|
14
|
+
3. [Third action]
|
|
15
|
+
|
|
16
|
+
Key responsibilities:
|
|
17
|
+
|
|
18
|
+
- [Responsibility 1]
|
|
19
|
+
- [Responsibility 2]
|
|
20
|
+
- [Responsibility 3]
|
|
21
|
+
|
|
22
|
+
Guidelines:
|
|
23
|
+
|
|
24
|
+
- [Guideline 1]
|
|
25
|
+
- [Guideline 2]
|
|
26
|
+
- [Guideline 3]
|
|
27
|
+
|
|
28
|
+
Output format:
|
|
29
|
+
|
|
30
|
+
- [What to include in responses]
|
|
31
|
+
- [How to structure findings]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Available Tools for Sub-agents
|
|
2
|
+
|
|
3
|
+
Sub-agents can be granted access to any of Claude Code's internal tools. If `tools` field is omitted, the sub-agent inherits all tools from the main thread.
|
|
4
|
+
|
|
5
|
+
## Core Tools
|
|
6
|
+
|
|
7
|
+
| Tool | Description |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| `Read` | Read file contents |
|
|
10
|
+
| `Write` | Create or overwrite files |
|
|
11
|
+
| `Edit` | Make precise edits to existing files |
|
|
12
|
+
| `Glob` | Find files by pattern matching |
|
|
13
|
+
| `Grep` | Search file contents with regex |
|
|
14
|
+
| `Bash` | Execute shell commands |
|
|
15
|
+
| `Task` | Spawn sub-agents (not recommended for sub-agents) |
|
|
16
|
+
|
|
17
|
+
## Interaction Tools
|
|
18
|
+
|
|
19
|
+
| Tool | Description |
|
|
20
|
+
|------|-------------|
|
|
21
|
+
| `AskUser` | Ask user questions for clarification |
|
|
22
|
+
| `TodoWrite` | Manage task lists |
|
|
23
|
+
|
|
24
|
+
## Web Tools
|
|
25
|
+
|
|
26
|
+
| Tool | Description |
|
|
27
|
+
|------|-------------|
|
|
28
|
+
| `WebFetch` | Fetch and process web content |
|
|
29
|
+
| `WebSearch` | Search the web |
|
|
30
|
+
|
|
31
|
+
## IDE Tools (when available)
|
|
32
|
+
|
|
33
|
+
| Tool | Description |
|
|
34
|
+
|------|-------------|
|
|
35
|
+
| `mcp__ide__getDiagnostics` | Get language diagnostics from VS Code |
|
|
36
|
+
| `mcp__ide__executeCode` | Execute code in Jupyter kernel |
|
|
37
|
+
|
|
38
|
+
## MCP Tools
|
|
39
|
+
|
|
40
|
+
Sub-agents can also access tools from configured MCP servers. MCP tool names follow the pattern `mcp__<server>__<tool>`.
|
|
41
|
+
|
|
42
|
+
## Common Tool Combinations
|
|
43
|
+
|
|
44
|
+
### Read-Only Research
|
|
45
|
+
```
|
|
46
|
+
tools: Read, Grep, Glob, Bash
|
|
47
|
+
```
|
|
48
|
+
Best for: Code analysis, documentation review, codebase exploration
|
|
49
|
+
|
|
50
|
+
### Code Modification
|
|
51
|
+
```
|
|
52
|
+
tools: Read, Write, Edit, Grep, Glob, Bash
|
|
53
|
+
```
|
|
54
|
+
Best for: Implementing features, fixing bugs, refactoring
|
|
55
|
+
|
|
56
|
+
### Minimal Write Access
|
|
57
|
+
```
|
|
58
|
+
tools: Read, Grep, Glob
|
|
59
|
+
```
|
|
60
|
+
Best for: Security audits, code review (report-only)
|
|
61
|
+
|
|
62
|
+
### Full Access
|
|
63
|
+
Omit the `tools` field to inherit all available tools.
|