Skip to content

Commit bce4de0

Browse files
patnikoCopilot
andauthored
docs: fix inaccuracies in skills.md (#556)
Replace fabricated skill.json references with actual SKILL.md format used by the SDK. The previous doc described a skill.json manifest, prompts/ directory, and tools/ directory that don't exist in the implementation. Changes: - Replace skill.json with SKILL.md format (YAML frontmatter + markdown) - Fix directory structure to match actual layout (skill-name/SKILL.md) - Add onPermissionRequest to all code examples (required by SDK) - Remove fabricated prompts/ and tools/ directory concepts - Fix troubleshooting and best practices to reference SKILL.md - Remove speculative skill conflict precedence claims Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 279f6c4 commit bce4de0

File tree

1 file changed

+35
-40
lines changed

1 file changed

+35
-40
lines changed

docs/guides/skills.md

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Custom Skills
22

3-
Skills are reusable collections of prompts, tools, and configuration that extend Copilot's capabilities. Load skills from directories to give Copilot specialized abilities for specific domains or workflows.
3+
Skills are reusable prompt modules that extend Copilot's capabilities. Load skills from directories to give Copilot specialized abilities for specific domains or workflows.
44

55
## Overview
66

7-
A skill is a directory containing:
8-
- **Prompt files** - Instructions that guide Copilot's behavior
9-
- **Tool definitions** - Custom tools the skill provides
10-
- **Configuration** - Metadata about the skill
7+
A skill is a named directory containing a `SKILL.md` file — a markdown document that provides instructions to Copilot. When loaded, the skill's content is injected into the session context.
118

129
Skills allow you to:
1310
- Package domain expertise into reusable modules
@@ -31,8 +28,8 @@ const session = await client.createSession({
3128
skillDirectories: [
3229
"./skills/code-review",
3330
"./skills/documentation",
34-
"~/.copilot/skills", // User-level skills
3531
],
32+
onPermissionRequest: async () => ({ kind: "approved" }),
3633
});
3734

3835
// Copilot now has access to skills in those directories
@@ -56,8 +53,8 @@ async def main():
5653
"skill_directories": [
5754
"./skills/code-review",
5855
"./skills/documentation",
59-
"~/.copilot/skills", # User-level skills
6056
],
57+
"on_permission_request": lambda req: {"kind": "approved"},
6158
})
6259

6360
# Copilot now has access to skills in those directories
@@ -93,7 +90,9 @@ func main() {
9390
SkillDirectories: []string{
9491
"./skills/code-review",
9592
"./skills/documentation",
96-
"~/.copilot/skills", // User-level skills
93+
},
94+
OnPermissionRequest: func(req copilot.PermissionRequest, inv copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
95+
return copilot.PermissionRequestResult{Kind: "approved"}, nil
9796
},
9897
})
9998
if err != nil {
@@ -126,8 +125,9 @@ await using var session = await client.CreateSessionAsync(new SessionConfig
126125
{
127126
"./skills/code-review",
128127
"./skills/documentation",
129-
"~/.copilot/skills", // User-level skills
130128
},
129+
OnPermissionRequest = (req, inv) =>
130+
Task.FromResult(new PermissionRequestResult { Kind = "approved" }),
131131
});
132132

133133
// Copilot now has access to skills in those directories
@@ -196,41 +196,28 @@ var session = await client.CreateSessionAsync(new SessionConfig
196196

197197
## Skill Directory Structure
198198

199-
A typical skill directory contains:
199+
Each skill is a named subdirectory containing a `SKILL.md` file:
200200

201201
```
202202
skills/
203-
└── code-review/
204-
├── skill.json # Skill metadata and configuration
205-
├── prompts/
206-
│ ├── system.md # System prompt additions
207-
│ └── examples.md # Few-shot examples
208-
└── tools/
209-
└── lint.json # Tool definitions
203+
├── code-review/
204+
│ └── SKILL.md
205+
└── documentation/
206+
└── SKILL.md
210207
```
211208

212-
### skill.json
213-
214-
The skill manifest file:
209+
The `skillDirectories` option points to the parent directory (e.g., `./skills`). The CLI discovers all `SKILL.md` files in immediate subdirectories.
215210

216-
```json
217-
{
218-
"name": "code-review",
219-
"displayName": "Code Review Assistant",
220-
"description": "Specialized code review capabilities",
221-
"version": "1.0.0",
222-
"author": "Your Team",
223-
"prompts": ["prompts/system.md"],
224-
"tools": ["tools/lint.json"]
225-
}
226-
```
211+
### SKILL.md Format
227212

228-
### Prompt Files
229-
230-
Markdown files that provide context to Copilot:
213+
A `SKILL.md` file is a markdown document with optional YAML frontmatter:
231214

232215
```markdown
233-
<!-- prompts/system.md -->
216+
---
217+
name: code-review
218+
description: Specialized code review capabilities
219+
---
220+
234221
# Code Review Guidelines
235222

236223
When reviewing code, always check for:
@@ -243,6 +230,12 @@ When reviewing code, always check for:
243230
Provide specific line-number references and suggested fixes.
244231
```
245232

233+
The frontmatter fields:
234+
- **`name`** — The skill's identifier (used with `disabledSkills` to selectively disable it). If omitted, the directory name is used.
235+
- **`description`** — A short description of what the skill does.
236+
237+
The markdown body contains the instructions that are injected into the session context when the skill is loaded.
238+
246239
## Configuration Options
247240

248241
### SessionConfig Skill Fields
@@ -262,7 +255,7 @@ Provide specific line-number references and suggested fixes.
262255

263256
1. **Organize by domain** - Group related skills together (e.g., `skills/security/`, `skills/testing/`)
264257

265-
2. **Version your skills** - Include version numbers in `skill.json` for compatibility tracking
258+
2. **Use frontmatter** - Include `name` and `description` in YAML frontmatter for clarity
266259

267260
3. **Document dependencies** - Note any tools or MCP servers a skill requires
268261

@@ -284,6 +277,7 @@ const session = await client.createSession({
284277
description: "Security-focused code reviewer",
285278
prompt: "Focus on OWASP Top 10 vulnerabilities",
286279
}],
280+
onPermissionRequest: async () => ({ kind: "approved" }),
287281
});
288282
```
289283

@@ -302,23 +296,24 @@ const session = await client.createSession({
302296
tools: ["*"],
303297
},
304298
},
299+
onPermissionRequest: async () => ({ kind: "approved" }),
305300
});
306301
```
307302

308303
## Troubleshooting
309304

310305
### Skills Not Loading
311306

312-
1. **Check path exists** - Verify the directory path is correct
307+
1. **Check path exists** - Verify the skill directory path is correct and contains subdirectories with `SKILL.md` files
313308
2. **Check permissions** - Ensure the SDK can read the directory
314-
3. **Validate skill.json** - Check for JSON syntax errors
309+
3. **Check SKILL.md format** - Verify the markdown is well-formed and any YAML frontmatter uses valid syntax
315310
4. **Enable debug logging** - Set `logLevel: "debug"` to see skill loading logs
316311

317312
### Skill Conflicts
318313

319-
If multiple skills define the same tool:
320-
- Later directories in the array take precedence
314+
If multiple skills provide conflicting instructions:
321315
- Use `disabledSkills` to exclude conflicting skills
316+
- Reorganize skill directories to avoid overlaps
322317

323318
## See Also
324319

0 commit comments

Comments
 (0)