SuperAPI AI 工具集

agent-template

智能体与模型

查看项目

更新于 10-16 10:54

技能介绍

用途

agent-template 是一个智能体(Agent)模板生成工具,属于 director-mode-lite。它的核心作用是根据用户提供的需求,生成一个自定义的 Agent 文件。

主要能力

  • 通过命令 /agent-template [agent-name] [purpose] 生成智能体文件。
  • 根据用途自动匹配模板,内置模板包括:Reviewer(审查/审计)、Generator(生成/创建)、Fixer(修复/修改)、Tester(测试/验证)、Documenter(文档)、Orchestrator(编排)。
  • 生成文件路径为 .claude/agents/[name].md。
  • 可通过 /agent-check 对生成结果进行校验。
  • 支持在生成时配置关联技能(linked skill)。

使用方式

生成流程包括以下步骤:

  1. 收集需求:
    • Agent 名称(小写、连字符)
    • 用途
    • 所需工具
    • 模型(haiku/sonnet/opus)
    • 关联技能(如有)
  2. 根据用途选择模板。
  3. 在 .claude/agents/[name].md 生成文件。
  4. 使用 /agent-check 进行校验。

调用示例:

/agent-template security-scanner "scan code for vulnerabilities"

输出:Created .claude/agents/security-scanner.md

模板对照

用途 模板 工具 颜色 模型
Review/Audit Reviewer Read, Grep, Glob, Bash yellow sonnet
Generate/Create Generator Read, Write, Grep, Glob cyan sonnet
Fix/Modify Fixer Read, Write, Edit, Bash, Grep red sonnet
Test/Validate Tester Read, Bash, Grep, Glob green sonnet
Document Documenter Read, Write, Grep, Glob cyan sonnet
Orchestrate Orchestrator Read, Write, Bash, Grep, Glob, Task cyan haiku

Frontmatter 参考

---
name: agent-name            # Required: lowercase, hyphenated, 3-50 chars
description: >              # Required: 200-1000 chars recommended, include <example> blocks
  Use this agent when [triggering conditions]. Examples:
  <example>
  Context: [situation]
  user: "[request]"
  assistant: "[response]"
  <commentary>[why this agent]</commentary>
  </example>
color: cyan                 # Required: yellow, red, green, blue, magenta, cyan
tools:                      # Optional: YAML list (omit = all tools)
  - Read
  - Write
  - Edit
  - Bash
  - Grep
  - Glob
  - Task
  - WebFetch
  - WebSearch
  - TodoWrite
  - NotebookEdit
model: sonnet               # Required: inherit, haiku, sonnet, opus, best, sonnet[1m], opus[1m], opusplan
# forkContext: "true"        # Optional: context isolation (string, not boolean)
# maxTurns: 20              # Optional: max agentic turns before stopping
skills:                     # Optional: skills to auto-load (array)
  - linked-skill
# memory:                   # Optional: CLAUDE.md access (array)
#   - user
#   - project
#   - local
# mcpServers:               # Optional: MCP servers (string ref or inline config)
#   - memory
#   - name: custom-server
#     type: stdio
#     command: npx
#     args: ["-y", "@example/server"]
hooks:                      # Optional: agent-scoped lifecycle hooks
  PreToolUse:
    - matcher: Write
      hooks:
        - type: command
          command: ./scripts/validate.sh
  PostToolUse:
    - matcher: Bash
      hooks:
        - type: command
          command: ./scripts/log.sh
  Stop:
    - hooks:
        - type: command
          command: ./scripts/check.sh
          once: true
permissionMode: default     # Optional: default, acceptEdits, bypassPermissions, plan, delegate, dontAsk
disallowedTools:            # Optional: explicit tool blocking
  - NotebookEdit
---

Reviewer 模板结构示例

---
name: [name]
description: [brief purpose]
color: yellow
tools:
  - Read
  - Grep
  - Glob
  - Bash
model: sonnet
skills:
  - linked-skill
---

# [Name] Agent

## Activation
When to trigger

## Review Checklist
- [ ] Check items

## Output Format
Report structure

适用场景

适用于需要按既定规范快速创建自定义智能体文件的开发场景,例如创建安全扫描、代码审查、修复、测试、文档生成或编排类 Agent。

限制

资料中未提供关于收费、价格、平台支持范围或具体效果的信息。