Specification Reference
Complete reference for the Agent Skills format.
File Format
Every Agent Skill is defined by a SKILL.md file containing YAML frontmatter followed by a Markdown body.
---
name: my-skill
description: What this does. Use when the user asks for X.
---
# My Skill
## Instructions
1. Step one
2. Step two
The frontmatter is delimited by --- on its own line. The parser uses this regex:
/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/
Frontmatter Fields
| Field | Required | Type | Constraints | Description |
|---|---|---|---|---|
name |
required | string | 1–64 chars, lowercase alphanumeric + hyphens, must match parent directory | Unique skill identifier |
description |
required | string | 1–1024 chars, should include "Use when" trigger | Explains what the skill does and when to activate it |
license |
optional | string | No length limit | License name or reference to bundled license file |
compatibility |
optional | string | Max 500 chars | Environment requirements (product, packages, network) |
metadata |
optional | Record<string, string> | String keys and string values only | Arbitrary key-value pairs for additional data |
allowed-tools |
optional | string | Space-delimited list | experimental Pre-approved tools list |
Example: full frontmatter
---
name: data-validation
description: >
Validate CSV and JSON data files against schemas.
Use when the user asks to check data quality.
license: Apache-2.0
compatibility: Requires Python 3.11+ and uv
metadata:
author: skillscraft
version: "1.0"
category: data
allowed-tools: Bash Read
---
Name Rules
The name field is validated against this regex:
/^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,62}[a-z0-9]?$/
Rules:
- 1–64 characters
- Lowercase letters, digits, and hyphens only
- Must start and end with a letter or digit
- No consecutive hyphens (
my--skillis invalid) - Must match the parent directory name
Valid names
code-reviewdata-validationtest-generatormy-skill-v2
Invalid names
Code-Review— uppercase-my-skill— leading hyphenmy--skill— consecutive hyphensmy_skill— underscores not allowed
Directory Structure
my-skill/
├── SKILL.md # Required — metadata + instructions
├── scripts/ # Optional — executable code (any language)
│ ├── analyze.py
│ └── report.js
├── references/ # Optional — detailed documentation
│ └── GUIDE.md
└── assets/ # Optional — templates, configs, resources
└── config.json
| Directory | Purpose | When loaded |
|---|---|---|
SKILL.md | Core skill definition | Always — loaded into agent context on activation |
scripts/ | Executable code in any language | On demand — agent runs scripts as instructed |
references/ | Extended documentation for progressive disclosure | On demand — agent reads when instructed by SKILL.md |
assets/ | Config files, templates, static resources | On demand — referenced by scripts or instructions |
Validation Rules
The validator checks strict spec compliance. All errors must be fixed; warnings are advisory.
| Rule | Severity | What it checks |
|---|---|---|
name.required | error | name field must be present |
name.type | error | name must be a string |
name.maxLength | error | name must not exceed 64 characters |
name.format | error | name must match the name regex (lowercase, hyphens, no consecutive hyphens) |
name.matchesDirectory | error | name must match the parent directory name |
description.required | error | description field must be present |
description.type | error | description must be a string |
description.maxLength | error | description must not exceed 1024 characters |
compatibility.type | error | If present, compatibility must be a string |
compatibility.maxLength | error | compatibility must not exceed 500 characters |
metadata.type | error | If present, metadata must be an object |
metadata.valueType | error | All metadata values must be strings |
license.type | error | If present, license must be a string |
allowed-tools.type | error | If present, allowed-tools must be a string |
frontmatter.unknownField | warning | Unknown fields in frontmatter are flagged |
Lint Rules
The linter goes beyond spec compliance to check best practices. Best-practice checks that go beyond spec compliance.
| Rule | Severity | What it checks | Fix |
|---|---|---|---|
context-budget |
warn | SKILL.md body under 5,000 tokens (~500 lines) | Move detailed content to references/ |
description-quality |
warn | Description includes a "Use when" trigger clause | Add "Use when the user asks to..." to description |
no-generic-instructions |
warn | Flags vague phrases: "handle errors appropriately", "follow best practices", "use proper error handling" | Replace with specific, actionable instructions |
progressive-disclosure |
warn | Large skills (200+ lines) use references/ for detail |
Move supplementary content to references/ files |
defaults-over-menus |
warn | Instructions provide a clear default tool/approach | State the default choice, don't list equal options |
gotchas-present |
info | Skills over 50 lines have a Gotchas or Caveats section | Add a ## Gotchas section with edge cases |
Extended Specification
Optional, 100% backward-compatible extensions for enterprise features. Defined in @skillscraft/spec.
Security Manifest
Declare what capabilities a skill needs. Agents can use this to gate permissions.
interface SecurityManifest {
capabilities: CapabilityDeclaration[];
requiresNetwork?: boolean;
modifiesFiles?: boolean;
executesCommands?: boolean;
fileSystemScope?: "skill-directory" | "workspace" | "system";
}
interface CapabilityDeclaration {
capability: string; // e.g., "file:read", "shell:execute"
reason: string;
optional?: boolean;
}
Test Scenarios
Structured test cases for evaluating skill behavior.
interface TestScenario {
name: string;
description: string;
cases: TestCase[];
}
interface TestCase {
name: string;
input: string; // Prompt to test with
assertions: TestAssertion[];
expectedBehavior?: string;
}
interface TestAssertion {
type: "contains" | "not-contains" | "matches-regex"
| "file-created" | "file-modified"
| "command-executed" | "custom";
value: string;
description?: string;
}
Tool Binding
Declare tool dependencies with version requirements.
interface ToolBinding {
dependencies: ToolDependency[];
}
interface ToolDependency {
tool: string; // e.g., "Bash", "Read", "Bash(git:*)"
required: boolean;
purpose: string;
minVersion?: string;
}
Skill Composition
Define relationships between skills.
interface SkillComposition {
dependencies: SkillDependency[];
conflicts?: string[];
executionOrder?: "before" | "after" | "independent";
}
interface SkillDependency {
skillName: string;
reason: string;
optional?: boolean;
}
Constants
| Constant | Value | Description |
|---|---|---|
| Name min length | 1 | Minimum characters for skill name |
| Name max length | 64 | Maximum characters for skill name |
| Description max length | 1024 | Maximum characters for description |
| Compatibility max length | 500 | Maximum characters for compatibility |
| Body token budget | 5000 | Recommended max tokens for SKILL.md body |
| Body line budget | 500 | Recommended max lines for SKILL.md body |
| Name regex | /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,62}[a-z0-9]?$/ | Valid name pattern |