docs/cli/creating-skills.md
Agent Skills let you extend Gemini CLI with specialized expertise, procedural workflows, and task-specific resources. This guide walks you through both automated and manual methods for creating and organizing your skills.
The fastest way to create a new skill is to use the built-in skill-creator.
This meta-skill guides you through designing, scaffolding, and validating your
expertise.
Simply ask Gemini CLI to create a skill for you:
"Create a new skill called 'code-reviewer' that analyzes local files for common errors and style violations."
Gemini will then:
my-new-skill/).SKILL.md file with the necessary YAML frontmatter (name and
description).scripts/, references/, and
assets/.Once created, you can find your new skill in .gemini/skills/code-reviewer/.
my-new-skill/).SKILL.md file inside the new directory.The first step is to create the necessary folders for your skill and its scripts.
macOS/Linux
mkdir -p .gemini/skills/code-reviewer/scripts
Windows (PowerShell)
New-Item -ItemType Directory -Force -Path ".gemini\skills\code-reviewer\scripts"
SKILL.md)The SKILL.md file defines the skill's purpose and instructions for the agent.
Create a file at .gemini/skills/code-reviewer/SKILL.md.
---
name: code-reviewer
description:
Expertise in reviewing code changes for correctness, security, and style. Use
when the user asks to "review" their code or a PR.
---
# Code Reviewer Instructions
You act as a senior software engineer specialized in code quality. When this
skill is active, you MUST:
1. **Analyze**: Review the provided code for logical errors, security
vulnerabilities, and style violations.
2. **Review**: Use the bundled `scripts/review.js` utility to perform an
automated check.
3. **Feedback**: Provide constructive feedback, clearly distinguishing between
critical issues and minor improvements.
Skills can bundle resources like scripts to perform deterministic tasks. Create
a file at .gemini/skills/code-reviewer/scripts/review.js.
// .gemini/skills/code-reviewer/scripts/review.js
const file = process.argv[2];
if (!file) {
console.error('Usage: node review.js <file>');
process.exit(1);
}
console.log(`Reviewing ${file}...`);
// Simple mock review logic
setTimeout(() => {
console.log(`Result: Success (No major issues found in ${file})`);
}, 500);
Gemini CLI automatically discovers skills in the .gemini/skills directory.
code-reviewer description and
asks for permission to activate it.node .gemini/skills/code-reviewer/scripts/review.js index.jsTo determine whether your skill has been correctly loaded, run the command:
/skills
You can share your skills in several ways depending on your target audience.
.gemini/skills/ directory in
your project repository.gemini skills install <url>.Now that you've built your first skill, let's explore the core components and workflows for developing more complex expertise.
While a SKILL.md file is the only required component, we recommend the
following structure for organizing your skill's resources.
my-skill/
├── SKILL.md (Required) Instructions and metadata
├── scripts/ (Optional) Executable scripts
├── references/ (Optional) Static documentation
└── assets/ (Optional) Templates and other resources
When a skill is activated, the model is granted access to this entire directory. You can instruct the model to use the tools and files found within these folders.
The SKILL.md file uses YAML frontmatter for metadata.
name: A unique identifier for the skill. This should match the directory
name.description: CRITICAL. This is how Gemini decides when to use the
skill. Be specific about the tasks it handles and the keywords that should
trigger it.Gemini CLI discovers skills from several locations, following a specific order of precedence (lowest to highest):
~/.gemini/skills/ or the ~/.agents/skills/ alias..gemini/skills/ or the .agents/skills/ alias.You can use .agents/skills as an alternative to .gemini/skills. This alias
is compatible with other AI agent tools following the
Agent Skills standard.
Once you've built a basic skill, you can use specialized scripts and workflows to streamline your development process.
If you are developing a skill and want to use the same scripts the built-in tools use, you can find them in the core package. These scripts help automate the initialization, validation, and packaging of skills.
node scripts/init_skill.cjs <name> --path <dir>node scripts/validate_skill.cjs <path/to/skill>node scripts/package_skill.cjs <path/to/skill> (Creates a
.skill zip file)If you are developing a skill in a separate directory, you can link it to your user skills directory for testing:
gemini skills link .