AgentSkillsCN

copilot-agent-chat-implementation

为VS Code设置并验证GitHub Copilot Agent Chat文件。在创建或审查.github/copilot-instructions.md、.github/instructions/*.instructions.md、.github/prompts/*.prompt.md、.github/agents/*.agent.md,或.github/skills/<name>/SKILL.md时使用。涵盖正确的路径、Frontmatter架构、命名规范、发现行为,以及针对VS Code五类Copilot文件的诊断性检查。

SKILL.md
--- frontmatter
name: copilot-agent-chat-implementation
description: Set up and validate GitHub Copilot Agent Chat files for VS Code. Use when creating or reviewing .github/copilot-instructions.md, .github/instructions/*.instructions.md, .github/prompts/*.prompt.md, .github/agents/*.agent.md, or .github/skills/<name>/SKILL.md. Covers correct paths, frontmatter schemas, naming conventions, discovery behaviour, and diagnostic checks for all five VS Code Copilot file types.

Copilot Agent Chat Implementation

Use this skill when setting up repository structures and file schemas for .github/copilot-instructions.md, .github/instructions/*.instructions.md, .github/prompts/*.prompt.md, .github/agents/*.agent.md, and .github/skills/<skill>/SKILL.md.

File Type Reference

1. Always-On Instructions — .github/copilot-instructions.md

  • Automatically applied to every chat request in the workspace
  • No frontmatter required — plain Markdown
  • Use for: coding standards, architecture decisions, library preferences, security requirements

2. Scoped Instructions — .github/instructions/*.instructions.md

Required frontmatter:

yaml
---
description: "Short description shown on hover"
applyTo: '**/*.py'   # Glob pattern — omit to use semantic matching only
---

Applied when: a file matching applyTo is active, or when the description semantically matches the task.

3. Reusable Prompts — .github/prompts/*.prompt.md

Required frontmatter:

yaml
---
description: "What this prompt does"
agent: 'agent'        # Use 'agent' for full agentic mode
tools: ['search', 'edit', 'read', 'problems', 'execute']
argument-hint: "${input:myVariable}"   # Optional input placeholder
---

Invoked via /prompt-name slash command in Copilot Chat.

4. Custom Agents — .github/agents/*.agent.md

Required frontmatter:

yaml
---
description: "Agent specialisation description"
name: My Agent Name
tools: ['search', 'edit', 'execute', 'read', 'problems']
model: 'Claude Sonnet 4.5'
target: 'vscode'
infer: true
handoffs:
  - label: "Review Security"
    agent: security-review    # Must match another .agent.md filename (without extension)
---

Invoked via @agent-name in Copilot Chat.

5. Project Skills — .github/skills/<name>/SKILL.md

Required frontmatter:

yaml
---
name: skill-name          # Must match parent directory name exactly (lowercase, hyphens)
description: >            # Max 1024 chars; specific about when to trigger
  Detailed trigger description...
argument-hint: "[...]"    # Optional
user-invokable: true      # Optional, default true
---

Directory Structure

code
.github/
├── copilot-instructions.md
├── instructions/
│   └── *.instructions.md
├── prompts/
│   └── *.prompt.md
├── agents/
│   └── *.agent.md
└── skills/
    └── <skill-name>/
        └── SKILL.md

Core Requirements

  • Place always-on rules in .github/copilot-instructions.md
  • Place scoped rules in .github/instructions/*.instructions.md with description and applyTo frontmatter
  • Place reusable prompts in .github/prompts/*.prompt.md with description, agent, tools
  • Place custom agents in .github/agents/*.agent.md with description, tools, model, target
  • Place skills in .github/skills/<skill-name>/SKILL.md with name matching directory, and description

Reliability Checks

  • Use VS Code Chat Diagnostics (Ctrl+Shift+P → "GitHub Copilot: Diagnostics") to verify loaded files
  • Ensure applyTo glob patterns match active files
  • Ensure name in SKILL.md frontmatter matches the parent directory name exactly
  • Ensure agent handoffs reference existing .agent.md filenames
  • Keep descriptions explicit and keyword-rich so discovery triggers correctly

Common Failure Causes

SymptomLikely Cause
Skill not loadingname doesn't match directory name
Instructions not applyingapplyTo glob doesn't match active file type
Agent handoff failsReferenced agent file doesn't exist
Prompt not in / menuFile missing description frontmatter
Always-on instructions ignoredFile not at exact path .github/copilot-instructions.md