home / skills / dmmulroy / .dotfiles / build-skill

This skill guides you in building, validating, and organizing OpenCode skills for reliable agent performance and reusable workflows.

npx playbooks add skill dmmulroy/.dotfiles --skill build-skill

Review the files below or copy the command above to add this skill to your agents.

Files (10)
SKILL.md
3.8 KB
---
name: build-skill
description: Create effective skills for OpenCode agents. Load FIRST before writing any SKILL.md. Provides required format, naming conventions, progressive disclosure patterns, and validation. Use when building, reviewing, or debugging skills.
---

# Building Skills

Skills extend agent capabilities with specialized knowledge, workflows, and tools.

## Quick Start

Minimal viable skill in 30 seconds:

```bash
mkdir my-skill && cat > my-skill/SKILL.md << 'EOF'
---
name: my-skill
description: Does X when Y happens. Use for Z tasks.
---

# My Skill

Instructions go here.
EOF
```

Place in `.opencode/skills/` (project) or `~/.config/opencode/skills/` (global).

## Skill Type Decision Tree

```
What are you building?
├─ Instructions only → Simple skill (SKILL.md only)
│   Example: code-review guidelines, commit message format
│
├─ Domain knowledge → Reference-heavy skill (+ references/)
│   Example: API docs, database schemas, company policies
│
├─ Repeatable automation → Script-heavy skill (+ scripts/)
│   Example: PDF processing, data validation, file conversion
│
├─ Complex multi-step workflow → Multi-file skill (all directories)
│   Example: release process, deployment pipeline
│
└─ Large platform → Progressive skill 
    Example: AWS, GCP, Cloudflare (60+ products)
```

## When to Create a Skill

Create a skill when:
- Same instructions repeated across conversations
- Domain knowledge model lacks (schemas, internal APIs, company policies)
- Workflow requires 3+ steps with specific order
- Code rewritten repeatedly for same task
- Team needs shared procedural knowledge

## When NOT to Create a Skill

| Scenario | Do Instead |
|----------|------------|
| Single-use instructions | AGENTS.md or inline in conversation |
| Model already knows domain | Don't add redundant context |
| < 3 steps, no reuse | Inline instructions |
| Highly variable workflow | Higher-freedom guidelines |
| Just want to store files | Use regular directories |

## Reading Order

| Task | Files to Read |
|------|---------------|
| New skill from scratch | anatomy.md → frontmatter.md |
| Optimize existing skill | progressive-disclosure.md |
| Add scripts/resources | bundled-resources.md |
| Find skill pattern | patterns.md |
| Debug/fix skill | gotchas.md |

## In This Reference

| File | Purpose |
|------|---------|
| [anatomy.md](./references/anatomy.md) | Skill directory structures |
| [frontmatter.md](./references/frontmatter.md) | YAML spec, naming, validation |
| [progressive-disclosure.md](./references/progressive-disclosure.md) | Token-efficient design |
| [bundled-resources.md](./references/bundled-resources.md) | scripts/, references/, assets/ |
| [patterns.md](./references/patterns.md) | Real-world skill patterns |
| [gotchas.md](./references/gotchas.md) | Common mistakes + fixes |

## Scripts

| Script | Purpose |
|--------|---------|
| `scripts/init_skill.sh` | Scaffold new skill |
| `scripts/validate_skill.sh` | Validate skill structure |
| `scripts/package_skill.sh` | Create distributable zip |

## Pre-Flight Checklist

Before using a skill:

- [ ] SKILL.md starts with `---` (line 1, no blank lines)
- [ ] `name:` field present, matches directory name
- [ ] `description:` includes what + when to use
- [ ] Closing `---` after frontmatter
- [ ] SKILL.md under 200 lines (use references/ for more)
- [ ] All internal links resolve

Run: `./scripts/validate_skill.sh ./my-skill`

## Skill Locations

| Priority | Location |
|----------|----------|
| 1 | `.opencode/skills/<name>/` (project) |
| 2 | `~/.config/opencode/skills/<name>/` (global) |
| 3 | `.claude/skills/<name>/` (Claude-compat) |

Discovery walks up from CWD to git root. First-wins for duplicate names.

## See Also

- [Cloudflare Skill](https://github.com/dmmulroy/cloudflare-skill) - Reference implementation

Overview

This skill helps teams create effective OpenCode agent skills by providing a clear format, naming conventions, progressive disclosure patterns, and validation tools. It should be loaded first when building, reviewing, or debugging other skills to ensure consistency and token-efficient design. The skill includes scaffolding scripts and a pre-flight checklist to catch common errors before use.

How this skill works

The skill inspects a skill directory for required frontmatter, naming consistency, file structure, and internal link resolution. It guides authors through a decision tree that selects the appropriate skill type (instructions-only, reference-heavy, script-heavy, multi-file, or progressive) and recommends when to split content into external references. Validation scripts automatically check structure, line counts, and manifest fields and can package the skill for distribution.

When to use it

  • When you are authoring a reusable agent capability that will be invoked multiple times
  • When domain knowledge or internal APIs are missing from the model and must be encoded
  • When a workflow requires three or more ordered steps or repeatable automation
  • When you need shared procedural knowledge across a team
  • When reviewing or debugging existing skills for structure and token-efficiency

Best practices

  • Start with the manifest frontmatter: name, concise description, and clear usage guidance
  • Choose the simplest skill type that covers the use case; prefer references for large docs and scripts for repeatable automation
  • Use progressive disclosure: keep the main file short and surface detailed references only when needed
  • Follow a consistent directory structure for scripts/, references/, and assets/ to make discovery and validation reliable
  • Run the provided validation script and pre-flight checklist before sharing or deploying a skill

Example use cases

  • Scaffold a new skill from a template and validate its manifest and filenames
  • Convert an internal API spec into a reference-heavy skill for agent lookup
  • Bundle a repeatable data-processing workflow with scripts and validation checks
  • Create a multi-step release or deployment workflow that agents can execute reliably
  • Audit and fix existing skills to reduce token usage and improve progressive disclosure

FAQ

What minimal files are required to create a skill?

Provide a manifest with name and description plus a short entry file; add references/ or scripts/ only if needed by the use case.

How do I check a skill before sharing?

Run the validation script and the pre-flight checklist to verify frontmatter, naming, line limits, and internal links.