Path: blob/main/extensions/copilot/assets/prompts/skills/agent-customization/references/agents.md
13405 views
Custom Agents (.agent.md)
Custom personas with specific tools, instructions, and behaviors. Use for orchestrated workflows with role-based tool restrictions.
Locations
| Path | Scope |
|---|---|
.github/agents/*.agent.md | Workspace |
<profile>/agents/*.agent.md | User profile |
Frontmatter
Invocation Control
| Attribute | Default | Effect |
|---|---|---|
user-invocable: false | true | Hide from agent picker, only accessible as subagent |
disable-model-invocation: true | false | Prevent other agents from invoking as subagent |
Model Fallback
Tools
Sources: built-in aliases, specific tools, MCP servers (<server>/*), extension tools.
Special: [] = no tools, omit = defaults. Body reference: #tool:<name>
Tool Aliases
| Alias | Purpose |
|---|---|
execute | Run shell commands |
read | Read file contents |
edit | Edit files |
search | Search files or text |
agent | Invoke custom agents as subagents |
web | Fetch URLs and web search |
todo | Manage task lists |
Common Patterns
To discover available tools, check your current tool list or use #tool: syntax in the body to reference specific tools.
Template
Invocation
Manual: Agent selector in chat
Subagent: Parent agent delegates based on
descriptionmatch (wheninferallows)
Core Principles
Single role: One persona with focused responsibilities per agent
Minimal tools: Only include what the role needs—excess tools dilute focus
Clear boundaries: Define what the agent should NOT do
Keyword-rich description: Include trigger words so parent agents know when to delegate
Anti-patterns
Swiss-army agents: Too many tools, tries to do everything
Vague descriptions: "A helpful agent" doesn't guide delegation—be specific
Role confusion: Description doesn't match body persona
Circular handoffs: A → B → A without progress criteria
Inline Hooks
Custom agents support inline hooks in frontmatter. These hooks execute shell commands at agent lifecycle points and are scoped to this agent only. The format matches standalone hook files (see hooks reference).
Supported Events
SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, SubagentStart, SubagentStop, Stop
Example
Each hook command supports: type (must be command), command, platform overrides (windows, linux, osx), cwd, env, timeout.