02 — Detail · AI Agent Skills

The SKILL.md Spec

Anatomy of a skill definition — frontmatter fields, body structure, directory layout

2Required Fields
4Directory Parts
1File Format
Why a Spec?
The Problem with Ad-Hoc Instructions
Before skills, teams relied on copy-paste system prompts, scattered README notes, and tribal knowledge. No reuse, no versioning, no composability.
Frontmatter Fields
YAML Metadata — The Tier 1 Surface
FieldRequiredPurpose
nameYesKebab-case identifier
descriptionYesWhat this skill does (<200 chars)
versionNoSemantic version
authorNoSkill creator
tagsNoDiscovery keywords
triggersNoActivation patterns
--- name: deploy-to-vercel description: > Deploy a Next.js app to Vercel with env var setup version: 1.2.0 author: sangam tags: [deploy, vercel, nextjs] triggers: - "deploy to vercel" - "push to production" ---
Directory Structure
Skill Folder Layout
.claude/skills/ deploy-to-vercel/ SKILL.md # definition scripts/ # automation references/ # docs assets/ # templates
Only SKILL.md is required. All subdirectories are optional Tier 3 resources.
The Body
Markdown Instructions — The Tier 2 Payload
The body is standard markdown that follows the YAML frontmatter. It contains the actual procedure the agent executes.

Structure conventions:
  • Use headings for major sections
  • Number steps for sequential procedures
  • Use code blocks for commands and templates
  • Reference other skills with relative paths
  • Include guard clauses (check X before doing Y)
  • Keep under 5,000 tokens total
## Pre-flight Checks 1. Verify vercel.json exists 2. Check all env vars are set 3. Run npm run build locally ## Deploy 1. Run vercel --prod 2. Verify deployment URL 3. Run smoke tests ## Rollback If deploy fails: 1. Run vercel rollback 2. Check vercel logs
Real Example
Complete SKILL.md — Content Engine
--- name: content-engine description: Generate blog + social posts from a topic with infographics --- ## Workflow 1. Read EditorialDNA.md for voice and tone 2. Research topic using GitHub search + vendor docs 3. Generate blog post (min 2,500 words, MDX format) 4. Create infographic using /sangam-infographic skill 5. Draft LinkedIn post following LinkedInDNA.md 6. Push blog to content/blog/, infographic to public/infographics/ ## References # Agent loads these from references/ when needed (Tier 3) - references/seo-checklist.md - references/editorial-dna.md
Skill File Anatomy
Visual Breakdown of SKILL.md
SKILL.MD --- YAML FRONTMATTER --- name + description (required) --- MARKDOWN BODY --- Step-by-step instructions Code blocks, references Guard clauses, rollback Tier 1 ~100 tokens Tier 2 <5,000 tokens OPTIONAL DIRS scripts/ — automation references/ — docs assets/ — templates Tier 3 — On-demand
Scripts & Assets
Tier 3 Resources
scripts/ — Shell or Python automation helpers. The skill body references them; agent loads when execution reaches that step.

references/ — Documentation the skill might need. Checklists, API specs, style guides.

assets/ — Templates, config files, images. Copied or used during procedure execution.
All optional. Never pre-loaded. Loaded only when the skill explicitly requests them.
Composition
Skills Referencing Skills
A skill can invoke other skills by name. This enables modular procedures where complex workflows delegate to focused sub-skills.
## Deploy Flow 1. Run /lint-check skill 2. Run /test-suite skill 3. Execute deployment steps 4. Run /smoke-test skill
Dependency chains are resolved at runtime. No circular references.
Spec Comparison
SKILL.md vs Alternative Approaches
ApproachPortabilityComposableVersion ControlContext CostReusable
SKILL.mdAny platformYesGit-native~100 tokensYes
System promptsPer-sessionNoManualFull sizeNo
.cursorrulesCursor onlyNoGitMediumLimited
Custom GPTsOpenAI onlyNoNoneMediumSharable
CLAUDE.mdClaude onlyPartialGitMediumPer-project
Best Practices
Writing Good Skills
02 — Spec Deep Dive · AI Agent Skills · See also: 03 Progressive Disclosure · 04 Knowledge Stack · 05 Security & Trust AI Agent Skills