Skip to content

All lessons

Area 03 // AI AgentsLesson 54 / 14013 min read

Agent skills

An agent skill is a folder with a SKILL.md file (a name, a description and instructions, plus optional scripts and reference files) that an agent loads only when a task needs it, so agents can carry many specialised abilities without filling their context.

Think of it like this

Analogy

A new employee gets a shelf of training binders: "How to file an expense report", "How to onboard a customer", "Brand guidelines". They don't read every binder every morning. They glance at the spines (titles) and only open the right binder when a task calls for it, and only flip to the appendix when they need the details.

A skill is one of those binders. Its spine is the name and description; its pages are the instructions; its appendix is the scripts and reference files.

The problem it solves

Agents need lots of specialised know-how: your company's report format, how to deploy this service, the legal review checklist, brand rules for slides. Putting all of it in the system prompt bloats the context, costs tokens on every request and confuses the model with instructions that don't apply. Custom code per procedure is heavy and not reusable across agents.

How it works, step by step

  1. Create a folder per skill, named after it (e.g. expense-report/).
  2. Write SKILL.md with YAML frontmatter and instructions:
    • name: short identifier.
    • description: what the skill does and when to use it ("Fill in the expense report from receipts. Use when the user mentions expenses, receipts or reimbursement.").
    • Body: the steps, rules, examples and pointers to bundled files.
  3. Bundle optional files: scripts/ (code the agent can run for exact work), references/ (longer docs to read only when needed), assets/ (templates, images).
  4. Progressive disclosure at run time:
    • Discovery: at start-up the agent loads only each skill's name and description (a few dozen tokens each).
    • Activation: when a task matches a description, the agent reads the full SKILL.md.
    • Execution: it follows the instructions, running scripts or reading references only when needed.
  5. Share and version: skills are just folders, so keep them in Git, review changes, and reuse them across agents. Agent Skills is an open format (agentskills.io) originally developed by Anthropic and supported by many agent products as of November 2026.
  6. Combine with tools: skills describe how; MCP and function tools provide access. A skill can say "use the orders MCP server's get_order tool, then…".
Progressive disclosure: pay for a skill's details only when you use it.

See it in code

Needs
Nothing: plain Python 3.

Creating a skill folder, discovering it by its metadata, and loading its full instructions only when a task matches.

skills_loader.py
import tempfile
from pathlib import Path
 
SKILL = """---
name: expense-report
description: Fill in the company expense report from receipts. Use when the user mentions expenses, receipts or reimbursement.
---
# Expense report
1. Read each receipt and extract date, merchant, amount, currency.
2. Check the limits in references/limits.md.
3. Run scripts/make_report.py with the extracted rows.
"""
 
def frontmatter(text: str) -> dict:
    head = text.split("---")[1]                       # the YAML block between the first two ---
    return dict(line.split(": ", 1) for line in head.strip().splitlines())
 
with tempfile.TemporaryDirectory() as root:
    skill_dir = Path(root, "skills", "expense-report")
    (skill_dir / "references").mkdir(parents=True)
    (skill_dir / "SKILL.md").write_text(SKILL, encoding="utf8")
 
    # 1) DISCOVERY: at start-up the agent reads only name + description of every skill.
    index = {frontmatter(p.read_text(encoding="utf8"))["name"]: p
             for p in Path(root, "skills").glob("*/SKILL.md")}
    meta = frontmatter(index["expense-report"].read_text(encoding="utf8"))
    print("in context at start:", meta["name"], "-", meta["description"][:45] + "...")
 
    # 2) ACTIVATION: a matching task loads the full instructions into context.
    task = "Here are my receipts from the Berlin trip"
    if "receipts" in task.lower() and "receipts" in meta["description"].lower():
        body = index["expense-report"].read_text(encoding="utf8").split("---", 2)[2]
        print("loaded on demand  :", len(body.splitlines()), "lines of instructions")
    # 3) EXECUTION: the agent follows them, reading references/ or running scripts/ only if needed.
Output
in context at start: expense-report - Fill in the company expense report from recei...
loaded on demand  : 5 lines of instructions

