Buckets:

HuggingFaceDocBuilder's picture
|
download
raw
5.98 kB
# Using Skills with Code Agents
The Agent Skills Specification keeps the SKILL.md format consistent across agents. What differs is where each agent looks for skills on disk and how you install them.
## Where Skills Live
Each agent discovers skills from known directories. You create a skill by placing a `SKILL.md` file in a named subdirectory at one of these paths:
| Scope | Path | Applies to |
|-------|------|------------|
| Personal | `~/.claude/skills//SKILL.md` | All your projects |
| Project | `.claude/skills//SKILL.md` | This project only |
Claude Code also watches for changes — adding, editing, or removing a skill takes effect within the current session without restarting.
| Scope | Path |
|-------|------|
| Repository | `.agents/skills//SKILL.md` |
| User | `~/.agents/skills//SKILL.md` |
| Admin | `/etc/codex/skills//SKILL.md` |
Codex discovers skills from all three locations; when the same skill name appears in more than one, the repository copy is used first, then the user copy, then the admin copy.
**Project-local paths:**
- `.opencode/skills//SKILL.md`
- `.claude/skills//SKILL.md`
- `.agents/skills//SKILL.md`
**Global paths:**
- `~/.config/opencode/skills//SKILL.md`
- `~/.claude/skills//SKILL.md`
- `~/.agents/skills//SKILL.md`
OpenCode walks up from the current working directory to the git root, checking each level.
## Installing a Skill
We'll use the [hf-cli](https://github.com/huggingface/skills) skill as a real-world example. It gives agents access to the Hugging Face Hub CLI for downloading, uploading, and managing repositories.
The Hugging Face CLI also provides a cross-agent skill installer. Use it when you want the same skill in more than one agent or want a shared install flow:
```bash
# Project-local install
hf skills add
# Agent-specific symlinks
hf skills add --claude
hf skills add --codex --opencode --global
```
Skills are distributed as plugins via marketplaces. Inside a Claude Code session, add a marketplace, then install the plugin that contains the skill:
```text
/plugin marketplace add huggingface/skills
/plugin install hf-cli@huggingface-skills
```
Use `/plugin` to browse, enable, and disable installed plugins. Plugin skills are namespaced as `/:` (for example, `/hf-cli:download-model`) to prevent conflicts.
Use the built-in skill installer for curated skills:
```text
$skill-installer hf-cli
```
Or, you can install the entire Hugging Face plugin:
```text
/plugins
```
Then select 'Hugging Face' and click 'Install'.
Create the skill directory in any supported location and add a `SKILL.md` file:
```bash
hf skills add
```
This will create the skill directory and add the `SKILL.md` file in `.agents/skills/hf-cli/SKILL.md`.
OpenCode discovers it automatically.
You can control which skills agents may use via `opencode.json`:
```json
{
"permission": {
"skill": {
"*": "allow",
"experimental-*": "ask"
}
}
}
```
## Invoking Skills
Once installed, skills activate in two ways: implicitly (the agent matches your request to a skill's description) or explicitly (you invoke a skill by name).
```text
# Implicit — Claude matches your request to the skill description
Download the latest version of meta-llama/Llama-4-Scout-17B-16E
# Explicit — invoke a plugin skill by its namespaced name
/hf-cli:download-model
```
```bash
# Implicit — Codex selects based on task matching
codex "Upload my model to the Hub"
# Explicit — mention by name
$hf-cli
```
Agents invoke skills via the native `skill` tool by passing the skill name. OpenCode matches tasks to skills automatically based on the description in frontmatter.
## Troubleshooting Skills
### Skill Doesn't Activate
**Problem**: Skill is installed but the agent doesn't use it.
Check that the `description` field includes keywords matching your request, use terms that align with the skill's stated purpose, or invoke the skill explicitly by name. A description like "Hugging Face Hub CLI for downloading, uploading, and managing repositories" activates on requests mentioning "upload," "download," or "Hugging Face," but a vague request like "push my files somewhere" may not match.
## Did Your Skill Fire?
The fastest way to debug a new skill is to test activation pressure directly:
1. Ask for the skill with an obvious prompt that should match its description.
2. Ask again with a vaguer prompt that a real user might write.
3. If only the first prompt works, tighten the `description` until both prompts reliably activate the skill.
For Codex, this is exactly where `$skill-creator` helps. Feed it the skill, the prompt that failed to activate, and the behavior you wanted so it can sharpen the description without rewriting the whole skill.
### Skill Not Found
**Problem**: Agent can't locate the skill.
Verify the skill is in the correct directory for your agent:
```bash
ls .claude/skills/hf-cli/SKILL.md
```
Or check installed plugins inside a Claude Code session with:
```text
/plugin
```
```bash
ls .agents/skills/hf-cli/SKILL.md
```
```bash
ls .opencode/skills/hf-cli/SKILL.md
```
### Skill Conflicts
**Problem**: Multiple skills have overlapping functionality.
Make each skill's `description` field specific enough that the agent can distinguish between them. If two skills cover related tasks (e.g., validation and publishing), give each a clear scope in its description.
## Best Practices
Organize skills by domain — keep related skills together so agents can discover related functionality easily:
```bash
.claude/skills/
├── hf-cli/
│ └── SKILL.md
├── dataset-validation/
│ └── SKILL.md
├── model-training/
│ └── SKILL.md
└── model-evaluation/
└── SKILL.md
```
Keep each skill focused on one task. If a SKILL.md exceeds 500 lines, split it into multiple skills or move reference material to supporting files in the same directory.
## Next Steps
Next, we'll build a skill from scratch.

Xet Storage Details

Size:
5.98 kB
·
Xet hash:
a2eea6300488ef57370a408a8fab24bb033b73d4756414b19a287a6f80dd9726

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.