custom-agent-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Custom Agent Creator

自定义Agent创建工具

Overview

概述

This skill guides the creation of custom agents for either VS Code Copilot or OpenCode. It helps users define agent properties like name, description, tools, models, and permissions, then generates the appropriate configuration file in the correct format.
本技能可指导用户为VS Code Copilot或OpenCode创建自定义Agent,帮助用户定义Agent的名称、描述、工具、模型和权限等属性,然后生成对应格式的正确配置文件。

Workflow

工作流程

Step 1: Determine Target Platform

步骤1:确定目标平台

If the user hasn't specified, ask whether they want to create an agent for:
  • VS Code Copilot (.agent.md files)
  • OpenCode (JSON/markdown configs)
若用户未明确说明,请询问其想要为以下哪个平台创建Agent:
  • VS Code Copilot(.agent.md文件格式)
  • OpenCode(JSON/Markdown配置格式)

Step 2: Gather Agent Specifications

步骤2:收集Agent规格信息

Collect detailed information about the agent:
  • Agent Name: Clear, descriptive identifier (e.g., "code-reviewer", "planner")
  • Description: Brief explanation of what the agent does and when to use it
  • Role/Purpose: Specific task the agent is designed for (e.g., "security auditing", "documentation writing")
  • Tools & Permissions: Which capabilities are needed
  • Model Preference: Specific AI model if needed (otherwise use default)
  • Additional Config: Temperature, steps limit, handoffs, etc.
收集关于Agent的详细信息:
  • Agent名称:清晰、具有描述性的标识符(例如:"code-reviewer"、"planner")
  • 描述:简要说明Agent的功能及适用场景
  • 角色/用途:Agent专为执行的特定任务(例如:"安全审计"、"文档撰写")
  • 工具与权限:所需的功能权限
  • 模型偏好:如需特定AI模型请说明(否则使用默认模型)
  • 额外配置:温度参数、步骤限制、任务交接设置等

Step 3: Validate Requirements

步骤3:验证需求

Ensure all required fields are provided:
  • Copilot: name, description, tools list
  • OpenCode: description, mode (primary/subagent), tool permissions
确保所有必填字段已提供:
  • Copilot:名称、描述、工具列表
  • OpenCode:描述、模式(主Agent/子Agent)、工具权限

Step 4: Generate Configuration File

步骤4:生成配置文件

Create the appropriate file based on platform:
  • Copilot: Generate
    .agent.md
    with YAML frontmatter + markdown body
  • OpenCode: Generate markdown config file with YAML frontmatter
根据目标平台创建对应文件:
  • Copilot:生成包含YAML前置元数据+Markdown正文的.agent.md文件
  • OpenCode:生成包含YAML前置元数据的Markdown配置文件

Step 5: Add Specialized Instructions

步骤5:添加专属说明

Write clear, actionable instructions in the file body:
  • Define the agent's role and expertise
  • Specify key behaviors and guidelines
  • Include workflow steps if applicable
  • Provide tool usage guidance
在文件正文中编写清晰、可执行的说明:
  • 定义Agent的角色与专业领域
  • 指定关键行为与准则
  • 如有需要,包含工作流程步骤
  • 提供工具使用指南

Step 6: Configure Tools & Permissions

步骤6:配置工具与权限

Set appropriate tool access levels:
  • Copilot: Specify tool names in
    tools
    array
  • OpenCode: Set individual tool permissions (true/false/"ask")
设置合适的工具访问级别:
  • Copilot:在
    tools
    数组中指定工具名称
  • OpenCode:设置单个工具的权限(true/false/"ask")

Copilot Agents

Copilot Agent

Custom agents for VS Code Copilot are defined in
.agent.md
files with YAML frontmatter.
File Structure:
  • Frontmatter: YAML with fields like
    description
    ,
    name
    ,
    tools
    ,
    model
    ,
    handoffs
  • Body: Markdown instructions for the agent
Common Fields:
  • description
    : Brief description shown in chat input
  • tools
    : List of available tools
  • model
    : AI model to use
  • handoffs
    : Suggested next steps for workflow transitions
See references/copilot-agents.md for complete documentation.
VS Code Copilot的自定义Agent通过带有YAML前置元数据的.agent.md文件定义。
文件结构
  • 前置元数据:包含
    description
    name
    tools
    model
    handoffs
    等字段的YAML
  • 正文:用于指导Agent的Markdown说明
常见字段
  • description
    :在聊天输入中显示的简要描述
  • tools
    :可用工具列表
  • model
    :使用的AI模型
  • handoffs
    :工作流程转换的建议后续步骤
完整文档请参考references/copilot-agents.md

