Skills (slash commands) let you package reusable prompts that standardize how AI agents approach recurring tasks. Instead of retyping the same detailed instructions every time, you define them once and invoke them with a command.
A skill is a markdown file containing a prompt that gets injected into the AI agent's context when invoked. Think of skills like reusable prompt templates - they guide the agent's behavior for a specific task without needing access to external systems (unlike MCP servers).
---name: security-reviewdescription: Review code for security, performance, and standards compliance---Review the code changes in the current diff for:- Security vulnerabilities (injection, auth issues, data exposure)- Performance problems (N+1 queries, unnecessary allocations)- Adherence to our team's coding standardsFor each issue found:1. Reference the specific file and line number2. Explain why it's a problem3. Suggest a concrete fix
✅ Figure: Good example - A SKILL.md file with YAML frontmatter (between --- markers) and markdown instructions
To invoke this skill, type /security-review in Claude Code, @security-review in GitHub Copilot, or simply ask a question that matches the skill's description and the agent will load it automatically.
For connecting to external systems like databases or APIs, use MCP servers instead.
You don't always need to write skills from scratch. Trusted providers like Anthropic publish pre-built skills you can install. For example, Anthropic's official skills repository includes document skills, creative design skills, and development utilities. In Claude Code, you can install them via the plugin system:
/plugin marketplace add anthropics/skills/plugin install document-skills@anthropic-agent-skills
Consider creating a skill when:
User: Review this code for security vulnerabilities, performance issues, adherence to our team's coding standards, and test coverage gaps. Provide actionable feedback with specific line references.
Agent: ✅ Code review complete.
(1 day later)
User: Review this code for security vulnerabilities, performance issues, adherence to our team's coding standards, and test coverage gaps. Provide actionable feedback with specific line references.
Agent: ✅ Code review complete.
❌ Figure: Bad example - Repeating the same detailed review prompt every time is tedious and error-prone
User: /security-review
Agent: ✅ Code review complete.
✅ Figure: Good example - A skill encapsulates the review instructions - one command, consistent results every time
Skills are prompt injections by design - they instruct the AI to behave in a specific way. A malicious skill could instruct the agent to run destructive commands, exfiltrate data, or bypass safety checks.
Create a SKILL.md file inside a named directory under .claude/skills/:
.claude/└── skills/├── security-review/│ └── SKILL.md → invoked with /security-review├── commit/│ └── SKILL.md → invoked with /commit└── plan/└── SKILL.md → invoked with /plan
You can also create personal skills at ~/.claude/skills/ that are available across all projects.
Create markdown files in your project's .github/copilot/ directory to define custom agents:
.github/└── copilot/├── review.md → invoked with @security-review└── plan.md → invoked with @plan
Create a SKILL.md file inside a named directory under .opencode/skills/ (OpenCode also discovers skills from .claude/skills/):
.opencode/└── skills/├── security-review/│ └── SKILL.md → invoked as a slash command or loaded by the agent└── plan/└── SKILL.md
You can also create personal skills at ~/.config/opencode/skills/ that are available across all projects.
A good skill is specific about what the agent should do, how it should structure its output, and what it should avoid.
Review the code and give feedback.
❌ Figure: Bad example - Too vague - the agent has no guidance on what to check or how to structure its response
---name: code-reviewdescription: Review code for security, performance, standards, and test coverageallowed-tools: Read, Grep, Glob---Review the code changes in the current diff for:- Security vulnerabilities (injection, auth issues, data exposure)- Performance problems (N+1 queries, unnecessary allocations, missing indexes)- Adherence to our team's coding standards (which can be found in STANDARDS.md)- Test coverage gapsFor each issue found:1. Reference the specific file and line number2. Explain why it's a problem3. Suggest a concrete fixIf no issues are found in a category, skip it — do notlist categories with "no issues found."
✅ Figure: Good example - Specific checks, clear output format, and explicit instructions on what to skip
Tips for writing skills:
$ARGUMENTS or similar placeholders so users can pass context when invoking the skillSkills support optional YAML frontmatter fields that control their behavior:
| Property | Description |
name | Display name for the skill (defaults to the directory name) |
description | What the skill does - the agent uses this to decide when to load the skill automatically |
allowed-tools | Restricts which tools the agent can use (e.g. Read, Grep, Glob for a read-only skill) |
disable-model-invocation | Set to true to prevent the agent from loading the skill automatically (manual-only) |
user-invocable | Set to false to hide from the / menu (agent-only background knowledge) |
context | Set to fork to run the skill in an isolated subagent |
argument-hint | Hint shown during autocomplete (e.g. [issue-number]) |
Where you store a skill determines who can use it:
| Scope | Location | Applies to |
| Personal | ~/.claude/skills/ or ~/.config/opencode/skills/ | Across all projects, only your machine |
| Project | .claude/skills/ committed to the repository | Project-scoped, everyone with access to the repository |
Personal skills are great for your own preferences and workflows (e.g. your preferred commit message format). Project skills are committed to version control so the whole team benefits. When a personal and project skill share the same name, project-level skills take precedence.
Project-level skills (committed to the repo) are one of the most effective ways to standardize workflows across a team:
/code-review for a code review" or "Use /deploy to deploy to staging")