Skills.MD
# Sub-agent Creator
Create specialized AI sub-agents for Claude Code that handle specific tasks with customized prompts and tool access.
## Sub-agent File Format
Sub-agents are Markdown files with YAML frontmatter stored in:
- **Project**: `.claude/agents/` (higher priority)
- **User**: `~/.claude/agents/` (lower priority)
### Structure
```markdown
---
name: subagent-name
description: When to use this subagent (include "use proactively" for auto-delegation)
tools: Tool1, Tool2, Tool3 # Optional - inherits all if omitted
model: sonnet # Optional - sonnet/opus/haiku/inherit
permissionMode: default # Optional - default/acceptEdits/bypassPermissions/plan
skills: skill1, skill2 # Optional - auto-load skills
---
System prompt goes here. Define role, responsibilities, and behavior.
```
### Configuration Fields
| Field | Required | Description |
|-------|----------|-------------|
| `name` | Yes | Lowercase with hyphens |
| `description` | Yes | Purpose and when to use (key for auto-delegation) |
| `tools` | No | Comma-separated tool list (omit to inherit all) |
| `model` | No | `sonnet`, `opus`, `haiku`, or `inherit` |
| `permissionMode` | No | `default`, `acceptEdits`, `bypassPermissions`, `plan` |
| `skills` | No | Skills to auto-load |
## Creation Workflow
1. **Gather requirements**: Ask about the sub-agent's purpose, when to use it, and required capabilities
2. **Choose scope**: Project (`.claude/agents/`) or user (`~/.claude/agents/`)
3. **Define configuration**: Name, description, tools, model
4. **Write system prompt**: Clear role, responsibilities, and output format
5. **Create file**: Write the `.md` file to the appropriate location
## Writing Effective Sub-agents
### Description Best Practices
The `description` field is critical for automatic delegation:
```yaml
# Good - specific triggers
description: Expert code reviewer. Use PROACTIVELY after writing or modifying code.
# Good - clear use cases
description: Debugging specialist for errors, test failures, and unexpected behavior.
# Bad - too vague
description: Helps with code
```
### System Prompt Guidelines
1. **Define role clearly**: "You are a [specific expert role]"
2. **List actions on invocation**: What to do first
3. **Specify responsibilities**: What the sub-agent handles
4. **Include guidelines**: Constraints and best practices
5. **Define output format**: How to structure responses
### Tool Selection
- **Read-only tasks**: `Read, Grep, Glob, Bash`
- **Code modification**: `Read, Write, Edit, Grep, Glob, Bash`
- **Full access**: Omit `tools` field
See [references/available-tools.md](references/available-tools.md) for complete tool list.
## Example Sub-agents
See [references/examples.md](references/examples.md) for complete examples:
- Code Reviewer
- Debugger
- Data Scientist
- Test Runner
- Documentation Writer
- Security Auditor
## Template
Copy from [assets/subagent-template.md](assets/subagent-template.md) to start a new sub-agent.
## Quick Start Example
Create a code reviewer sub-agent:
```bash
mkdir -p .claude/agents
```
Write to `.claude/agents/code-reviewer.md`:
```markdown
---
name: code-reviewer
description: Reviews code for quality and security. Use proactively after code changes.
tools: Read, Grep, Glob, Bash
model: inherit
---
You are a senior code reviewer.
When invoked:
1. Run git diff to see changes
2. Review modified files
3. Report issues by priority
Focus on:
- Code readability
- Security vulnerabilities
- Error handling
- Best practices
```
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「subagent-creator」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次