create-subagents by glittercowboy/taches-cc-resources
npx skills add https://github.com/glittercowboy/taches-cc-resources --skill create-subagents子代理可将复杂任务委托给专门的代理,这些代理无需用户交互即可自主运行,并将其最终输出返回至主对话。
<quick_start>
/agents 命令.claude/agents/)或用户级别(~/.claude/agents/)sonnet、opus、haiku 或 inherit)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
<focus_areas>
<output_format> 提供具体、可操作的反馈,并附上文件:行号引用。</output_format>
</example>
</quick_start>
<file_structure>
| 类型 | 位置 | 作用范围 | 优先级 |
|---|---|---|---|
| 项目 | .claude/agents/ | 仅当前项目 | 最高 |
| 用户 | ~/.claude/agents/ | 所有项目 | 较低 |
| 插件 | 插件的 agents/ 目录 | 所有项目 | 最低 |
当名称冲突时,项目级别子代理会覆盖用户级别子代理。 </file_structure>
<execution_model> <critical_constraint> 子代理是无法与用户交互的黑盒。
子代理在隔离的上下文中运行,并将其最终输出返回至主对话。它们:
主对话只能看到子代理的最终报告/输出。 </critical_constraint>
<workflow_design> 设计使用子代理的工作流:
使用主聊天进行:
使用子代理进行:
示例工作流模式:
主聊天:向用户询问需求(AskUserQuestion)↓ 子代理:研究 API 并创建文档(无需用户交互)↓ 主聊天:与用户一起审查研究,确认方法↓ 子代理:基于确认的计划生成代码↓ 主聊天:呈现结果,处理测试/部署
</workflow_design> </execution_model>
<system_prompt_guidelines> <principle name="be_specific"> 明确定义子代理的角色、能力和约束。 </principle>
---
name: security-reviewer
description: Reviews code for security vulnerabilities
tools: Read, Grep, Glob, Bash
model: sonnet
---
<role>
You are a senior code reviewer specializing in security.
</role>
<focus_areas>
- SQL injection vulnerabilities
- XSS attack vectors
- Authentication/authorization issues
- Sensitive data exposure
</focus_areas>
<workflow>
1. Read the modified files
2. Identify security risks
3. Provide specific remediation steps
4. Rate severity (Critical/High/Medium/Low)
</workflow>
❌ 不好:"You are a helpful assistant that helps with code" ✅ 好:"You are a React component refactoring specialist. Analyze components for hooks best practices, performance anti-patterns, and accessibility issues." </system_prompt_guidelines>
<subagent_xml_structure> 子代理 .md 文件是仅供 Claude 使用的系统提示。与技能和斜杠命令一样,它们应使用纯 XML 结构以实现最佳解析和令牌效率。
<recommended_tags> 子代理结构的常用标签:
<role> - 子代理是谁以及它做什么<constraints> - 硬性规则(NEVER/MUST/ALWAYS)<focus_areas> - 优先处理的事项<workflow> - 分步流程<output_format> - 如何构建交付物<success_criteria> - 完成标准<validation> - 如何验证工作
</recommended_tags><intelligence_rules> 简单子代理(单一专注任务):
中等子代理(多步骤流程):
复杂子代理(研究 + 生成 + 验证):
<critical_rule> 从子代理正文中移除所有 Markdown 标题(##、###)。 改用语义化的 XML 标签。
在内容内部保留 Markdown 格式(粗体、斜体、列表、代码块、链接)。
有关 XML 结构原则和令牌效率的详细信息,请参阅 @skills/create-agent-skills/references/use-xml-tags.md - 同样的原则适用于子代理。 </critical_rule> </subagent_xml_structure>
使用 code-reviewer 子代理检查我最近的更改
让 test-writer 子代理为新 API 端点创建测试
<manual_editing> 您也可以直接编辑子代理文件:
.claude/agents/subagent-name.md~/.claude/agents/subagent-name.md
</manual_editing>子代理使用和配置:references/subagents.md
高级主题:
调试和故障排除:references/debugging-agents.md
<success_criteria> 一个配置良好的子代理应具备:
每周安装量
101
代码仓库
GitHub 星标
1.7K
首次出现
2026年1月23日
安全审计
安装于
opencode85
codex82
claude-code78
gemini-cli78
cursor73
github-copilot73
Subagents enable delegation of complex tasks to specialized agents that operate autonomously without user interaction, returning their final output to the main conversation.
<quick_start>
/agents command.claude/agents/) or user-level (~/.claude/agents/)sonnet, opus, haiku, or inherit)<focus_areas>
<output_format> Provide specific, actionable feedback with file:line references. </output_format>
</example>
</quick_start>
<file_structure>
| Type | Location | Scope | Priority |
|------|----------|-------|----------|
| **Project** | `.claude/agents/` | Current project only | Highest |
| **User** | `~/.claude/agents/` | All projects | Lower |
| **Plugin** | Plugin's `agents/` dir | All projects | Lowest |
Project-level subagents override user-level when names conflict.
</file_structure>
<configuration>
<field name="name">
- Lowercase letters and hyphens only
- Must be unique
</field>
<field name="description">
- Natural language description of purpose
- Include when Claude should invoke this subagent
- Used for automatic subagent selection
</field>
<field name="tools">
- Comma-separated list: `Read, Write, Edit, Bash, Grep`
- If omitted: inherits all tools from main thread
- Use `/agents` interface to see all available tools
</field>
<field name="model">
- `sonnet`, `opus`, `haiku`, or `inherit`
- `inherit`: uses same model as main conversation
- If omitted: defaults to configured subagent model (usually sonnet)
</field>
</configuration>
<execution_model>
<critical_constraint>
**Subagents are black boxes that cannot interact with users.**
Subagents run in isolated contexts and return their final output to the main conversation. They:
- ✅ Can use tools like Read, Write, Edit, Bash, Grep, Glob
- ✅ Can access MCP servers and other non-interactive tools
- ❌ **Cannot use AskUserQuestion** or any tool requiring user interaction
- ❌ **Cannot present options or wait for user input**
- ❌ **User never sees subagent's intermediate steps**
The main conversation sees only the subagent's final report/output.
</critical_constraint>
<workflow_design>
**Designing workflows with subagents:**
Use **main chat** for:
- Gathering requirements from user (AskUserQuestion)
- Presenting options or decisions to user
- Any task requiring user confirmation/input
- Work where user needs visibility into progress
Use **subagents** for:
- Research tasks (API documentation lookup, code analysis)
- Code generation based on pre-defined requirements
- Analysis and reporting (security review, test coverage)
- Context-heavy operations that don't need user interaction
**Example workflow pattern:**
Main Chat: Ask user for requirements (AskUserQuestion) ↓ Subagent: Research API and create documentation (no user interaction) ↓ Main Chat: Review research with user, confirm approach ↓ Subagent: Generate code based on confirmed plan ↓ Main Chat: Present results, handle testing/deployment
</workflow_design>
</execution_model>
<system_prompt_guidelines>
<principle name="be_specific">
Clearly define the subagent's role, capabilities, and constraints.
</principle>
<principle name="use_pure_xml_structure">
Structure the system prompt with pure XML tags. Remove ALL markdown headings from the body.
```markdown
---
name: security-reviewer
description: Reviews code for security vulnerabilities
tools: Read, Grep, Glob, Bash
model: sonnet
---
<role>
You are a senior code reviewer specializing in security.
</role>
<focus_areas>
- SQL injection vulnerabilities
- XSS attack vectors
- Authentication/authorization issues
- Sensitive data exposure
</focus_areas>
<workflow>
1. Read the modified files
2. Identify security risks
3. Provide specific remediation steps
4. Rate severity (Critical/High/Medium/Low)
</workflow>
❌ Bad: "You are a helpful assistant that helps with code" ✅ Good: "You are a React component refactoring specialist. Analyze components for hooks best practices, performance anti-patterns, and accessibility issues." </system_prompt_guidelines>
<subagent_xml_structure> Subagent.md files are system prompts consumed only by Claude. Like skills and slash commands, they should use pure XML structure for optimal parsing and token efficiency.
<recommended_tags> Common tags for subagent structure:
<role> - Who the subagent is and what it does<constraints> - Hard rules (NEVER/MUST/ALWAYS)<focus_areas> - What to prioritize<workflow> - Step-by-step process<output_format> - How to structure deliverables<success_criteria> - Completion criteria<validation> - How to verify work </recommended_tags><intelligence_rules> Simple subagents (single focused task):
Medium subagents (multi-step process):
Complex subagents (research + generation + validation):
<critical_rule> Remove ALL markdown headings (##, ###) from subagent body. Use semantic XML tags instead.
Keep markdown formatting WITHIN content (bold, italic, lists, code blocks, links).
For XML structure principles and token efficiency details, see @skills/create-agent-skills/references/use-xml-tags.md - the same principles apply to subagents. </critical_rule> </subagent_xml_structure>
> Use the code-reviewer subagent to check my recent changes
> Have the test-writer subagent create tests for the new API endpoints
<manual_editing> You can also edit subagent files directly:
.claude/agents/subagent-name.md~/.claude/agents/subagent-name.md </manual_editing>Subagent usage and configuration : references/subagents.md
Writing effective prompts : references/writing-subagent-prompts.md
Advanced topics :
Evaluation and testing : references/evaluation-and-testing.md
Error handling and recovery : references/error-handling-and-recovery.md
Context management : references/context-management.md
Orchestration patterns : references/orchestration-patterns.md
Debugging and troubleshooting : references/debugging-agents.md
<success_criteria> A well-configured subagent has:
Weekly Installs
101
Repository
GitHub Stars
1.7K
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode85
codex82
claude-code78
gemini-cli78
cursor73
github-copilot73
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
66,200 周安装
Apollo Kotlin:Android与JVM的强类型GraphQL客户端,支持Kotlin多平台
339 周安装
自我改进智能体:AI智能体自我优化与技能创建指南
337 周安装
App Store审核指南检查器 - iOS/macOS应用提交合规性检查与代码审查工具
341 周安装
数学计算与符号计算工具:SymPy、Z3、Pint统一入口,支持方程求解、证明、单位转换
341 周安装
临床报告撰写指南:病例报告、诊断报告、临床试验报告与患者文档的AI辅助工具
341 周安装
AI代码审查专家 - 自动化代码质量、安全与性能分析工具 | 现代开发实践
347 周安装