Home › Rules › GitHub Copilot custom agents and prompt files
GitHub Copilot custom agents and prompt files: where the files go, examples, and what's changing
Short answer: a Copilot custom agent is one Markdown file, <name>.agent.md, with a YAML header (only description is required) and the agent's instructions below it. Put it in .github/agents/ for one repo or ~/.copilot/agents/ for all your projects. You pick it from the agent dropdown in VS Code or on GitHub.com, or with /agent in Copilot CLI. A prompt file is a .prompt.md file in .github/prompts/ that you run with a slash command. Big change: VS Code's docs now say prompt files only run in its Local harness, which is being removed by February 2027, and they point you to skills instead.
Both files save you from typing the same long instructions over and over. The difference is how long they last: you switch to an agent and it stays on, while a prompt file runs one job and is done. If you're still deciding between these and the always-on files, our copilot-instructions.md examples cover the rules side and GitHub Copilot skills covers SKILL.md.
Custom agent, prompt file, skill or instructions?
GitHub's customization cheat sheet and VS Code's docs line them up like this (our wording):
| File | How it starts | Good for | Where it works |
|---|---|---|---|
Custom agent (.agent.md) | You pick it from the agent list, or another agent hands it a subtask | A role that should keep its own tools and rules for a whole session: reviewer, planner, test writer | VS Code, Visual Studio, Copilot CLI, GitHub.com, the Copilot app; preview in JetBrains, Eclipse and Xcode |
Prompt file (.prompt.md) | You type /name in chat | One task you run again and again with different input | VS Code (Local harness only), Visual Studio; preview in JetBrains and Xcode. Not Copilot CLI, not GitHub.com |
Skill (SKILL.md) | Copilot loads it when the task matches, or you type /name | A repeatable job with steps, scripts or templates | VS Code, Visual Studio, Copilot CLI, GitHub.com; preview in JetBrains |
Instructions (copilot-instructions.md, AGENTS.md) | Always on | House rules for every chat | Nearly everywhere |
A simple test: if you'd say "be the reviewer now," make an agent. If you'd say "do this one thing," make a prompt file today, or a skill if you want it to keep working in VS Code after February 2027. VS Code's own advice is to start with one task you repeat and only build an agent when the default agent keeps needing the same extra guidance.
Where custom agent files go
| Scope | Folder | Read by |
|---|---|---|
| One repository | .github/agents/ | VS Code, Copilot CLI, GitHub.com cloud agent, the other IDEs |
| You, every project | ~/.copilot/agents/ | Copilot CLI and the Copilot harness in VS Code |
| Claude-format agents | .claude/agents/ (and ~/.claude/agents/ in VS Code) | Copilot CLI reads the project folder; VS Code reads both in the Claude format |
| Organization | agents/ at the root of the org's .github or .github-private repo | Every repo in the org; VS Code shows them in the dropdown by default |
| Enterprise | agents/ in the .github-private repo of an org chosen in enterprise settings | Every org in the enterprise |
- File name:
.agent.mdor plain.md. On GitHub.com the name may only use letters, numbers,.,-and_. The file name (without the ending) is the agent's ID; thenamefield is just the label you see. - Subfolders: Copilot CLI turns
agents/team/reviewer.agent.mdinto the IDteam--reviewer. - Same ID in two places: in Copilot CLI your personal agent in
~/.copilot/agents/beats the repository one. For cloud agent on GitHub.com, the repository beats the organization, and the organization beats the enterprise. - Monorepo: Copilot CLI looks in
.github/agents/from the folder you're in up to the Git root, and the deepest folder wins. VS Code has a setting,chat.useCustomizationsInParentRepositories, for finding agents in the parent repo when you open a subfolder (its settings page describes it for Local sessions). - Old VS Code profile agents: agents saved in your VS Code profile belong to the Local harness. VS Code's migration list copies them to
~/.copilot/agentsso the Copilot harness and Copilot CLI can see them.
Make your first agent
VS Code: run Chat: Open Customizations from the Command Palette, open the Agents tab, and click New Agent (+) next to Workspace (or User for all projects). You can also run Chat: New Custom Agent, pick Configure Custom Agents from the agent dropdown, or just create .github/agents/pr-reviewer.agent.md yourself. Here's a read-only reviewer:
---
name: PR Reviewer
description: Reviews the current changes for bugs, missing error handling and missing tests. Use when asked to review a branch, a diff or a pull request. Never edits files.
tools: ['read', 'search']
---
You review code changes. You do not write or edit code.
1. Find what changed. Read the changed files and the code that calls them.
2. Look for: wrong behavior, errors that are swallowed or not handled,
user input that is trusted without checks, and secrets in code.
3. Check whether each important change has a test. Name the test that is
missing, in one line.
Answer with a numbered list. For each item give the file and line, what is
wrong, why it matters, and the smallest fix. If you find nothing, say so and
list what you could not check (for example, code you could not run).
Free rules starter pack for Cursor, Claude Code, Codex and Antigravity
One shared AGENTS.md that works across Cursor, Claude Code, Codex, Copilot and Antigravity, plus database and test rules in each tool's format. Unzip it into your project and fill in two sections. I'll email you the link.
Free. No spam. Unsubscribe anytime. See our privacy note.
Then start a new chat, pick PR Reviewer from the Agent dropdown, and ask "Review my changes." Check what it actually did, not just how the answer looks: a reviewer with only read and search should show no edits and no terminal commands. VS Code's docs make a point worth repeating: "Never edits files" in the text is a request, not a lock. The tools line is what takes the edit tool away.
Copilot CLI: in an interactive session type /agent, press N, choose Project (.github/agents/) or User (~/.copilot/agents/), then either describe the agent and let Copilot write the file or fill in the name, description and instructions yourself. Choose its tools, then restart the CLI so it loads.
GitHub.com: open the agents tab at github.com/copilot/agents, pick the repository (and branch), click the Copilot icon, then Create an agent. GitHub opens a template called my-agent.agent.md in .github/agents. Rename it, fill it in, commit, and merge it into the default branch. After a refresh it shows up in the agent dropdown, and you can also choose it when you assign an issue to Copilot. Pull requests it opens say which agent did the work.
JetBrains, Eclipse, Xcode: GitHub's IDE guide says to use Configure Agents... (JetBrains, Eclipse) or Create an agent (Xcode) from the agent dropdown in Copilot Chat; the file lands in .github/agents. GitHub marks custom agents as public preview in these three.
The header fields
Every field is optional except description. Support differs by product, so this table only lists what the docs say:
| Field | What it does | Where it applies |
|---|---|---|
description | What the agent does and when to use it. Copilot matches your prompt against this to pick an agent on its own | Required (GitHub.com, CLI, VS Code's Copilot schema) |
name | Label in the dropdown. Defaults to the file name | Everywhere |
tools | Which tools it may use. Leave it out for all tools; [] for none | Everywhere (names differ a little) |
model | Model to use, or a list in order of preference | IDEs and CLI. GitHub's cloud agent steps only mention it for IDEs |
target | vscode or github-copilot. Leave it out for both | GitHub.com and IDEs. In VS Code it changes how the editor checks the file, not which harness runs it |
user-invocable | false hides it from the dropdown so only other agents can call it | GitHub.com, VS Code |
disable-model-invocation | true means Copilot won't pick it by itself; you have to choose it | GitHub.com, VS Code |
mcp-servers | MCP servers only this agent gets | GitHub.com cloud agent and Copilot CLI. GitHub says not used in VS Code and other IDEs |
include-custom-instructions | Lets the agent read your repo's instruction files when it runs as a subagent | Copilot CLI |
handoffs, agents, argument-hint | Next-step buttons, which subagents it may call, hint text in the chat box | VS Code Local harness only. GitHub.com ignores handoffs and argument-hint |
The instructions under the header can be up to 30,000 characters (GitHub's limit). The old infer field is being replaced by user-invocable and disable-model-invocation. In the VS Code Copilot harness and in Copilot CLI, the agent's instructions are added on top of your normal custom instructions, and VS Code says the agent's win where they conflict.
Tool names
GitHub documents seven short names that work across products. They aren't case-sensitive, and names a product doesn't know are skipped instead of breaking the file:
| Name | Also accepted | What it allows |
|---|---|---|
read | Read, NotebookRead | Read files |
search | Grep, Glob | Find files and text |
edit | Edit, MultiEdit, Write, NotebookEdit | Change files |
execute | shell, Bash, powershell | Run terminal commands |
agent | custom-agent, Task | Call another agent |
web | WebSearch, WebFetch | Fetch pages and search (not on the cloud agent yet) |
todo | TodoWrite | Keep a task list (VS Code, not the cloud agent) |
For MCP tools, use server-name/tool-name, or server-name/* for all of a server's tools. On GitHub.com the github and playwright servers are already there (github/*, playwright/*). In Copilot CLI, * anywhere in the list means every tool.
A second example, for Copilot CLI. It can edit and run tests, and it reads your repo rules even when another agent hands it the job:
---
name: test-writer
description: Writes missing unit tests for one file or function the user names. Use for "add tests", "cover this function" or "write a test for".
tools: ["read", "search", "edit", "execute"]
include-custom-instructions: true
---
Write tests only. Do not change the code under test.
1. Read the file the user names and any tests that already exist for it.
2. Use the test framework and folder layout this project already uses.
3. Add tests for the usual path, one blank or absent input, and one
failure path. Keep each test short and give it a plain name.
4. Run only the new tests. If one fails because the code is wrong, stop
and report it instead of changing the code.
Finish with the test file path and the command you ran.
Why include-custom-instructions? GitHub's CLI reference says a custom agent called as a subagent does not get copilot-instructions.md, AGENTS.md or CLAUDE.md unless you add that line. When you pick the agent yourself, it already gets them. VS Code's reference says it doesn't pass this field along when it converts agents for its Copilot harness, so don't count on it there.
Running an agent
- VS Code: choose the harness in Session Target, then the agent in the Agent dropdown. It stays selected until you switch back. If the agent sets a model, picking it switches to that model;
model-policy: requiredstops you from choosing another one. - Copilot CLI:
/agentto pick from a list, a plain request like "Use the test-writer agent on src/utils.ts", or from the shell:copilot --agent test-writer --prompt "Add tests for parseConfig". You can pass thenamein quotes instead of the ID. - GitHub.com: the dropdown in the agents tab or panel, or when you assign an issue.
- By itself: Copilot can choose one of your agents when the request matches its description. On GitHub.com and in VS Code,
disable-model-invocation: trueturns that off for an agent.
Agents that call other agents
A custom agent is a definition. A subagent is any agent doing a piece of work in its own context window, so the main chat doesn't fill up with every step. Copilot CLI comes with built-in helpers you don't have to write: its command reference lists explore, task, general-purpose, code-review, research, rubber-duck and security-review. It also caps nesting at 6 levels by default and limits how many run at once by plan (2 on Free, 4 on Pro and Pro+). Turning helpers on in each editor, choosing their models, /fleet and the full limits table: GitHub Copilot subagents.
In VS Code, set user-invocable: false on a helper you only want other agents to use. In the Local harness, a coordinator can list its allowed helpers with agents: ['Researcher', 'Reviewer'] plus the agent tool. The Copilot harness uses Copilot's own task tool for this instead, so coordinators written for Local may need their tool list checked.
Handoffs (VS Code Local harness only)
A handoff puts a button under the agent's answer that switches to another agent with a ready-made prompt. It's the "plan first, then build" pattern:
---
name: Feature Planner
description: Turns a feature request into a short numbered build plan before any code is written. Use when asked to plan a feature.
tools: ['read', 'search']
handoffs:
- label: Build step 1
agent: agent
prompt: Build only step 1 of the plan above, then stop so I can check it.
send: false
---
Do not edit files. Read enough of the project to understand how it is built.
Return a plan with these headings:
- What we are building (two sentences)
- Files to add or change
- Steps (5 to 8, each small enough to check in one sitting)
- Tests to add
- Questions I need to answer first
Each handoff needs label, agent and prompt; send: true would submit the prompt without waiting for you. VS Code's docs say handoffs work only in the Local harness, the Copilot harness doesn't accept them, and GitHub.com ignores them. Since Local is being removed by February 2027, use handoffs for convenience, not for anything you'll depend on long term.
Prompt files
A prompt file is a saved request. Save it as <name>.prompt.md in .github/prompts/ (or in your VS Code profile for just you), then type /name in chat and add any extra details after it. In VS Code you can also run Chat: Run Prompt or press the play button at the top of the open file.
---
name: add-endpoint
description: Add one API endpoint that follows the patterns already in this project
argument-hint: method and path, for example POST /api/invites
agent: agent
---
Add this endpoint: ${input:endpoint:POST /api/example}
1. Find two endpoints in this project that already work and copy their
structure: routing, input checks, error format and tests.
2. Follow [our API rules](../instructions/api.instructions.md).
3. Add one test for success and one for bad input.
4. List every file you changed.
The header fields VS Code documents are name, description, argument-hint, agent (ask, agent, plan or one of your custom agents), model and tools. If both the prompt file and its agent list tools, the prompt file's list wins. Links like ../instructions/api.instructions.md are relative to the prompt file, and ${input:name:placeholder} is a blank for you to fill in (VS Code says most models understand that syntax and will ask you for it). Our example links to an api.instructions.md; point it at whatever rules file you actually have.
Other IDEs: Visual Studio reads the same .github/prompts folder. In JetBrains you can create one under Settings → Tools → GitHub Copilot → Edit Settings → Customizations → Prompt Files, and run it with /name. GitHub's tables list Eclipse, GitHub.com and Copilot CLI as not supported. How slash commands compare across Claude Code, Cursor, Codex and Copilot: custom slash commands.
The February 2027 change: prompt files to skills
This is the part most guides haven't caught up with. VS Code now runs chat through "harnesses." VS Code tells you to start with the Copilot harness for day-to-day work; the old Local harness is deprecated and VS Code's docs say it will be removed by February 2027. Prompt files only run in Local. Copilot harness sessions "do not load *.prompt.md files" and use skills for the same job.
VS Code has a built-in converter. Select Copilot as the Session Target, run Chat: Open Customizations and choose Migrations (or click Review Migrations when chat shows the notice). Expand Convert Prompt to Skills, select your prompt files, check where they'll go, and click Migrate. What to know before you do:
- It keeps
name,descriptionand the argument hint. It does not keepagent,modelortools. If your prompt needs those, use Migrate with Agent, which can set up a matching custom agent too. VS Code notes that Migrate with Agent uses Copilot credits. - It adds
disable-model-invocation: true, so the skill still only runs when you type its slash command, the way the prompt file did. - Run the new skill once in a fresh Copilot session and compare it with the old prompt before deleting anything.
Here's our prompt file from above rewritten as a skill by hand. It lives in its own folder, .github/skills/add-endpoint/:
---
name: add-endpoint
description: Add one API endpoint that follows the patterns already in this project. Use when asked to add an endpoint or a route.
argument-hint: method and path, for example POST /api/invites
disable-model-invocation: true
---
Add the endpoint the user names after /add-endpoint.
1. Find two endpoints in this project that already work and copy their
structure: routing, input checks, error format and tests.
2. Follow the API rules in .github/instructions/api.instructions.md.
3. Add one test for success and one for bad input.
4. List every file you changed.
A skill's name has to equal its folder name and stick to lowercase letters, digits and hyphens; VS Code says a name with other characters silently fails to load. The ${input:...} line is gone because VS Code documents that syntax for prompt files, not skills; you type the details after /add-endpoint instead. More on the format: GitHub Copilot skills.
Chat modes are now custom agents
If you followed an older tutorial, you may have .chatmode.md files. VS Code's reference says custom agents "were previously known as custom chat modes." Rename each file to .agent.md and move it into .github/agents/ or ~/.copilot/agents/. The old chat.modeFilesLocations setting is deprecated; chat.agentFilesLocations still works but Copilot CLI and the Copilot app don't read it, so the standard folders are the safer bet.
When it doesn't work
- Agent missing from the list (VS Code): check that you picked the right harness, the folder and the file ending. VS Code also warns that a new worktree won't have an agent file you haven't committed yet.
- Listed in Customizations but not in the dropdown: look for a header error or
user-invocable: false. - Can't send a message: the agent has
model-policy: requiredand none of its models are available to you. Pick a model you have or change it topreferred. - New agent not showing in Copilot CLI: restart the CLI; it loads agents at start. Check
~/.copilot/agents/or.github/agents/and the file ending. - Not in the GitHub.com dropdown: the file has to be merged into the default branch. Refresh the agents tab after merging.
- Wrong agent runs in the CLI: two agents share an ID or a
name. The CLI uses the first match in its order (user, then project.github/agents, then.claude/agents, then added folders, plugins, and finally org or enterprise). - Agent ignores your repo rules as a subagent: add
include-custom-instructions: true(Copilot CLI). Starting the CLI with--no-custom-instructionsturns them off for every agent. - Agent uses tools it shouldn't: leaving out
toolsmeans all tools. List them. In Local, a prompt file'stoolslist overrides the agent's. /your-promptdoesn't appear: the session isn't on the Local harness, the file isn't named.prompt.md, or it's not in.github/prompts. In the Copilot harness it never will; convert it to a skill.mcp-serversin the agent file does nothing in VS Code: GitHub says the field isn't used in IDE agents, and VS Code says it doesn't pass it to the Copilot harness. Set the server up in VS Code's normal MCP config.
Still stuck? VS Code's troubleshooting steps point to the Agent Debug Log, opened from the ... menu in the Chat view, which shows what was found and any errors.
Where GitHub's and VS Code's docs disagree
- Prompt files. GitHub's feature matrix and cheat sheet list prompt files as supported in VS Code. VS Code says they only run in the Local harness, which goes away by February 2027. GitHub's VS Code steps still say to add
"chat.promptFiles": true; that setting isn't in VS Code's settings reference (it listschat.promptFilesLocations, marked deprecated). - Which IDEs have prompt files. GitHub's prompt file tutorial and IDE guide say VS Code, Visual Studio and JetBrains only. GitHub's concept page and tables add Xcode (preview).
- Eclipse custom agents. The feature matrix marks them supported; the cheat sheet and the configuration reference say public preview; the concepts page names only JetBrains and Xcode as preview.
- Field names in Copilot CLI. The CLI command reference spells them
modelPolicyandreasoningEffort, with a separatemodelslist. GitHub's own CLI how-to example and VS Code usemodel-policy. Copy the spelling from the page for the tool you use. infer. GitHub's configuration reference calls it retired and VS Code calls it deprecated, but the CLI command reference still lists it with a default oftrue.- Built-in CLI agents. The CLI command reference lists seven; the "Invoking custom agents" page shows four (Explore, Task, General-purpose, Code-review).
- Creating an agent in VS Code. GitHub's IDE guide says Agent dropdown → Configure Custom Agents → Create new custom agent, saved in your "user profile folder." VS Code's current docs use the Agent Customizations editor and put user agents for the Copilot harness in
~/.copilot/agents.
Where they disagree, this page follows the doc for the product you're in, and says which one.
FAQ
Where do Copilot custom agent files go?
For one repository, put them in .github/agents/ as name.agent.md files. For every project on your computer, use ~/.copilot/agents/, which both Copilot CLI and the Copilot harness in VS Code read. Organizations can share agents from an agents folder in their .github or .github-private repository. Copilot CLI also reads .claude/agents/ in your project.
What is the difference between a custom agent and a prompt file?
A custom agent is a role you switch to, like a reviewer or a planner, that brings its own instructions and a fixed set of tools. It stays selected until you switch back. A prompt file is a one-off task you run with a slash command, like /add-endpoint, and it only runs once per use. Custom agents work in VS Code, Copilot CLI, GitHub.com and other IDEs; prompt files only work in some IDEs.
Are Copilot prompt files going away?
In VS Code, yes for now: VS Code's docs say prompt files run only in the Local harness, which is deprecated and will be removed by February 2027, and they tell you to convert prompt files to skills. GitHub's own docs still list prompt files as supported in VS Code and Visual Studio and in preview in JetBrains and Xcode. Copilot CLI and GitHub.com don't use them.
How do I use a custom agent in Copilot CLI?
Type /agent in an interactive session and pick one, name it in your prompt (for example, 'Use the test-writer agent on src/utils.ts'), or start the CLI with copilot --agent test-writer --prompt 'your task'. Copilot can also pick an agent on its own when your prompt matches the agent's description. Restart the CLI after you add a new agent file.
Why doesn't my custom agent show up?
Check the folder and file name first: .github/agents/ with an .agent.md or .md ending, or ~/.copilot/agents/ for your own. On GitHub.com the file has to be merged into the default branch. In VS Code, make sure the right harness is selected and that the file doesn't set user-invocable: false. In Copilot CLI, restart it after adding the file.
What happened to Copilot chat modes?
They were renamed. VS Code's docs say custom agents were previously called custom chat modes. If you have .chatmode.md files, rename them to .agent.md and move them into a custom agent folder such as .github/agents/. The old chat.modeFilesLocations setting is deprecated.
Related setups
The same "specialist agent" idea exists in other tools with different folders: Claude Code uses .claude/agents/ (which Copilot CLI also reads), and Kiro has its own format. See Kiro custom agents and Antigravity subagents. For the always-on rules your agents build on, see AGENTS.md examples.
Next step for GitHub Copilot: Agent Skills
Skills are folders your AI coding agent loads only when the job comes up, and Claude Code, Cursor and OpenAI Codex all read the same SKILL.md format. The Vibe Coder Skills Pack ($9) is 6 ready-to-copy SKILL.md skills (fix-one-bug, stop-the-loop, leak-check, ship-check, explain-project, builder-handoff) for Claude Code, Cursor and OpenAI Codex. Also included in the 6-kit bundle.
Get the Skills Pack for $9 on Gumroad → See what's inside
One .zip of skill folders plus one markdown file. 7-day refund, no questions asked.
Best value
All 6 kits for $29 — or $20.30 with code WELCOME30 (through Nov 30)
A custom agent decides how Copilot works. The kits decide what it builds, step by step: a small game, a Discord bot, an email-triage agent, an MVP, or a cleanup of messy code.
Get all 6 kits for $29 → See what's in each kit
$29 instead of $48 for the six kits bought separately; WELCOME30 takes 30% off that at checkout ($20.30). Instant download from Gumroad. 7-day refund, no questions asked.
Related
- GitHub Copilot skills (folder, SKILL.md, gh skill, examples)
- copilot-instructions.md examples (7 copy-paste instruction files)
- AGENTS.md examples (8 copy-paste files)
- GitHub Copilot vs Cursor vs Claude Code (prices side by side)
- GitHub Copilot AI credits explained (what they cost and how to save)
- GitHub Copilot subagents (turn them on, models, /fleet, limits, cost)
- Claude Code subagents examples
- Custom slash commands (Claude Code, Cursor, Codex, Copilot)
- Kiro custom agents
- Free rules file generator
Sources
- GitHub Docs: Custom agents (concepts)
- GitHub Docs: Custom agents configuration
- GitHub Docs: Creating custom agents for Copilot cloud agent
- GitHub Docs: Using custom agents in your IDE
- GitHub Docs: Creating and using custom agents for Copilot CLI
- GitHub Docs: Invoking custom agents (Copilot CLI)
- GitHub Docs: Copilot CLI command reference (custom agents)
- GitHub Docs: Prompt files for GitHub Copilot
- GitHub Docs: Copilot customization cheat sheet
- GitHub Docs: Copilot feature matrix
- VS Code docs: Custom agents
- VS Code docs: Custom agent file reference
- VS Code docs: Use prompt files
- VS Code docs: Migrate customizations to the Copilot harness
- VS Code docs: Agent harnesses
- VS Code docs: Subagents
Every path, field, command, menu name and limit here was checked Nov 18, 2026 against GitHub's Copilot docs and the VS Code docs. Both change often, and VS Code is in the middle of moving people from its Local harness to the Copilot harness, so check the linked page if a menu looks different. If something here no longer matches, tell us at [email protected].