# Copilot Mastery

> GitHub Copilot complete guide -- agent mode, custom instructions, MCP servers, prompt files, coding agent, code review, and multi-model configuration.

- Skill: `leolin990405/copilot-mastery` (Agent Skill)
- Install (CLI): `npx get-skill add leolin990405/copilot-mastery`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leolin990405/copilot-mastery/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: LeoLin990405 (https://skillmd.com/u/leolin990405)
- Updated: 2026-11-11
- Page: https://skillmd.com/skills/leolin990405/copilot-mastery

---


# GitHub Copilot Mastery

## Architecture

Multi-model AI pair programmer integrated into VS Code, JetBrains, Eclipse, Xcode, and GitHub web UI.

**Models**: GPT-4o, Claude Sonnet 3.5/3.7, o1, o3-mini, Gemini (selectable via dropdown). VS Code team prefers Claude Sonnet for agent mode.

## Interaction Modes

| Mode | Purpose |
|------|---------|
| Code Completions | Inline ghost-text (Tab to accept) |
| Copilot Chat | Side panel / inline Q&A |
| Agent Mode | Autonomous multi-step coding with tool use |
| Coding Agent | Cloud-hosted agent in GitHub Actions, creates PRs |

**Agent Mode Loop**: Determine context → propose changes + commands → monitor correctness → iterate to fix issues.

## Configuration

### Repository Instructions

`.github/copilot-instructions.md`:
```markdown
We use TypeScript with strict mode enabled.
Use functional components with hooks for React.
Always include error handling in async functions.
Prefer named exports over default exports.
```

### Multiple Instruction Files (2025+)

`*.instructions.md` with YAML frontmatter:
```markdown
---
applyTo: "**/*.ts"
excludeAgent: copilot-review
---
Use ESLint with the airbnb config.
Always use absolute imports from @/.
```

**Priority**: Personal > Repository > Organization instructions.

### Prompt Files

`.github/prompts/*.prompt.md` — reusable templates:
```markdown
# Code Review Checklist
Review the selected code for:
1. Type safety issues
2. Missing error handling
3. Performance concerns
Refer to @file:docs/standards.md for our conventions.
```

### MCP Server Configuration

In VS Code `settings.json`:
```json
{
  "github.copilot.chat.mcp.servers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "@my/mcp-server"],
      "env": { "API_KEY": "..." }
    }
  }
}
```

Auto-approve configurable at server and tool level.

### Agent Discovery Files

Copilot coding agent auto-discovers:
- `AGENTS.md`
- `CLAUDE.md`
- `.github/copilot-instructions.md`

## Best Practices

1. Keep instructions **short and declarative** — one concept per statement
2. Use `*.instructions.md` with `applyTo` globs for language-specific rules
3. Agent mode for multi-step refactoring; Chat for quick questions
4. Configure MCP servers for external tool access
5. Use prompt files for repeatable workflows
6. Review agent-generated PRs before merge

## Sources

- [GitHub Copilot Docs](https://docs.github.com/en/copilot)
- [Custom Instructions](https://docs.github.com/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot)
- [Agent Mode](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode)
- [Coding Agent](https://code.visualstudio.com/docs/copilot/copilot-coding-agent)
- [MCP Tutorial](https://docs.github.com/en/copilot/tutorials/enhance-agent-mode-with-mcp)

