Agent Skills Explained: The SKILL.md Structure, Four Template Categories, and Best Practices

    This article explains how agent skills work as structured folders rather than long prompts, and how progressive disclosure keeps context costs low even as you add many capabilities. You'll learn the three-tier loading model (metadata, core instructions, reference material and scripts), the difference between a spec and an example, the four common categories of SKILL.md templates, a copy-ready template, how deployment differs across CLI coding assistants, chat products, and APIs, and the practical pitfalls to avoid when writing your own skills.

    1. Rethinking a Skill: It’s a Folder, Not a Prompt

    The most intuitive way to extend an AI assistant with domain capabilities is to stuff the instructions into the system prompt. But this approach runs into two unavoidable problems. First, the longer the prompt, the more the model’s effective attention is diluted, and key instructions can easily get buried. Second, all knowledge—whether or not it’s relevant to the current task—stays resident in the context window and continuously consumes your token budget. Once you start integrating a dozen or more capabilities like PDF parsing, spreadsheet handling, coding standards, and data visualization, the context fills up fast with content that’s “kept on hand but not used.”

    The core idea behind an agent skill is to restructure a “capability” from a linear block of text into a structured folder. Inside that folder, responsibilities are cleanly separated:

    • SKILL.md: the skill entry file, holding metadata (name, description) and core operating instructions;
    • REFERENCE.md: heavyweight reference material, domain specs, and detailed examples;
    • scripts/: callable executable scripts and tools;
    • plus any other optional templates, samples, and resource files.

    The elegance of this design is that the agent doesn’t read the entire folder into context up front. Instead, it loads content on demand, layer by layer. Anything not needed stays out of the context—this is what’s called progressive disclosure. It’s what lets the number of skills scale almost without limit while the context cost stays nearly constant.

    2. Directory Structure and the Layered Loading Mechanism

    To understand skills, you need to understand their three-tier loading model rather than treating them as a static document.

    Tier 1: Metadata. The top of SKILL.md usually contains a block of structured metadata with just the name and description. This part is tiny, and it either stays resident or participates lightly in routing decisions. It lets the agent know “there’s a skill that can do X” without loading the full content.

    Tier 2: Core instructions (SKILL.md body). Only when a task matches a skill and it’s judged necessary does the body of SKILL.md get loaded into context. The body should focus on decision-level information—“when to use it, how to use it, what to watch out for”—and stay concise.

    Tier 3: Reference material and scripts (REFERENCE.md, scripts/). Only when the execution actually needs the details are REFERENCE.md or the scripts under scripts/ read on demand. For example, you read the parsing rules only when handling a complex spreadsheet, or trigger the batch script only when a file turns out to be large.

    This layering brings two direct benefits. One is context economy: dozens of skills can coexist without crowding the window. The other is cognitive focus: only the information strongly relevant to the current task is handed to the model each time, which makes output quality more consistent. An illustrative directory structure looks like this:

    1. my-skill/
    2. ├── SKILL.md # Entry point: metadata + core instructions
    3. ├── REFERENCE.md # On-demand reference material
    4. └── scripts/
    5. ├── parse.py # Callable tool script
    6. └── validate.py

    3. First, Get This Straight: Spec ≠ Examples

    In learning materials you’ll often see a number like “20 SKILL.md files,” but readers frequently can’t reconcile it when they count. The reason is usually simple: that number is the sum of “a set of examples + one blank template.” Part of it is reference examples provided officially, and one is a blank starter template. Many people count the template as an example, so the numbers don’t add up.

    Here’s the basic understanding to establish: the spec defines “what makes a valid skill,” while the examples are just references that show “it’s better to follow along.” The spec document sets the hard constraints—directory conventions, metadata fields, loading behavior. The examples are templates to imitate, adapt, and reuse. When actually building something, take the spec as your yardstick and the examples as your starting point, not the other way around—don’t mistake a particular example for the standard.

    4. The Four Categories of the 20 SKILL.md Files

    Grouping skills by purpose helps with on-demand installation and avoids the choice overload that comes from “installing everything at once.” A common four-category split looks like this:

    • Document processing: reading, extraction, generation, and conversion for formats like PDF, Word, Excel, and PPT. These skills usually come with mature parsing scripts placed in scripts/ and called on demand.
    • Reference examples: templates for general capabilities such as writing, summarizing, and rewriting. They serve more as “teaching samples” and are well suited as starting points for custom skills.
    • Code and scripts: wrapping a class of engineering operations (build, validate, format), with instructions that spell out when to call them and their parameter constraints.
    • Process and workflow: orchestrating multi-step tasks into reusable flows, emphasizing stage division, state handoff, and failure fallback.

    The point of categorization isn’t the naming—it’s letting users know clearly what each skill is responsible for and when it triggers, so capabilities can be assembled precisely rather than crammed into the environment all at once.

    5. How to Write a SKILL.md: A Copy-Ready Template

    A SKILL.md is typically made up of two parts: YAML metadata and a Markdown body. The metadata includes at least a name and a description, and the description must make clear “what this skill can do and what scenario it should be used in,” because it’s the basis for routing decisions. Below is an illustrative template you can apply directly:

    1. ---
    2. name: pdf-processing
    3. description: Extract text, tables, and metadata from PDFs. Use when the user needs to read, parse, or convert a PDF.
    4. ---
    5. # PDF Processing Skill
    6. ## When to Use
    7. Trigger this skill when the task involves extracting text from a PDF, restoring tables, or converting formats.
    8. ## Workflow
    9. 1. Determine the file type (text-based / scanned)
    10. 2. Extract directly for text-based files; call the OCR script first for scanned ones
    11. 3. Organize and output according to the specs in REFERENCE.md
    12. ## Notes
    13. - Process large files page by page to avoid loading everything at once
    14. - Parsing rules for complex tables are in scripts/parse_table.py

    There are three writing essentials: precise description (it determines whether the skill can be triggered correctly), executable instructions (use numbered steps rather than vague statements), and pushing details down (move lengthy specs into REFERENCE.md and deterministic operations into scripts).

    6. Deployment Differences Across Three Integration Paths

    Skills ultimately get loaded in a specific environment, and the experience and prerequisites differ across integration paths, so they need to be treated separately:

    • CLI coding assistants: usually obtained through a plugin marketplace. You can first add a skill repository source, then install the skills you need by group. It’s recommended to install on demand rather than all at once, to avoid making routing decisions more complex.
    • Online chat products: some example skills may already be built in for paid plans, so first confirm whether they’re already available before deciding whether to deploy locally, to avoid duplicate effort.
    • APIs: generally support using prebuilt skills, or uploading custom skills and referencing them on the calling side. This suits scenarios where you want to bring skills into an automation pipeline or your own product.

    What the three share is that they all follow the same set of directory and loading conventions; the differences are only in “where they come from, how they’re installed, and how they’re called.”

    7. Best Practices and Common Pitfalls

    • Let the description do the talking: whether a skill can be triggered depends nine times out of ten on how clearly the description is written. Rather than listing feature nouns, point out typical use cases.
    • Keep the entry lightweight: SKILL.md is the decision layer, not a knowledge base. Leave large reference material in REFERENCE.md and load it on demand.
    • Script whatever can be scripted: hand deterministic, reusable operations to scripts/—it’s more reliable and more token-efficient than having the model reason it out on the fly every time.
    • Assemble on demand: install only the skill groups your current work truly needs. This lowers the selection cost and reduces context noise.
    • Align with the spec, don’t imitate an example: first read and understand the spec’s constraints on directory structure, metadata, and loading behavior, then reference the examples to implement—avoid mistaking a specific example for a general standard.

    In summary, the value of a skill isn’t “another block of prompt text.” It’s about using a folder plus progressive loading to distill domain knowledge into reusable, composable, low-context-cost skill assets. Master the three-tier logic—metadata stays resident, instructions load on trigger, details expand on demand—pair it with a clear template, and you can reliably plug complex capabilities into any agent environment.