Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Agent Skills guide

Skills vs subagents vs slash commands vs hooks

Skills vs subagents, slash commands, hooks, MCP servers and AGENTS.md: when to reach for each in a coding agent, with a decision table and a worked example.

By Beginner · Updated 20 November 20266 min read
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

Skills and subagents solve different problems. A skill teaches the agent how to do a job and loads into the current conversation when relevant; a subagent is a separate agent with its own context window that returns only its result. A slash command is a skill you start by name; a hook is code that always runs.

Coding agents now have half a dozen ways to extend them, and they overlap. The short version: an MCP server gives the agent new abilities, a skill teaches it how to do a job, a subagent gives a job its own context window, an AGENTS.md file states rules that always apply, and a hook enforces something whether the model agrees or not. Plugins package any mix of these. For the format behind skills, see what Agent Skills are.

Skills, subagents, slash commands and hooks: the decision table

You want to… Use Why
Let the agent call an API, query a database or drive a browser MCP server (or a CLI the agent can run) It needs a new capability, not new knowledge
Teach a repeatable procedure, convention or current API Skill Loaded only when relevant, can bundle scripts
State rules that apply to every task in a repo AGENTS.md / CLAUDE.md Always in context
Run a big or noisy task without filling the main context Subagent Separate context window; only the result comes back
Guarantee something happens or never happens Hook Runs as code at a fixed point, not as a suggestion
Give people a shortcut they type Slash command (now a skill in Claude Code) Explicit, user-started
Ship several of the above to a team Plugin One install, one update channel

Skills: how to do a job

A skill is a folder with a SKILL.md file. The agent sees only its name and description until a task matches, then reads the instructions and any files they point to. Skills are good at encoding how: the steps for a release, the gotchas of a library, the shape of a good report, a script that fills PDF forms correctly.

They do not add capabilities by themselves. A skill that says “query the analytics database” is useless unless the agent can already reach that database through a tool.

MCP servers: new abilities

The Model Context Protocol connects an agent to external tools and data through a server process. Each tool comes with a schema the model can call. Use MCP when the agent must do something it otherwise could not: read your issue tracker, call an internal API with credentials, control a browser.

The two work well together. Many vendor skills are effectively “how to use our MCP server or CLI well”. MongoDB’s schema design skill, for example, can inspect real collections when the MongoDB MCP server is connected and has rules about asking before writes. If you are building the server side, see mcp-builder and our tutorials on MCP. For a fuller side-by-side, read Agent Skills vs MCP.

A rough cost difference: every connected MCP server adds its tool definitions to the context for the whole session, whereas an unused skill costs only its one-line catalogue entry.

Subagents: a separate context window

A subagent is a separate agent instance with its own context window, its own instructions and often a restricted tool set. In Claude Code you define one as a Markdown file with frontmatter in .claude/agents/; other agents have their own equivalents. The main agent delegates a task, the subagent works through it, and only its final report returns.

Use a subagent when the work would flood the main conversation (searching a large codebase, reviewing a long diff) or when you want an independent check, such as a reviewer that has not seen the implementer’s reasoning. Skills and subagents combine naturally: subagent-driven-development is a skill whose instructions tell the main agent how to dispatch and review subagents.

In Claude Code a skill can also run itself in a subagent with context: fork in its frontmatter. Our tutorial on subagents in Claude Code shows how to define and call one.

Slash commands: skills you start by name

In Claude Code, custom slash commands have been merged into skills. A file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both give you /deploy, and old command files keep working. If you want a skill that only runs when you type it, set disable-model-invocation: true. Migrating rules and slash commands to skills covers moving old commands across. Cursor and Copilot also let you start a skill with /, and Codex uses $skill-name.

The practical difference from a model-invoked skill is who decides. Use a user-invoked command for anything with side effects you want to trigger deliberately, such as deploying or publishing.

AGENTS.md and CLAUDE.md: rules that always apply

These are plain Markdown files at the repo root (and sometimes in subfolders) that the agent reads on every turn. Put things there that are true for all work in the repository: the package manager, how to run tests, naming conventions, what not to touch. Keep them short, because every line costs context on every request.

A useful test: if a rule matters only for one kind of task, it probably belongs in a skill; if forgetting it would break any task, it belongs in AGENTS.md. Sentry’s agents-md skill helps keep the file lean.

Hooks: guarantees in code

Hooks are commands the agent runtime runs at fixed points, such as before a tool call or after a file edit. They are code, so they apply whether or not the model remembers. Use them for hard guarantees: run the formatter after every edit, block git push --force, refuse writes outside a directory.

git-guardrails-claude-code is a skill whose job is to install such a hook. That is a good pattern: a skill for the one-off setup, a hook for the enforcement. The Claude Code hooks tutorial walks through writing your own.

Plugins: one package for all of them

Plugins are a distribution layer in Claude Code, Codex, Cursor, Copilot and Antigravity. A plugin can contain skills, subagents, hooks, slash commands and MCP configuration, and users install it from a marketplace in one step. Most published skill collections are distributed as plugins, which is why several entries in our directory list a plugin install alongside the per-skill command. See packaging and sharing Agent Skills for how to build one.

A worked example

Say your team wants the agent to open well-formed pull requests against an internal deployment system.

  • An MCP server (or the existing gh CLI) gives the agent the ability to create PRs and read deployment status.
  • A skill describes your PR conventions: title format, required checklist, which reviewers to request for which folders, and a script that checks the changelog entry.
  • AGENTS.md says which branch is protected and how to run the test suite, because every task needs that.
  • A hook blocks direct pushes to main, because that must never happen.
  • A plugin bundles the skill, the hook and the MCP configuration so new team members get all of it with one install.
  • Model Context Protocol (MCP)

    An open protocol that lets AI apps reach external tools, data and prompts through small servers that each wrap one service.

    Glossary

  • Subagent

    A separate agent instance with its own context window, launched by a main agent to handle a focused task and report back a short result.

    Glossary

  • AGENTS.md

    An open, tool-neutral Markdown file of instructions for coding agents working in a repository, read by many different agents and editors.

    Glossary

  • MCP explained: hosts, clients, servers and transports

    What MCP is and how the Model Context Protocol connects AI apps to tools and data: hosts, clients, servers, transports and what the 2026-07-28 spec changed.

    TutorialBeginner20 min

  • Model Context Protocol

    Connecting AI applications to tools and data through MCP servers and clients.

    SkillIntermediate

Back to top