How to Write SKILL.md Files
Master the art of writing effective SKILL.md files for Gemini with best practices for structure, prompting, and defining clear skill behaviors.
- 1
Start with a Clear Title and Description
Begin your SKILL.md with a level-1 heading that names the skill, followed by a brief description of what it does. This helps both users and the AI understand the skill's purpose.
- 2
Define the Trigger Section
Add a '## Trigger' section specifying how the skill is invoked. Use command triggers (/command-name) for explicit invocation or context triggers for automatic activation.
- 3
Write Detailed Instructions
In the '## Instructions' section, provide clear, specific instructions for the AI. Use imperative language and be explicit about expected behavior, output format, and constraints.
- 4
Include Examples
Add a '## Examples' section with input/output pairs. This grounds the skill's behavior and helps the AI understand edge cases and expected formatting.
- 5
Add Context Requirements
Specify what files or context the skill needs access to in a '## Context' section. This ensures the AI has the right information when executing the skill.
- 6
Test and Iterate
Run your skill multiple times with varied inputs. Refine the instructions based on outputs, adding clarifications where the AI deviates from expected behavior.