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:
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:
---
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:
# 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:
{
"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.mdCLAUDE.md.github/copilot-instructions.md
Best Practices
- Keep instructions short and declarative — one concept per statement
- Use
*.instructions.mdwithapplyToglobs for language-specific rules - Agent mode for multi-step refactoring; Chat for quick questions
- Configure MCP servers for external tool access
- Use prompt files for repeatable workflows
- Review agent-generated PRs before merge