Skip to content
mentoor

Topic 1 of 5 · 4 min read

How agent skills load on demand

Goal: Choose between a memory-file rule, a skill, an MCP server and a subagent for a given piece of team know-how, and justify the choice by when it loads and what it costs in context.

A skill is a folder with a SKILL.md file that an agent reads in stages: only the name and description at the start, the body when the task matches, and extra files only when the steps point to them. That staged loading is the whole point, and it is what separates a skill from the other places you can put know-how.

Check yourself · 1 of 3

What does an agent load for every installed skill at the start of a session?

Choose one answer

Why it matters

An agent has a limited context window. Everything you load into it costs space and can distract the model. A memory file such as AGENTS.md or CLAUDE.md loads on every session, so it should hold only rules that apply to nearly every task. A 40-step release checklist does not belong there: it would sit in context during a CSS fix. A skill lets you keep that checklist on disk and pay for it only on release day.

What a skill contains

release-notes/
  SKILL.md          # frontmatter + steps
  scripts/
    collect_prs.py  # deterministic work
  references/
    style.md        # read only when needed

SKILL.md starts with frontmatter. The two fields every agent needs are name and description. The agent reads these for every installed skill at startup. When your request matches a description, it loads the body. The body can point to scripts/ and references/, which are opened or run only when a step needs them. This is called progressive disclosure.

Choosing the right home

Ask two questions: when should this load, and what does it need to do?

  • Memory file: short rules for every task. "Use pnpm, not npm." "Run pnpm test before finishing."
  • Skill: a repeatable procedure for one kind of task, with optional scripts and reference files. "How we write release notes."
  • MCP server: live access to a system, such as an issue tracker or a database. A skill gives instructions; an MCP server gives the agent a tool it can call.
  • Subagent: a separate worker with its own context window and tool limits, useful for a side task that would flood the main conversation, such as searching a large codebase.

They combine well. A skill can tell the agent which MCP tool to call, and a subagent can load a skill.

Before and after

Weak: the team pastes the full "how to cut a release" procedure, 180 lines long, into CLAUDE.md. Every session carries it, including a one-line typo fix, and the model sometimes starts tagging releases unprompted.

Better: CLAUDE.md keeps one line ("Releases: use the release skill") and the procedure lives in skills/release/SKILL.md. It loads only when someone asks for a release.

What goes wrong

  • Putting everything in the description. The description is loaded for every task. Keep it to a sentence or two.
  • Treating a skill as a guarantee. The agent decides whether to load it. A vague description means it may never fire.
  • Using a skill where you need a connection. Instructions cannot reach your database. If the agent needs live data, that is an MCP job.

Examples

Routing four pieces of team know-how

Know-how Best home Why
"Use pnpm, never npm" Memory file Short, applies to every task
Steps to write release notes from merged PRs Skill Procedure for one task type, with a script
Read open bugs from the tracker MCP server Needs a live connection
Scan 300 files for deprecated API use Subagent Large side task, results can be summarised

Each row is chosen by when it should load and what it needs, not by habit.

Key points

  • A skill is a folder with a SKILL.md; the agent loads only its name and description at startup, the body when the task matches, and extra files when a step needs them.
  • Memory files load every session, so they suit short rules that apply to almost every task; long procedures belong in skills.
  • A skill gives the agent instructions and scripts, while an MCP server gives it a live tool, so they solve different problems.
  • A subagent runs in its own context window with its own tool limits, which keeps side work out of the main conversation.
  • The agent decides whether a skill fires, so the description is what makes it findable.

Common mistakes

  • Moving every rule out of the memory file into skills, so the agent forgets basic rules like the package manager because no skill matched.
  • Writing a skill when the agent needs a live connection to a system, which only a tool or MCP server provides.
  • Assuming a skill always runs; the agent chooses it from the description, so an unclear description means it silently never loads.
  • Copying a long skill body into the memory file as well, which pays the context cost on every task and defeats on-demand loading.

Check yourself · 2 of 3

A team wants the agent to always use pnpm and never npm. Where does this rule fit best?

Choose one answer

Check yourself · 3 of 3

Your agent must read open bugs from your issue tracker and follow your triage steps. What is the best setup?

Choose one answer

Practice items, not counted towards your mastery.

Start here