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

FieldRequiredTypeConstraintsDescription
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--skill is invalid)
  • Must match the parent directory name

Valid names

  • code-review
  • data-validation
  • test-generator
  • my-skill-v2

Invalid names

  • Code-Review — uppercase
  • -my-skill — leading hyphen
  • my--skill — consecutive hyphens
  • my_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
DirectoryPurposeWhen loaded
SKILL.mdCore skill definitionAlways — loaded into agent context on activation
scripts/Executable code in any languageOn demand — agent runs scripts as instructed
references/Extended documentation for progressive disclosureOn demand — agent reads when instructed by SKILL.md
assets/Config files, templates, static resourcesOn demand — referenced by scripts or instructions

Validation Rules

The validator checks strict spec compliance. All errors must be fixed; warnings are advisory.

RuleSeverityWhat it checks
name.requirederrorname field must be present
name.typeerrorname must be a string
name.maxLengtherrorname must not exceed 64 characters
name.formaterrorname must match the name regex (lowercase, hyphens, no consecutive hyphens)
name.matchesDirectoryerrorname must match the parent directory name
description.requirederrordescription field must be present
description.typeerrordescription must be a string
description.maxLengtherrordescription must not exceed 1024 characters
compatibility.typeerrorIf present, compatibility must be a string
compatibility.maxLengtherrorcompatibility must not exceed 500 characters
metadata.typeerrorIf present, metadata must be an object
metadata.valueTypeerrorAll metadata values must be strings
license.typeerrorIf present, license must be a string
allowed-tools.typeerrorIf present, allowed-tools must be a string
frontmatter.unknownFieldwarningUnknown 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.

RuleSeverityWhat it checksFix
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

ConstantValueDescription
Name min length1Minimum characters for skill name
Name max length64Maximum characters for skill name
Description max length1024Maximum characters for description
Compatibility max length500Maximum characters for compatibility
Body token budget5000Recommended max tokens for SKILL.md body
Body line budget500Recommended 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