OpenCode Agents

OpenCode Agent

Agents for OpenCode can be defined in JSON config or Markdown files.
Configuration Options:
  • description
    : Required description
  • mode
    : "primary" or "subagent"
  • model
    : Model identifier
  • tools
    : Tool permissions (true/false)
  • permissions
    : Granular control over actions
  • temperature
    : Response creativity (0.0-1.0)
See references/opencode-agents.md for complete documentation.
OpenCode的Agent可通过JSON配置或Markdown文件定义。
配置选项
  • description
    :必填描述
  • mode
    :"primary"(主Agent)或"subagent"(子Agent)
  • model
    :模型标识符
  • tools
    :工具权限(true/false)
  • permissions
    :对操作的精细化控制
  • temperature
    :回复创造性(0.0-1.0)
完整文档请参考references/opencode-agents.md

Validation & Verification Steps

验证与核查步骤

After generating the agent configuration, verify the following:
生成Agent配置后,请核查以下内容:

1. File Structure Validation

1. 文件结构验证

  • ✅ File exists in correct location (
    .github/agents/
    for Copilot,
    .opencode/agents/
    for OpenCode)
  • ✅ File has correct extension (
    .agent.md
    for Copilot,
    .md
    for OpenCode)
  • ✅ File name matches agent identifier (e.g.,
    code-reviewer.agent.md
    )
  • ✅ 文件存放在正确位置(Copilot为
    .github/agents/
    ,OpenCode为
    .opencode/agents/
  • ✅ 文件扩展名正确(Copilot为
    .agent.md
    ,OpenCode为
    .md
  • ✅ 文件名与Agent标识符匹配(例如:
    code-reviewer.agent.md

2. Frontmatter Validation

2. 前置元数据验证

  • ✅ YAML frontmatter is syntactically valid
  • ✅ Required fields present:
    description
    ,
    name
    (Copilot) or
    mode
    (OpenCode)
  • ✅ No invalid field values (e.g., tools exist, models are supported, temperature is 0.0-1.0)
  • ✅ YAML前置元数据语法有效
  • ✅ 必填字段已存在:Copilot需
    description
    name
    ;OpenCode需
    mode
  • ✅ 无无效字段值(例如:工具存在、模型受支持、温度值在0.0-1.0之间)

3. Instructions Validation

3. 说明内容验证

  • ✅ Agent body contains clear, actionable instructions
  • ✅ Instructions are specific to the agent's role
  • ✅ Tool references are correct (use
    #tool:toolName
    format for Copilot)
  • ✅ Agent正文包含清晰、可执行的说明
  • ✅ 说明内容与Agent角色匹配
  • ✅ 工具引用正确(Copilot使用
    #tool:toolName
    格式)

4. Platform-Specific Validation

4. 平台专属验证

For Copilot agents:
  • ✅ Tools list contains valid Copilot tools
  • ✅ Model names are valid (check Copilot's supported models)
  • ✅ Handoffs reference existing agents (if configured)
  • ✅ File can be loaded in VS Code without errors
For OpenCode agents:
  • ✅ Mode is either "primary" or "subagent"
  • ✅ Tool permissions are boolean or "ask"/"allow"/"deny" (for permissions)
  • ✅ Temperature value is between 0.0 and 1.0
  • ✅ File can be loaded by OpenCode config parser
针对Copilot Agent:
  • ✅ 工具列表包含有效的Copilot工具
  • ✅ 模型名称有效(请核对Copilot支持的模型)
  • ✅ 任务交接引用的Agent已存在(若已配置)
  • ✅ 文件可在VS Code中正常加载无报错
针对OpenCode Agent:
  • ✅ 模式为"primary"或"subagent"
  • ✅ 工具权限为布尔值或"ask"/"allow"/"deny"(权限设置)
  • ✅ 温度值在0.0到1.0之间
  • ✅ 文件可被OpenCode配置解析器正常加载

5. Functionality Verification

5. 功能验证

  • ✅ Agent can be invoked/selected in the UI
  • ✅ Tools specified are actually available and functional
  • ✅ Instructions are followed when the agent is used
  • ✅ No errors in agent logs when activated
  • ✅ Agent可在UI中被调用/选择
  • ✅ 指定的工具实际可用且功能正常
  • ✅ Agent运行时会遵循说明内容
  • ✅ Agent激活时日志中无报错

Concrete Examples

具体示例

Example 1: VS Code Copilot Security Reviewer Agent

示例1:VS Code Copilot安全审查Agent

File:
.github/agents/security-reviewer.agent.md
markdown
---
description: Reviews code for security vulnerabilities and best practices
name: Security Reviewer
tools: ['fetch', 'search', 'usages']
model: ['Claude Opus 4.5', 'GPT-5.2']
handoffs:
  - label: Fix Issues
    agent: agent
    prompt: Now implement fixes for the security issues identified above.
    send: false
---
文件:
.github/agents/security-reviewer.agent.md
markdown
---
description: Reviews code for security vulnerabilities and best practices
name: Security Reviewer
tools: ['fetch', 'search', 'usages']
model: ['Claude Opus 4.5', 'GPT-5.2']
handoffs:
  - label: Fix Issues
    agent: agent
    prompt: Now implement fixes for the security issues identified above.
    send: false
---

Security Code Reviewer

Security Code Reviewer

You are a security expert reviewing code for vulnerabilities. Focus on:
You are a security expert reviewing code for vulnerabilities. Focus on:

Security Focus Areas

Security Focus Areas

  • Input validation vulnerabilities
  • Authentication and authorization flaws
  • SQL injection and command injection risks
  • Data exposure and sensitive information handling
  • Insecure deserialization
  • Dependency vulnerabilities
  • CORS and CSRF protection
  • Input validation vulnerabilities
  • Authentication and authorization flaws
  • SQL injection and command injection risks
  • Data exposure and sensitive information handling
  • Insecure deserialization
  • Dependency vulnerabilities
  • CORS and CSRF protection

Analysis Guidelines

Analysis Guidelines

  1. Examine the code structure and data flow
  2. Identify potential attack vectors
  3. Check for missing input validation
  4. Verify secure defaults are used
  5. Look for hardcoded secrets or credentials
  1. Examine the code structure and data flow
  2. Identify potential attack vectors
  3. Check for missing input validation
  4. Verify secure defaults are used
  5. Look for hardcoded secrets or credentials

Output Format

Output Format

  • List each security finding with severity (Critical/High/Medium/Low)
  • Provide specific recommendations for each issue
  • Reference relevant security standards (OWASP, CWE)
  • Suggest code examples when applicable
  • List each security finding with severity (Critical/High/Medium/Low)
  • Provide specific recommendations for each issue
  • Reference relevant security standards (OWASP, CWE)
  • Suggest code examples when applicable

Tools Available

Tools Available

Use #tool:fetch to examine relevant files and #tool:search to find similar patterns.
undefined
Use #tool:fetch to examine relevant files and #tool:search to find similar patterns.
undefined

Example 2: OpenCode Code Review Agent

示例2:OpenCode代码审查Agent

File:
.opencode/agents/code-reviewer.md
markdown
---
description: Reviews code for quality, best practices, and potential issues
mode: subagent
model: anthropic/claude-sonnet-4-20250514
temperature: 0.1
permission:
  edit: deny
  bash:
    "git diff": allow
    "grep *": allow
tools:
  write: false
  edit: false
  bash: true
---
You are a code reviewer focused on quality, maintainability, and best practices.
文件:
.opencode/agents/code-reviewer.md
markdown
---
description: Reviews code for quality, best practices, and potential issues
mode: subagent
model: anthropic/claude-sonnet-4-20250514
temperature: 0.1
permission:
  edit: deny
  bash:
    "git diff": allow
    "grep *": allow
tools:
  write: false
  edit: false
  bash: true
---
You are a code reviewer focused on quality, maintainability, and best practices.

Review Checklist

Review Checklist

  • Code readability and naming conventions
  • Test coverage and edge cases
  • Performance implications
  • Security concerns
  • Adherence to project standards
  • Error handling and logging
  • Code readability and naming conventions
  • Test coverage and edge cases
  • Performance implications
  • Security concerns
  • Adherence to project standards
  • Error handling and logging

Analysis Process

Analysis Process

  1. Read the relevant code files
  2. Check test coverage
  3. Look for performance issues
  4. Verify error handling
  5. Compare against project patterns
  1. Read the relevant code files
  2. Check test coverage
  3. Look for performance issues
  4. Verify error handling
  5. Compare against project patterns

Feedback Style

Feedback Style

  • Be constructive and specific
  • Suggest improvements with examples
  • Ask questions if intent is unclear
  • Acknowledge good practices
  • Be constructive and specific
  • Suggest improvements with examples
  • Ask questions if intent is unclear
  • Acknowledge good practices

Tools Usage

Tools Usage

Use bash to run git diff and grep for pattern analysis. Use read-only access only - make no changes.
undefined
Use bash to run git diff and grep for pattern analysis. Use read-only access only - make no changes.
undefined

Example 3: OpenCode Documentation Writer Agent

示例3:OpenCode文档撰写Agent

File:
.opencode/agents/docs-writer.md
markdown
---
description: Writes and maintains project documentation
mode: subagent
temperature: 0.3
tools:
  bash: false
  edit: true
---
You are a technical documentation writer specializing in clear, comprehensive documentation.
文件:
.opencode/agents/docs-writer.md
markdown
---
description: Writes and maintains project documentation
mode: subagent
temperature: 0.3
tools:
  bash: false
  edit: true
---
You are a technical documentation writer specializing in clear, comprehensive documentation.

Documentation Standards

Documentation Standards

  • Clear, concise language suitable for developers
  • Proper markdown formatting with appropriate headings
  • Code examples that are tested and functional
  • Consistent terminology throughout
  • Links to related documentation
  • Clear, concise language suitable for developers
  • Proper markdown formatting with appropriate headings
  • Code examples that are tested and functional
  • Consistent terminology throughout
  • Links to related documentation

Writing Process

Writing Process

  1. Understand the feature or concept deeply
  2. Structure documentation logically
  3. Add relevant code examples
  4. Review for clarity and completeness
  5. Check links and cross-references
  1. Understand the feature or concept deeply
  2. Structure documentation logically
  3. Add relevant code examples
  4. Review for clarity and completeness
  5. Check links and cross-references

Output Guidelines

Output Guidelines

  • Use proper heading hierarchy (H1, H2, H3)
  • Include practical examples
  • Document edge cases and limitations
  • Provide both getting started and advanced sections
undefined
  • Use proper heading hierarchy (H1, H2, H3)
  • Include practical examples
  • Document edge cases and limitations
  • Provide both getting started and advanced sections
undefined

Example 4: VS Code Copilot Planning Agent

示例4:VS Code Copilot规划Agent

File:
.github/agents/planner.agent.md
markdown
---
description: Generates detailed implementation plans for new features or refactoring
name: Planner
tools: ['fetch', 'search', 'githubRepo']
model: 'Claude Opus 4.5'
handoffs:
  - label: Implement Plan
    agent: agent
    prompt: Now implement the plan outlined above, following the implementation steps.
    send: false
---
文件:
.github/agents/planner.agent.md
markdown
---
description: Generates detailed implementation plans for new features or refactoring
name: Planner
tools: ['fetch', 'search', 'githubRepo']
model: 'Claude Opus 4.5'
handoffs:
  - label: Implement Plan
    agent: agent
    prompt: Now implement the plan outlined above, following the implementation steps.
    send: false
---

Implementation Planner

Implementation Planner

You are an expert at creating comprehensive implementation plans.
You are an expert at creating comprehensive implementation plans.

Planning Methodology

Planning Methodology

  1. Analysis Phase: Understand requirements and constraints
  2. Design Phase: Propose architecture and approach
  3. Breakdown Phase: Create detailed implementation steps
  4. Testing Phase: Define verification strategy
  5. Review Phase: Identify risks and dependencies
  1. Analysis Phase: Understand requirements and constraints
  2. Design Phase: Propose architecture and approach
  3. Breakdown Phase: Create detailed implementation steps
  4. Testing Phase: Define verification strategy
  5. Review Phase: Identify risks and dependencies

Output Structure

Output Structure

  • Executive Summary (1-2 paragraphs)
  • Requirements Analysis
  • Proposed Architecture
  • Implementation Steps (ordered and detailed)
  • Testing Strategy
  • Risk Assessment
  • Dependencies and Prerequisites
  • Executive Summary (1-2 paragraphs)
  • Requirements Analysis
  • Proposed Architecture
  • Implementation Steps (ordered and detailed)
  • Testing Strategy
  • Risk Assessment
  • Dependencies and Prerequisites

Key Principles

Key Principles

  • Plans should be actionable and specific
  • Each step should have clear success criteria
  • Include estimated complexity (low/medium/high)
  • Reference existing code patterns
  • Account for backward compatibility
undefined
  • Plans should be actionable and specific
  • Each step should have clear success criteria
  • Include estimated complexity (low/medium/high)
  • Reference existing code patterns
  • Account for backward compatibility
undefined

Resources

资源

references/

references/

  • copilot-agents.md
    : Full documentation for Copilot custom agents
  • opencode-agents.md
    : Full documentation for OpenCode agents
  • copilot-agents.md
    :Copilot自定义Agent完整文档
  • opencode-agents.md
    :OpenCode Agent完整文档

assets/

assets/

  • copilot-template.agent.md
    : Template for Copilot agent files
  • opencode-template.md
    : Template for OpenCode agent files
  • copilot-template.agent.md
    :Copilot Agent文件模板
  • opencode-template.md
    :OpenCode Agent文件模板