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

From GitHub's Copilot docs (custom agents, configuration reference, Copilot CLI, prompt files, feature matrix) and the VS Code docs, checked Nov 18, 2026. Sources below.

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):

FileHow it startsGood forWhere it works
Custom agent (.agent.​md)You pick it from the agent list, or another agent hands it a subtaskA role that should keep its own tools and rules for a whole session: reviewer, planner, test writerVS Code, Visual Studio, Copilot CLI, GitHub.com, the Copilot app; preview in JetBrains, Eclipse and Xcode
Prompt file (.prompt.​md)You type /name in chatOne task you run again and again with different inputVS 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 /nameA repeatable job with steps, scripts or templatesVS Code, Visual Studio, Copilot CLI, GitHub.com; preview in JetBrains
Instructions (copilot-instructions.​md, AGENTS.​md)Always onHouse rules for every chatNearly 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

ScopeFolderRead 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
Organizationagents/ at the root of the org's .github or .github-private repoEvery repo in the org; VS Code shows them in the dropdown by default
Enterpriseagents/ in the .github-private repo of an org chosen in enterprise settingsEvery org in the enterprise

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:

Our example (VibeKits): .github/agents/pr-reviewer.agent.md
---
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).

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:

FieldWhat it doesWhere it applies
descriptionWhat the agent does and when to use it. Copilot matches your prompt against this to pick an agent on its ownRequired (GitHub.com, CLI, VS Code's Copilot schema)
nameLabel in the dropdown. Defaults to the file nameEverywhere
toolsWhich tools it may use. Leave it out for all tools; [] for noneEverywhere (names differ a little)
modelModel to use, or a list in order of preferenceIDEs and CLI. GitHub's cloud agent steps only mention it for IDEs
targetvscode or github-copilot. Leave it out for bothGitHub.com and IDEs. In VS Code it changes how the editor checks the file, not which harness runs it
user-invocablefalse hides it from the dropdown so only other agents can call itGitHub.com, VS Code
disable-model-invocationtrue means Copilot won't pick it by itself; you have to choose itGitHub.com, VS Code
mcp-serversMCP servers only this agent getsGitHub.com cloud agent and Copilot CLI. GitHub says not used in VS Code and other IDEs
include-custom-instructionsLets the agent read your repo's instruction files when it runs as a subagentCopilot CLI
handoffs, agents, argument-hintNext-step buttons, which subagents it may call, hint text in the chat boxVS 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:

NameAlso acceptedWhat it allows
readRead, NotebookReadRead files
searchGrep, GlobFind files and text
editEdit, MultiEdit, Write, NotebookEditChange files
executeshell, Bash, powershellRun terminal commands
agentcustom-agent, TaskCall another agent
webWebSearch, WebFetchFetch pages and search (not on the cloud agent yet)
todoTodoWriteKeep 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:

Our example (VibeKits): ~/.copilot/agents/test-writer.agent.md
---
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

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:

Our example (VibeKits): .github/agents/feature-planner.agent.md
---
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.

Our example (VibeKits): .github/prompts/add-endpoint.prompt.md
---
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:

Here's our prompt file from above rewritten as a skill by hand. It lives in its own folder, .github/​skills/​add-endpoint/:

Our example (VibeKits): .github/skills/add-endpoint/SKILL.md
---
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

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

  1. 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 lists chat.​promptFilesLocations, marked deprecated).
  2. 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).
  3. 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.
  4. Field names in Copilot CLI. The CLI command reference spells them modelPolicy and reasoningEffort, with a separate models list. GitHub's own CLI how-to example and VS Code use model-policy. Copy the spelling from the page for the tool you use.
  5. 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 of true.
  6. Built-in CLI agents. The CLI command reference lists seven; the "Invoking custom agents" page shows four (Explore, Task, General-purpose, Code-review).
  7. 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

Sources

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].

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.

After that, an occasional email when I publish a new guide or rules file.

Free. No spam. Unsubscribe anytime. See our privacy note.