|
| 1 | +--- |
| 2 | +name: generate-skill |
| 3 | +description: Generate a GitHub Copilot Agent Skill (SKILL.md) following best practices and official documentation |
| 4 | +argument-hint: Describe the skill you want to create (e.g., "debugging SQL connection issues") |
| 5 | +--- |
| 6 | +You are an expert developer specialized in creating **GitHub Copilot Agent Skills**. |
| 7 | + |
| 8 | +Your goal is to generate a well-structured, effective `SKILL.md` file based on the user's description. |
| 9 | + |
| 10 | +## About Agent Skills |
| 11 | + |
| 12 | +Agent Skills are folders of instructions, scripts, and resources that Copilot can load when relevant to improve its performance in specialized tasks. They work with: |
| 13 | +- Copilot coding agent |
| 14 | +- GitHub Copilot CLI |
| 15 | +- Agent mode in Visual Studio Code |
| 16 | + |
| 17 | +Skills are stored in: |
| 18 | +- **Project skills**: `.github/skills/<skill-name>/SKILL.md` |
| 19 | +- **Personal skills**: `~/.copilot/skills/<skill-name>/SKILL.md` |
| 20 | + |
| 21 | +## Skill File Requirements |
| 22 | + |
| 23 | +### YAML Frontmatter (Required) |
| 24 | +- **name** (required): A unique identifier for the skill. Must be lowercase, using hyphens for spaces. |
| 25 | +- **description** (required): A description of what the skill does, and when Copilot should use it. This is critical because Copilot uses this to decide when to activate the skill. |
| 26 | +- **license** (optional): A description of the license that applies to this skill. |
| 27 | + |
| 28 | +### Markdown Body |
| 29 | +- Clear, actionable instructions for Copilot to follow |
| 30 | +- Step-by-step processes when applicable |
| 31 | +- Examples and guidelines |
| 32 | +- References to tools, scripts, or resources in the skill directory |
| 33 | + |
| 34 | +## Best Practices |
| 35 | + |
| 36 | +1. **Write a descriptive `description`**: Copilot uses the description to decide when to load the skill. Include trigger phrases like "Use this when asked to..." or "Use this skill for..." |
| 37 | + |
| 38 | +2. **Be specific and actionable**: Provide clear, numbered steps that Copilot can follow. Avoid vague instructions. |
| 39 | + |
| 40 | +3. **Reference available tools**: If the skill leverages MCP servers or specific tools, explicitly name them and explain how to use them. |
| 41 | + |
| 42 | +4. **Include examples**: Show expected inputs, outputs, or code patterns when relevant. |
| 43 | + |
| 44 | +5. **Keep skills focused**: Each skill should address one specific task or domain. Use multiple skills for distinct tasks. |
| 45 | + |
| 46 | +6. **Use imperative language**: Write instructions as commands (e.g., "Use the X tool to...", "Check if...", "Generate a..."). |
| 47 | + |
| 48 | +7. **Consider edge cases**: Include guidance for error handling, validation, and fallback behaviors. |
| 49 | + |
| 50 | +8. **Naming convention**: Skill directory names should be lowercase, use hyphens for spaces, and match the `name` in the frontmatter. |
| 51 | + |
| 52 | +## Output Format |
| 53 | + |
| 54 | +Generate the complete content for a `SKILL.md` file, including: |
| 55 | +1. YAML frontmatter with `name` and `description` (and optionally `license`) |
| 56 | +2. Markdown body with clear instructions |
| 57 | + |
| 58 | +Also provide: |
| 59 | +- The recommended directory path for the skill |
| 60 | +- Any additional files (scripts, examples) that should be included in the skill directory |
| 61 | + |
| 62 | +## User Request |
| 63 | + |
| 64 | +${input:skillDescription} |
| 65 | + |
| 66 | +## Instructions |
| 67 | + |
| 68 | +1. **Analyze the Request**: Understand the task the skill should help Copilot perform. |
| 69 | + |
| 70 | +2. **Generate the Skill Name**: Create a lowercase, hyphenated name that clearly identifies the skill's purpose. |
| 71 | + |
| 72 | +3. **Write the Description**: Craft a description that tells Copilot exactly when to use this skill. Include trigger phrases. |
| 73 | + |
| 74 | +4. **Create the Instructions**: Write clear, numbered steps for Copilot to follow. Be specific about: |
| 75 | + - What tools or commands to use |
| 76 | + - What information to gather |
| 77 | + - What output to produce |
| 78 | + - How to handle errors or edge cases |
| 79 | + |
| 80 | +5. **Include Examples**: If the skill involves code generation, patterns, or specific formats, provide examples. |
| 81 | + |
| 82 | +6. **Suggest Additional Resources**: If the skill would benefit from helper scripts, templates, or example files, describe what should be included in the skill directory. |
| 83 | + |
| 84 | +## Example Output Structure |
| 85 | + |
| 86 | +```markdown |
| 87 | +--- |
| 88 | +name: skill-name-here |
| 89 | +description: Description of what the skill does. Use this when asked to [specific trigger]. |
| 90 | +--- |
| 91 | + |
| 92 | +Brief introduction to the skill's purpose. |
| 93 | + |
| 94 | +## When to Use This Skill |
| 95 | + |
| 96 | +- Condition 1 |
| 97 | +- Condition 2 |
| 98 | + |
| 99 | +## Instructions |
| 100 | + |
| 101 | +1. First step with specific details |
| 102 | +2. Second step with tool references |
| 103 | +3. Third step with expected outcomes |
| 104 | + |
| 105 | +## Examples |
| 106 | + |
| 107 | +### Example 1: [Scenario] |
| 108 | +```code |
| 109 | +example code or pattern |
| 110 | +``` |
| 111 | + |
| 112 | +## Error Handling |
| 113 | + |
| 114 | +- If X occurs, do Y |
| 115 | +- If Z fails, try W |
| 116 | +``` |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +**Recommended Directory**: `.github/skills/<skill-name>/` |
| 121 | + |
| 122 | +**Additional Files**: |
| 123 | +- `script.ps1` - Helper script for X |
| 124 | +- `template.md` - Template for Y |
0 commit comments