Skip to content

Commit bc107a0

Browse files
committed
Add product hyperlinks to custom agent article\n\nCo-authored-by: Copilot <[email protected]>
1 parent c5cb1d7 commit bc107a0

1 file changed

Lines changed: 46 additions & 48 deletions

File tree

Content/Tips/create-your-first-custom-copilot-agent.md

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ featured: true
1414

1515
# Create Your First Custom Copilot Agent: Authoring .agent.md Files for Specialized AI Assistants
1616

17-
Custom Copilot agents let you create specialized AI assistants that appear in the `@` menu within Copilot Chat. Instead of one general-purpose assistant, you can build agents with specific roles—like a "code reviewer," "documentation writer," or "database expert"—each with its own expertise, boundaries, and tools.
17+
Custom Copilot agents let you create specialized AI assistants that appear in the `@` menu within [Copilot Chat](https://docs.github.com/en/copilot/using-github-copilot/asking-github-copilot-questions-in-your-ide). Instead of one general-purpose assistant, you can build agents with specific roles—like a "code reviewer," "documentation writer," or "database expert"—each with its own expertise, boundaries, and tools.
1818

19-
If you've already explored `copilot-instructions.md` (global rules for your whole project) or SKILL.md files (reusable playbooks), agents are the next step: they're **named personas that Copilot activates when you call them by name**.
19+
If you've already explored [`copilot-instructions.md`](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot) (global rules for your whole project) or [`SKILL.md`](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot#creating-a-skill-file) files (reusable playbooks), agents are the next step: they're **named personas that Copilot activates when you call them by name**.
2020

2121
## What's a Custom Copilot Agent?
2222

@@ -119,85 +119,83 @@ mkdir -p .github/agents
119119
touch .github/agents/code-reviewer.agent.md
120120
```
121121

122-
### Step 2: Add the frontmatter
122+
### Step 2: Start with frontmatter
123123

124-
Open the file and start with metadata:
125-
126-
```markdown
124+
```yaml
127125
---
128126
name: code-reviewer
129-
description: "Specialized code review agent. Reviews PRs for bugs, performance, security, and style alignment."
127+
description: "Reviews pull requests for code quality, bugs, and best practices."
130128
target: github-copilot
131129
tools:
132130
- git
133131
- npm
134132
disable-model-invocation: false
133+
metadata:
134+
owner: dev-team
135+
version: "1.0"
135136
---
136137
```
137138

139+
This tells Copilot:
140+
- The agent is called `@code-reviewer`
141+
- It reviews code for quality and bugs
142+
- It can use `git` and `npm` commands
143+
- It's enabled for auto-invocation (e.g., when someone asks for a review)
144+
138145
### Step 3: Write the persona
139146

140147
```markdown
141148
# Persona
142149

143-
You are an expert code reviewer. Your role is to:
144-
- Spot bugs, performance bottlenecks, and security issues
145-
- Check that new code follows our project's coding standards
146-
- Suggest cleaner or more idiomatic solutions
147-
- Verify tests exist and cover the changes
150+
You are an experienced senior engineer with 10+ years of code review experience. Your job is to:
148151

149-
You are thorough, constructive, and kind. You explain *why* changes are needed, not just pointing out issues.
152+
1. **Find bugs** before they reach production
153+
2. **Suggest improvements** using best practices from our codebase
154+
3. **Mentor** junior engineers through constructive feedback
155+
4. **Enforce standards** without being pedantic
150156

157+
Your tone is friendly, specific, and actionable—never vague or dismissive.
151158
```
152159

153-
### Step 4: Define boundaries
160+
### Step 4: Set boundaries
154161

155162
```markdown
156163
# Boundaries
157164

158-
You may:
159-
- Review code in `/src`, `/components`, `/pages`, `/services`
160-
- Suggest test additions in `/tests`
161-
- Reference files in `/docs` as style guides
162-
163-
You must NOT:
164-
- Modify production code directly (only suggest changes)
165-
- Touch config files (`.env*`, `secrets`, deployment configs)
166-
- Change package.json or dependencies without explicit approval
165+
- **Only review code changes**, not documentation (unless asked)
166+
- **Don't suggest refactors** unless they fix a real issue or block understanding
167+
- **Don't approve PRs** with failing tests or unresolved TODOs
168+
- **Never** modify code directly—only suggest patterns and explain the "why"
169+
- **Focus on logic, security, and maintainability**—not whitespace or minor style
170+
171+
## Files you CAN review
172+
- `src/**/*.ts` and `src/**/*.js` — application code
173+
- `lib/**/*.ts` — shared libraries
174+
- Tests in `__tests__/`
175+
176+
## Files you should NOT touch
177+
- Configuration files (`webpack.config.js`, `.eslintrc`, etc.)
178+
- Generated code in `dist/` or `build/`
179+
- Third-party dependencies in `node_modules/`
167180
```
168181

169-
### Step 5: Add useful commands and patterns
182+
### Step 5: Add a checklist
170183

171184
```markdown
172-
# Commands to use
173-
174-
- `git diff` — See what changed in the current branch
175-
- `npm test` — Run tests (make sure they still pass)
176-
- `npm run lint` — Check formatting and style
177-
178185
# Code review checklist
179186

180-
When reviewing, ask these questions:
181-
182-
1. **Does it work?**
183-
- Does the code solve the stated problem?
184-
- Are there obvious bugs or edge cases missed?
185-
186-
2. **Is it maintainable?**
187-
- Is the code clear and easy to understand?
188-
- Are variable/function names descriptive?
189-
- Is there unnecessary complexity?
187+
When reviewing, use this checklist:
190188

191-
3. **Does it follow our standards?**
192-
- Check `/docs/coding-standards.md` for naming conventions
193-
- Verify TypeScript strict mode is used (see `copilot-instructions.md`)
194-
- Look for consistent error handling
189+
1. **Correctness?**
190+
- Does the code do what the PR description says?
191+
- Are there edge cases not handled?
195192

196-
4. **Is it tested?**
197-
- Are there new tests for new code?
193+
2. **Tests?**
194+
- Are there tests for the new code?
195+
- Do they cover happy path AND error cases?
198196
- Do all tests pass locally?
199197

200-
5. **Performance & security?**
198+
3. **Performance & security?**
201199
- Any obvious performance issues?
202200
- Are external inputs validated?
203201
- No hardcoded secrets or sensitive data?
@@ -291,7 +289,7 @@ Now that you understand agents, you can:
291289

292290
1. **Create 2–3 agents** for your team's most common workflows.
293291
2. **Combine with skills** — Have an agent that orchestrates a skill (e.g., "security-auditor" calls your "security-scan" skill).
294-
3. **Integrate with MCP** — If you have the GitHub MCP server, agents can fetch live PR data, workflow logs, and more.
292+
3. **Integrate with MCP** — If you have the [GitHub MCP server](https://github.com/github/github-mcp-server), agents can fetch live PR data, workflow logs, and more.
295293
4. **Share organization-wide** — Move agents to `.github-private/agents/` so all your org's repos can use them.
296294

297295
## Learn more

0 commit comments

Comments
 (0)