This skill provides guidance for creating effective skills.
Skills are modular, self-contained packages that extend agent capabilities by providing specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific domains or tasks.
The context window is a public good. Skills share the context window with everything else the agent needs.
Default assumption: The agent is already very smart. Only add context it doesn't already have.
text
skill-name/
├── SKILL.md (required)
│ ├── YAML frontmatter (name, description)
│ └── Markdown instructions
├── scripts/ - Executable code
├── references/ - Documentation to load as needed
└── assets/ - Files used in output
Understand concrete examples of how the skill will be used. Ask:
Analyze each example to identify:
Run the init script:
bash
scripts/init_skill.py <skill-name> --path <output-directory> [--resources scripts,references,assets]
yaml
---
name: skill-name
description: Clear description of what the skill does AND when to trigger it. Include specific contexts, use cases, and examples. This is the PRIMARY triggering mechanism - put all "when to use" info here, not in the body.
---
Description is for the model: When the agent starts a session, it scans all skill descriptions to decide "is there a skill for this request?" So the description must clearly state:
Keep under 500 lines. Use references/ for detailed content.
bash
scripts/package_skill.py <path/to/skill-folder>
The highest-signal content in any skill is a Gotchas section. Build this from common failure points the agent runs into.
markdown
## Gotchas
- **File encoding**: Always use UTF-8, otherwise parsing fails
- **Large files**: Split files over 10MB before processing
- **API rate limits**: Add 1-second delay between requests
Best practice: Update gotchas over time as you encounter new failure points.
Skills can include memory by storing data within them:
markdown
## Memory
This skill stores data in `~/.my-skill/data.json`. On each run, the agent reads this file to understand previous context.
Storage options:
Important: Store data in a stable location outside the skill directory. Use ${CLAUDE_PLUGIN_DATA} if available - data in the skill directory may be deleted on upgrades.
Skills can include hooks that are only activated when called:
markdown
## Hooks
When activated, this skill registers:
- `/careful`: Blocks dangerous operations (rm -rf, DROP TABLE)
- `/freeze`: Only allows edits in specific directories
Use these for opinionated behaviors you don't want always on, but are extremely useful sometimes.
For skills requiring user-specific context, store configuration in a config file:
markdown
## Setup
This skill requires configuration in `config.json`:
- `api_key`: Your API key
- `channel`: Slack channel for notifications
If config is missing, ask the user for required fields.
For skills that need verification, include test patterns:
markdown
## Verification
After execution, verify the output:
1. Check file exists: `ls -la output/`
2. Run validation script: `scripts/validate.py output/file.json`
3. Take a screenshot for visual confirmation
Consider techniques:
For small teams, check skills into the repo (e.g., ./skills/ or ./.claude/skills).
For larger teams, create an internal marketplace where users can install skills. Document how to submit and review skills.
Track skill usage with a PreToolUse hook:
python
# Log when skill is triggered
@hook("PreToolUse")
def log_skill_usage(agent, tool_name, input):
if tool_name == "Skill":
log(f"Skill used: {input['skill_name']}")
return input
This helps identify:
markdown
# PDF Processing
## Quick Start
[basic example]
## Advanced Features
- **Form filling**: See [references/forms.md](forms.md)
- **API reference**: See [references/api.md](api.md)
text
bigquery-skill/
├── SKILL.md
└── references/
├── finance.md
├── sales.md
└── product.md
markdown
## Editing Documents
For simple edits, modify XML directly.
**For tracked changes**: See [references/redlining.md](redlining.md)
PatternWhen to Usescripts/Deterministic code, repeatedly rewrittenreferences/Documentation, schemas, examplesassets/Templates, images, output filesgotchasCommon failure pointshooksConditional behaviorsmemoryPersistent context across runsconfig.jsonUser-specific settings
Tip: Most skills begin as a few lines and a single gotcha. They get better because people keep adding to them as the agent hits new edge cases.