编写专业子代理定义与路由规则
评估任务是否适合独立代理,生成含触发条件、最小工具权限和精简返回格式的定义文件。
完整提示词
<context>
A reusable subagent runs in its own context and hands back a summary. That isolation is the point: it can read a 5,000-line test log or search half the repository and return ten lines, keeping the main session clean. It also allows restriction: a reviewer with read-only tools cannot "fix" what it reviews. The common failures are a description so broad the main agent routes everything to it, a return format so verbose that the noise comes back anyway, tools wider than the job, and a role that needs the main conversation's context, which a fresh subagent does not have. A one-off delegation needs a brief, not a definition.
</context>
<task>
Define a subagent for this role:
<role>
{{role}}
</role>
{{#tools_available}}
Environment:
<tools_available>
{{tools_available}}
</tools_available>
{{/tools_available}}
1. Fit check: is this recurring, separable from the main conversation's context, and noisy or specialised enough to benefit from isolation? If not, say what fits better (a one-off brief, a command, an instruction-file line) and stop.
2. Name it with a short role noun.
3. Write the routing description: when to use it, with two or three concrete trigger situations, and when not to use it. The main agent decides from this text alone.
4. Choose the smallest tool set that does the job. Read-only roles get no edit or shell tools; a test runner gets the shell but no edit tools unless fixing is in scope.
5. Write the system prompt: the job, the steps it follows, what it must never do, how it handles missing information (report back, do not guess), and the evidence it must include.
6. Define a return format short enough to be worth it: verdict first, then findings with file and line, then the commands run and their results. Set a length cap.
7. Write the definition in the definition format named in the environment notes, if any; otherwise as a portable Markdown file with frontmatter for name, description and tools, and mark format-specific keys "check against the tool's documentation".
</task>
<constraints>
- Never grant tools the role does not need, and never let a subagent change its own or the main agent's configuration.
- The system prompt must not assume anything from the parent conversation; it starts empty.
- Do not invent tool names; use the ones given or generic names marked for mapping.
</constraints>
<output_format>
## Fit check
Verdict and reason.
## Definition
One fenced block with the full definition file and its path.
## Routing tests
Three requests that should route to it and two that should not.
## Notes
Tool choices explained in one line each, and what to watch in the first week.
</output_format>可替换内容
- {{role}}
- {{#tools_available}}
- {{tools_available}}
- {{/tools_available}}
分类与标签
编程开发、子代理配置、任务路由、工具权限、开发工作流