Skip to content

Commit 5d53064

Browse files
digitaraldCopilot
andauthored
Add agent-customization skill with primitives documentation (#3196)
* Add agent-customization skill with primitives documentation * Update assets/prompts/skills/agent-customization/primitives/workspace-instructions.md Co-authored-by: Copilot <[email protected]> * fix: rename agentCustomizationSkill setting to follow Advanced naming convention * Updated skills.md based on spec --------- Co-authored-by: Copilot <[email protected]>
1 parent 9e13d31 commit 5d53064

File tree

12 files changed

+1110
-3
lines changed

12 files changed

+1110
-3
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: agent-customization
3+
description: 'Work with VS Code agent customization files (.instructions.md, .prompt.md, .agent.md, SKILL.md, copilot-instructions.md, AGENTS.md). Use when asked to: create, update, review, fix, or debug instructions/prompts/agents/skills; save coding preferences or conventions; understand how customization files work; troubleshoot why instructions/skills are not applying or being ignored; compare customization approaches; migrate or refactor existing customizations; set up project guidelines; configure applyTo patterns; define tool restrictions; create reusable workflows; build custom agent modes or personas; package domain knowledge; add frontmatter; fix YAML syntax; or share team standards.'
4+
---
5+
6+
# Agent Customization
7+
8+
## Decision Flow
9+
10+
| Primitive | When to Use |
11+
|-----------|-------------|
12+
| Workspace Instructions | Always-on, applies everywhere in the project |
13+
| File Instructions | Explicit via `applyTo` patterns, or on-demand via `description` |
14+
| MCP | Integrates external systems, APIs, or data |
15+
| Custom Agents | Subagents for context isolation, or multi-stage workflows with tool restrictions |
16+
| Prompts | Single focused task with parameterized inputs |
17+
| Skills | On-demand workflow with bundled assets (scripts/templates) |
18+
19+
## Quick Reference
20+
21+
Consult the reference docs for templates, domain examples, advanced frontmatter options, asset organization, anti-patterns, and creation checklists.
22+
23+
| Type | File | Location | Key Field | Reference |
24+
|------|------|----------|-----------|---------|
25+
| Workspace Instructions | `copilot-instructions.md`, `AGENTS.md` | `.github/` or root | N/A (always applies) | [Link](./primitives/workspace-instructions.md) |
26+
| File Instructions | `*.instructions.md` | `.github/instructions/` | `applyTo` (explicit), `description` (on-demand) | [Link](./primitives/instructions.md) |
27+
| Prompts | `*.prompt.md` | `.github/prompts/` | `description` (required) | [Link](./primitives/prompts.md) |
28+
| Custom Agents | `*.agent.md` | `.github/agents/` | `description` (on-demand), `infer` (subagent) | [Link](./primitives/agents.md) |
29+
| Skills | `SKILL.md` | `.github/skills/<name>/` | `description` (on-demand) | [Link](./primitives/skills.md) |
30+
31+
**User-level**: `{{USER_PROMPTS_FOLDER}}/` (*.prompt.md, *.instructions.md, *.agent.md; not skills)
32+
Customizations roam with user's settings sync
33+
34+
## Creation Process
35+
36+
If you need to explore or validate patterns in the codebase, use a read-only subagent. If the ask-questions tool is available, use it to interview the user and clarify requirements.
37+
38+
Follow these steps when creating any customization file.
39+
40+
### 1. Determine Scope
41+
42+
Ask the user where they want the customization:
43+
- **Workspace**: For project-specific, team-shared customizations → `.github/` folder
44+
- **User profile**: For personal, cross-workspace customizations → `{{USER_PROMPTS_FOLDER}}/`
45+
46+
### 2. Choose the Right Primitive
47+
48+
Use the Decision Flow above to select the appropriate file type based on the user's need.
49+
50+
### 3. Create the File
51+
52+
Create the file directly at the appropriate path:
53+
- Use the location tables in each reference file
54+
- Include required frontmatter as needed
55+
- Add the body content following the templates
56+
57+
### 4. Validate
58+
59+
After creating:
60+
- Confirm the file is in the correct location
61+
- Verify frontmatter syntax (YAML between `---` markers)
62+
- Check that `description` is present and meaningful
63+
64+
## Edge Cases
65+
66+
**Instructions vs Skill?** Does this apply to *most* work, or *specific* tasks? Most → Instructions. Specific → Skill.
67+
68+
**Skill vs Prompt?** Multi-step workflow with bundled assets → Skill. Single focused task with inputs → Prompt.
69+
70+
**Skill vs Custom Agent?** Same capabilities for all steps → Skill. Need context isolation (subagent returns single output) or different tool restrictions per stage → Custom Agent.
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# [Custom Agents (.agent.md)](https://code.visualstudio.com/docs/copilot/customization/custom-agents)
2+
3+
Custom personas with specific tools, instructions, and behaviors.
4+
5+
## Locations
6+
7+
| Path | Scope |
8+
|------|-------|
9+
| `.github/agents/*.agent.md` | Workspace |
10+
| `<profile>/agents/*.agent.md` | User profile |
11+
12+
## Frontmatter
13+
14+
```yaml
15+
---
16+
description: "<required>" # For agent picker and subagent discovery
17+
name: "Agent Name" # Optional, defaults to filename
18+
tools: ["search", "fetch"] # Optional: built-in, MCP (<server>/*), extension
19+
model: "Claude Sonnet 4" # Optional, uses picker default
20+
argument-hint: "Task..." # Optional, input guidance
21+
infer: true # Optional, enable on-demand subagent discovery (default: true)
22+
handoffs: [...] # Optional, transitions to other agents
23+
---
24+
```
25+
26+
## Tools
27+
28+
Specify tool names in the `tools` array. Sources: built-in tools, tool sets, MCP servers (`<server>/*`), or extension-contributed tools.
29+
30+
To discover available tools, search your current tool list or use the tool search capability.
31+
32+
**Special**: `[]` = no tools, omit = defaults. Body reference: `#tool:<name>`
33+
34+
### Tool Aliases
35+
36+
Common aliases for restricting agent capabilities:
37+
38+
| Alias | Purpose |
39+
|-------|---------|
40+
| `shell` | Execute shell commands |
41+
| `read` | Read file contents |
42+
| `edit` | Edit files (exact tools vary) |
43+
| `search` | Search files or text |
44+
| `custom-agent` | Invoke other custom agents as subagents |
45+
| `web` | Fetch URLs and web search |
46+
| `todo` | Create and manage task lists |
47+
48+
### Common Restriction Patterns
49+
50+
```yaml
51+
# Read-only agent (no editing, no execution)
52+
tools: ["read", "search"]
53+
54+
# MCP-only agent
55+
tools: ["myserver/*"]
56+
57+
# No terminal access
58+
tools: ["read", "edit", "search"]
59+
60+
# Planning agent (research only)
61+
tools: ["search", "web", "read"]
62+
```
63+
64+
For the full list of available tools, see the [VS Code documentation](https://code.visualstudio.com/docs/copilot/customization/custom-agents).
65+
66+
## Template
67+
68+
```markdown
69+
---
70+
description: "Generate implementation plans"
71+
tools: ["search", "fetch", "githubRepo", "usages"]
72+
---
73+
You are in planning mode. Generate plans, don't edit code. Include: Overview, Requirements, Steps, Testing.
74+
```
75+
76+
## Invocation
77+
78+
- **Manual**: Agents dropdown or `Chat: Switch Agent...` command
79+
- **On-demand (subagent)**: When `infer: true`, parent agent can delegate based on `description` match—like skills and instructions
80+
81+
## When to Use
82+
83+
**Key Signal**: Orchestrated multi-stage processes with role-based tool restrictions. Different stages need different capabilities or strict handoffs.
84+
85+
## Domain Examples
86+
87+
| Domain | Example Workflow |
88+
|--------|------------------|
89+
| Engineering | planner → implementer → reviewer → deployer |
90+
| Product | research → strategy → execution → measurement |
91+
| Analytics | scope → build → analyze → report |
92+
| Support | triage → troubleshoot → escalate → close |
93+
| Content | research → write → edit → publish |
94+
95+
## Creation Process
96+
97+
### 1. Gather Requirements
98+
99+
- What role or persona should this agent embody?
100+
- What specific tools does this role need (and which should it NOT have)?
101+
- Should this be workspace-specific or personal (user profile)?
102+
- Will this agent hand off to other agents?
103+
104+
### 2. Determine Location
105+
106+
| Scope | Path |
107+
|-------|------|
108+
| Workspace | `.github/agents/<name>.agent.md` |
109+
| User profile | `<profile>/agents/<name>.agent.md` |
110+
111+
### 3. Create the File
112+
113+
```markdown
114+
---
115+
description: "<role description for agent picker>"
116+
tools: ["<minimal tool set>"]
117+
---
118+
You are a <role>. Your responsibilities:
119+
- <primary responsibility>
120+
- <constraints on behavior>
121+
122+
<Specific instructions for this role>
123+
```
124+
125+
### 4. Configure Handoffs (optional)
126+
127+
If this agent is part of a workflow:
128+
```yaml
129+
handoffs:
130+
- agent: "next-stage-agent"
131+
condition: "When <trigger condition>"
132+
```
133+
134+
## Core Principles
135+
136+
1. **Single role per agent**: Each agent embodies one persona with focused responsibilities
137+
2. **Minimal tool set**: Only include tools required for the role—excess tools dilute focus and increase risk
138+
3. **Clear boundaries**: Define what the agent should NOT do as clearly as what it should do
139+
4. **Explicit handoffs**: When workflows span agents, define clear transition triggers
140+
5. **Discoverable via description**: The `description` field drives agent picker display—make it actionable
141+
6. **Keyword-rich for subagent discovery**: When `infer: true`, the `description` determines automatic delegation—include trigger words and use cases so the parent agent knows when to invoke this subagent
142+
143+
## Anti-patterns
144+
145+
- **Swiss-army agents**: Agents with many tools that try to do everything
146+
- **Missing constraints**: Agents without clear boundaries on what they shouldn't attempt
147+
- **Role confusion**: Description doesn't match the persona defined in the body
148+
- **Circular handoffs**: Agent A hands to B which hands back to A without progress criteria
149+
- **Tool sprawl**: Using `tools: []` to disable all tools when specific restrictions would suffice
150+
- **Vague subagent descriptions**: Generic descriptions like "A helpful agent" that don't help the parent decide when to delegate—use phrases like "use proactively after code changes" for clear triggers

0 commit comments

Comments
 (0)