You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: data/reusables/copilot/creating-adding-skills.md
+37-2Lines changed: 37 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,9 @@ To add a skill, you save the `SKILL.md` file, and any subsidiary resources, to a
27
27
***license** (optional): A description of the license that applies to this skill.
28
28
* A Markdown body, with the instructions, examples and guidelines for {% data variables.product.prodname_copilot_short %} to follow.
29
29
30
-
1. Optionally, add scripts, examples or other resources to your skill's directory.
30
+
1. Optionally, add scripts, examples or other resources to your skill's directory.
31
31
32
-
For example, if you were writing a skill for converting images between different formats, you might include a script for converting SVG images to PNG. The skill instructions should tell {% data variables.product.prodname_copilot_short %} when, and how, to use these resources.
32
+
For more information, see "[Enabling a skill to run a script](#enabling-a-skill-to-run-a-script)."
33
33
34
34
### Example `SKILL.md` file
35
35
@@ -51,3 +51,38 @@ To debug failing {% data variables.product.prodname_actions %} workflows in a pu
51
51
4. Try to reproduce the failure yourself in your own environment.
52
52
5. Fix the failing build. If you were able to reproduce the failure yourself, make sure it is fixed before committing your changes.
53
53
```
54
+
55
+
### Enabling a skill to run a script
56
+
57
+
When a skill is invoked, {% data variables.product.prodname_copilot_short %} automatically discovers all of the files in the skill's directory and makes them available alongside the skill's instructions. This means you can include scripts or other resources in the skill directory and reference them in your `SKILL.md` instructions.
58
+
59
+
To create a skill that runs a script:
60
+
61
+
1.**Add the script to your skill's directory.** For example, a skill for converting SVG images to PNG might have the following structure.
62
+
63
+
```text
64
+
.github/skills/image-convert/
65
+
├── SKILL.md
66
+
└── convert-svg-to-png.sh
67
+
```
68
+
69
+
1.**Optionally pre-approve the tools the skill needs.** In your `SKILL.md` frontmatter, you can use the `allowed-tools` field to list the tools {% data variables.product.prodname_copilot_short %} may use without asking for confirmation each time. If a tool is not listed in the `allowed-tools` field, {% data variables.product.prodname_copilot_short %} will prompt you for permission before using it.
70
+
71
+
```markdown
72
+
---
73
+
name: image-convert
74
+
description: Converts SVG images to PNG format. Use when asked to convert SVG files.
75
+
allowed-tools: shell
76
+
---
77
+
```
78
+
79
+
> [!WARNING]
80
+
> Only pre-approve the `shell` or `bash` tools if you have reviewed this skill and any referenced scripts, and you fully trust their source. Pre-approving `shell` or `bash` removes the confirmation step for running terminal commands and can allow attacker-controlled skills or prompt injections to execute arbitrary commands in your environment. When in doubt, omit `shell` and `bash` from `allowed-tools` so that {% data variables.product.prodname_copilot_short %} must ask for your explicit confirmation before running terminal commands.
81
+
82
+
1.**Write instructions that tell {% data variables.product.prodname_copilot_short %} how to use the script.** In the Markdown body of `SKILL.md`, describe when and how to run the script.
83
+
84
+
```markdown
85
+
When asked to convert an SVG to PNG, run the `convert-svg-to-png.sh` script
86
+
from this skill's base directory, passing the input SVG file path as the
0 commit comments