In real agents the model itself decides relevance by reading the descriptions (no keyword matching), and reads files with its normal file tools. Claude's apps, Claude Code and the Claude API support skills directly, and so do many other agents that adopted the open format.

A real example

Example

A sales team's slide-making skill

A company's sales staff asked their AI assistant for customer presentations, and every deck came out in a different style. The design team wrote a customer-deck skill: brand colours and fonts (in assets/), a slide-order checklist, a script that builds a .pptx from structured content (in scripts/), and a reference file of approved claims and case studies.

Now when someone asks "make a deck for Acme's renewal", the assistant loads the skill, drafts content following the checklist, and runs the script. Decks became consistent, and legal review got faster because claims came from the approved list. Other agents in the company reuse the same skill folder.

The easy way

Start here

Pick one procedure you explain to the AI repeatedly. Write it as my-skill/SKILL.md with a sharp description ("what + when"), numbered steps and one example. Add a script only for the exact, fiddly part. Try it in an agent that supports skills.

When you grow: the production setup

Teams keep skills in a reviewed repository, test them with evals (does the agent pick the right skill, and follow it?), keep SKILL.md short and push details into references, sandbox bundled scripts (tool sandboxing), and audit third-party skills like any code before installing them.

Trade-offs

What you gain

  • Many specialised abilities with a tiny constant context cost.
  • Plain folders: easy to write, review, version and share across agents.
  • Bundled scripts make precise steps reliable.

What it costs you

  • Skills only work if the agent reliably recognises when to use them.
  • Third-party skills can contain malicious instructions or scripts.
  • Instructions can drift out of date as processes change.

When not to use it

  • A rule that applies to every single request belongs in the system prompt, not a skill.
  • An action needing live access to a system is a tool or MCP server (a skill can explain how to use it).

Common mistakes

  • Vague descriptions ("helps with documents") that never trigger, or trigger everywhere.
  • Huge SKILL.md files instead of short instructions plus references.
  • Installing skills from unknown sources without reading the scripts.
  • Putting secrets in skill files.
  • Never testing whether the agent actually uses the skill correctly.

Interview questions

Try answering out loud first, then open the model answer.

What are agent skills and how do they save context?

Model answer

Skills are folders with a SKILL.md (name, description, instructions) plus optional scripts, references and assets. Agents use progressive disclosure: only names and descriptions are loaded up front; full instructions load when a task matches; supporting files are read or executed only when needed. This lets an agent carry many procedures with minimal standing context, versus stuffing them all into the system prompt.

Skills vs MCP vs system prompt: when do you use which?

Model answer

System prompt for rules that apply to every interaction. Skills for specialised procedures and know-how needed only for certain tasks, possibly with helper scripts. MCP (or function tools) for access to external systems and data, with authorization. A skill can orchestrate MCP tools, so they combine naturally.

What security considerations apply to skills?

Model answer

Skills contain instructions the agent follows and scripts it may execute, so a malicious skill is like malicious code plus prompt injection. Only install skills from trusted sources, review them, pin versions, run scripts in a sandbox with least privilege, avoid embedding secrets, and audit which skills are enabled.

Quiz

Pick an answer to see whether it’s right and why.

  1. 01What is the minimum an agent skill needs?
  2. 02What does progressive disclosure mean for skills?
  3. 03Why does the skill description matter so much?
  4. 04How do skills relate to MCP?
  5. 05A skill includes a scripts/ folder. Why bundle scripts instead of only instructions?

0 of 5 answered

Key terms

Agent skill
A folder with a SKILL.md file (name, description, instructions) plus optional scripts and references that an agent loads only when a task needs it.
Progressive disclosure
Loading information in stages, only as needed. For skills, short metadata first, full instructions on use, extra files only when required.
Context engineering
Deciding exactly what goes into the model's context at each step (instructions, tools, knowledge, memory, history, results) within a budget.
MCP (Model Context Protocol)
An open standard for connecting AI applications to tools, data and prompts through servers that any compatible client can use.

Before and after

Progress is saved in this browser only.