Guide for creating effective Agent Skills. Use when users want to create a new skill (or update an existing skill) that extends an AI agent's capabilities with specialized knowledge, workflows, or tool integrations. Covers skill structure, YAML frontmatter, trigger configuration, and the 500-line rule.
72
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
This skill provides guidance for creating effective skills following the Agent Skills specification.
Skills are modular, self-contained packages that extend AI agent capabilities by providing specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific domains or tasks—they transform a general-purpose agent into a specialized agent equipped with procedural knowledge that no model can fully possess.
The context window is a public good. Skills share the context window with everything else the agent needs: system prompt, conversation history, other skills' metadata, and the actual user request.
Default assumption: The agent is already very smart. Only add context it doesn't already have. Challenge each piece of information: "Does the agent really need this explanation?" and "Does this paragraph justify its token cost?"
Prefer concise examples over verbose explanations.
Match the level of specificity to the task's fragility and variability:
High freedom (text-based instructions): Use when multiple approaches are valid, decisions depend on context, or heuristics guide the approach.
Medium freedom (pseudocode or scripts with parameters): Use when a preferred pattern exists, some variation is acceptable, or configuration affects behavior.
Low freedom (specific scripts, few parameters): Use when operations are fragile and error-prone, consistency is critical, or a specific sequence must be followed.
Every skill consists of a required SKILL.md file and optional bundled resources:
skill-name/
├── SKILL.md (required)
│ ├── YAML frontmatter metadata (required)
│ │ ├── name: (required)
│ │ ├── description: (required)
│ │ └── metadata.triggers: (optional, for auto-activation)
│ └── Markdown instructions (required)
└── Bundled Resources (optional)
├── scripts/ - Executable code (Python/Bash/etc.)
├── references/ - Documentation intended to be loaded into context as needed
└── assets/ - Files used in output (templates, icons, fonts, etc.)Every SKILL.md must have YAML frontmatter with required and optional fields:
| Field | Required | Description |
|---|---|---|
name | Yes | Max 64 chars. Lowercase letters, numbers, hyphens only. Must match directory name. |
description | Yes | Max 1024 chars. Describes what the skill does and when to use it. |
license | No | License name or reference to a bundled license file. |
compatibility | No | Max 500 chars. Environment requirements (intended product, system packages, etc.). |
metadata | No | Arbitrary key-value mapping for additional metadata. |
allowed-tools | No | Space-delimited list of pre-approved tools. (Experimental) |
Skills can define auto-activation triggers in the metadata.triggers field:
metadata:
triggers:
type: domain # "domain" (advisory) or "guardrail" (enforced)
enforcement: suggest # "suggest", "warn", or "block"
priority: high # "critical", "high", "medium", or "low"
keywords: # Exact substring matches (case-insensitive)
- error
- Result
- error-stack
intent-patterns: # Regex patterns for intent detection
- "\\b(handle|create)\\b.*?\\berror\\b"
- "\\berror\\b.*?\\bhandling\\b"
files: # Optional: file-based triggers
include:
- "**/src/**/*.rs"
exclude:
- "**/*.test.rs"
content:
- "use error_stack"Trigger Types:
\\b for word boundaries, .*? for non-greedy matching)Enforcement Levels:
scripts/)Executable code (Python/Bash/etc.) for tasks that require deterministic reliability or are repeatedly rewritten.
scripts/rotate_pdf.py for PDF rotation tasksreferences/)Documentation and reference material intended to be loaded as needed into context.
references/finance.md for financial schemas, references/api_docs.md for API specificationsassets/)Files not intended to be loaded into context, but rather used within the output.
assets/logo.png for brand assets, assets/template.pptx for templatesSkills use a three-level loading system to manage context efficiently:
Keep SKILL.md body under 500 lines. Split content into separate files when approaching this limit.
Pattern: High-level guide with references
# PDF Processing
## Quick start
Extract text with pdfplumber: [code example]
## Advanced features
- **Form filling**: See [FORMS.md](references/FORMS.md) for complete guide
- **API reference**: See [REFERENCE.md](references/REFERENCE.md) for all methodsPattern: Domain-specific organization
bigquery-skill/
├── SKILL.md (overview and navigation)
└── references/
├── finance.md (revenue, billing metrics)
├── sales.md (opportunities, pipeline)
└── product.md (API usage, features)To create an effective skill, clearly understand concrete examples of how the skill will be used:
Analyze each example to identify what scripts, references, and assets would be helpful:
scripts/rotate_pdf.py)assets/hello-world/ for frontend projects)references/schema.md)When creating a new skill from scratch, run the init command:
yarn agents:skill-management init <skill-name>The command creates the skill directory in .claude/skills/ with a SKILL.md template and example resource directories.
---
name: my-skill
description: What the skill does and when to use it. Include trigger keywords.
license: Apache-2.0
metadata:
triggers:
type: domain
enforcement: suggest
priority: medium
keywords:
- keyword1
- keyword2
intent-patterns:
- "\\b(create|add)\\b.*?\\bsomething\\b"
---Description best practices:
Write instructions for using the skill. Keep under 500 lines.
After creating/modifying skills, validate and regenerate the skill-rules.json:
yarn agents:skill-management validate
yarn agents:skill-management generate-skill-rulesTest with a specific prompt:
echo '{"session_id":"test","prompt":"your test prompt","cwd":"."}' | \
yarn workspace @local/claude-hooks run:skillDebug matching logic:
echo '{"session_id":"test","prompt":"your test prompt","cwd":"."}' | \
yarn workspace @local/claude-hooks dev:skillFor detailed information on specific topics, see:
.claude/skills/{name}/SKILL.mdmetadata.triggers4f2d2ce
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.