Explore skills

Blog / Basics

Skills vs Subagents vs Slash Commands in Claude Code

Slash commands are now skills, and subagents are separate workers with their own context. What each costs, where each lives, and when to pick each one.

Skills vs Subagents vs Slash Commands logos side by side

A slash command is now just a way to invoke a skill, and a subagent is a separate worker with its own context window that hands back only a summary.

Table of contents

The short answer

The three terms overlap less than the title suggests, because Anthropic merged two of them. The Claude Code docs say "Custom commands have been merged into skills. Your existing .claude/commands/ files keep working." So a "slash command" you write yourself is a skill file, and the slash is only how you call it. A subagent is the odd one out: it is a different process with a different context window (Claude Code skills docs, checked 2026-11-23).

I build AI agents full-time, and the confusion I see most is people reaching for a subagent when they wanted a reusable procedure, or writing a skill when they wanted isolation. My rule of thumb:

  • If you want Claude to follow a procedure the same way every time, write a skill.
  • If a side task would flood your main conversation with output you will not read again, run it in a subagent.
  • If you want to trigger something by typing /name, that is still a skill, with disable-model-invocation: true if you do not want Claude to start it on its own.

Everything below comes from the official documentation and the Ragspaces catalog pages. Where the docs give no number, I say so.

What a skill is

A skill is a folder with a SKILL.md file: YAML frontmatter, a markdown body, and any scripts or reference files the instructions point to. Anthropic's Agent Skills overview requires name and description and describes three loading levels: metadata at startup, the body when the skill triggers, and bundled files only when read (Agent Skills overview).

The key property for this comparison is where a skill runs. By default it runs in your main conversation. The docs say "the rendered SKILL.md content enters the conversation as a single message and stays there across later turns." Nothing is isolated. Claude reads the instructions and carries them out with the same tools and the same context you are already using.

This skill is meant to be typed by hand:

---
name: ship
description: Run the release checklist for this repository.
disable-model-invocation: true
---

1. Run the test suite and stop on the first failure.
2. Bump the version in package.json.
3. Draft the changelog from merged pull requests.

The folder lives in ~/.claude/skills/ship/SKILL.md for every project on your machine, in .claude/skills/ship/SKILL.md inside a repository, or in a plugin as <plugin>/skills/<skill-name>/SKILL.md. With disable-model-invocation: true, the docs say Claude will not load it automatically, which suits workflows you want to start yourself with /ship.

A skill without that flag is different. Claude reads the description in the skill listing and decides when to apply it. That is why the description matters so much, a topic I cover in the post on how SKILL.md descriptions trigger.

Real skills you can read

The Ragspaces catalog is "an open catalog of 5,299 agent skills for Claude Code and Codex" (home page count on 2026-11-23). Every skill page shows the description, README and reviews without an account. Three examples of how a skill is written when Claude is meant to pick it up on its own, all checked on 2026-11-23:

  • wcag by @aishac is an accessibility advisor covering WCAG 2.0, 2.1 and 2.2. Its description lists trigger phrases such as success criteria, conformance levels and accessibility audits.
  • design by @elena_async says when to use it (UI, UX, visual hierarchy, redesigns, design critique) and when not to.
  • soc2 by @vera_963 covers the five Trust Services Criteria.

None of those spawns a worker. They are instructions that Claude follows in your session.

What a subagent is

A subagent is a separate Claude instance that your main session delegates to. The sub-agents documentation says it plainly: "Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions" (Claude Code subagents docs).

A subagent is defined by a markdown file with frontmatter, kept in .claude/agents/ for a project or ~/.claude/agents/ for all projects. The file sets the system prompt, the tools it may use and, optionally, a skills list. A short example:

---
name: log-reader
description: Read large log files and report only the errors that matter.
---

You read logs. Return a short list of distinct errors with counts and the first timestamp for each. Do not paste raw log lines.

The docs give the intended use: "Use one when a side task would flood your main conversation with search results, logs, or file contents you won't reference again: the subagent does that work in its own context and returns only the summary."

That sentence contains the entire value of a subagent. It is context isolation. Your main conversation never sees the thousand lines the subagent read. It sees the summary. If you are weighing that isolation against running whole sessions side by side, there is a measured comparison of subagents, parallel sessions and git worktrees based on 708 real sessions.

The costs people forget

Isolation is not free. The docs state that a subagent "also sends its own requests, which count toward the same usage limits as your main conversation." A subagent that reads fifty files spends tokens on those fifty files, even though your main context stays small. The saving is context space, not usage. The model you assign is the main lever here, and Sonnet vs Haiku for subagents works out what each costs per task.

There is also a loss of information. A subagent returns a summary, so anything it noticed and did not mention is gone from your session. Subagents do not see your conversation history either, so the task you give them has to stand on its own.

What a slash command is today

There are three different things typed after a slash, and they are easy to mix up.

First, built-in commands such as /help and /compact. The skills docs call out that most built-in commands "execute fixed logic directly." They are code in the Claude Code program, not prompts.

Second, bundled skills. Claude Code ships some, listed in the docs as /doctor, /code-review, /batch, /debug, /loop and /claude-api. The docs say: "Bundled skills are prompt-based: they give Claude detailed instructions and let it orchestrate the work using its tools." They look like commands because you type a slash, but they are skills Anthropic wrote. The commands reference marks them Skill in its Purpose column, and a disableBundledSkills setting turns them off (commands reference).

Third, your own commands. A file at .claude/commands/deploy.md still works, and so does a skill at .claude/skills/deploy/SKILL.md. Both create /deploy. If they share a name, the docs say the skill wins.

So when someone asks whether to write a slash command or a skill, the question has mostly dissolved. You write a skill. If you want it manual-only, you add one frontmatter line. If you want Claude to find it by itself, you write a good description and leave that line out.

Fact table

Skill Subagent Slash command
What it is Folder with SKILL.md and optional scripts (Agent Skills overview) Separate worker with its own context window, system prompt and tool access (subagents docs) A typed trigger: built-in logic, a bundled skill, a skill, or a legacy command file (skills docs)
Where it lives ~/.claude/skills/, .claude/skills/, or inside a plugin (skills docs) .claude/agents/ or ~/.claude/agents/ (subagents docs) .claude/commands/ still works and is merged into skills (skills docs)
Runs in Your main conversation by default; context: fork runs it in a subagent (skills docs) Its own context window (subagents docs) Whatever it resolves to: fixed code or a skill
What stays in your context The rendered body, for the rest of the session (skills docs) Only the summary it returns (subagents docs) Depends on the target
Always in context Name and description in the skill listing (skills docs) Its description; a startup warning appears past 15,000 tokens of custom descriptions (subagents docs) A legacy command file is invocable by Claude too (skills docs)
Counts toward usage Yes, as ordinary tokens in your session Yes, its own requests count toward the same limits (subagents docs) Depends on the target
Can load skills Is the thing being loaded skills: frontmatter injects the full content at startup (subagents docs) Not applicable
Works in Codex Yes, same open standard (Codex docs) Codex has its own subagents, defined as TOML files (Codex subagents) Codex custom prompts are deprecated in favor of skills (Codex docs)

Two rows deserve a note. For subagents, the docs say "Those descriptions take up context, so keep them short", and the system prompt "only loads when that subagent runs", so an idle subagent costs its description, much like a skill. The "Counts toward usage" row for skills is my reading of the docs rather than a quote: a skill body is text in your conversation, so it is billed like any other text there.

Context and usage cost

The cost shapes differ, and that is the most practical reason to choose one over another.

A skill costs context in two stages. The listing is always there: "Every skill in the skill listing adds to your context on every turn, whether or not Claude ever uses it." Anthropic's overview gives the figure for metadata as "~100 tokens per Skill." When the skill is used, the whole body enters the conversation and stays. Claude Code "does not re-read the skill file on later turns," because it does not need to; the text is already there.

Long sessions add another wrinkle. When the conversation is compacted, Claude Code "re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each," and re-attached skills "share a combined budget of 25,000 tokens." A skill you used an hour ago can therefore survive compaction, and a very long one can be cut off. I go through those limits in detail in the token-cost post later in this series.

A subagent costs the other way around. Your context pays little, because only the summary comes back. Your usage pays in full, because the subagent makes its own requests. If your concern is hitting plan limits, a subagent is not a saving. If your concern is a conversation that fills with irrelevant file contents, it is exactly the right tool.

The docs make a related point in the costs guidance: move instructions out of CLAUDE.md into skills, because "Skills load on-demand only when invoked." That advice sits behind the comparison in my post on SKILL.md vs CLAUDE.md vs AGENTS.md.

Skill listing limits

The listing has a budget. The docs say it "scales at 1% of the model's context window" and that when it overflows, Claude Code "drops descriptions starting with the skills you invoke least." Each entry's combined description and when_to_use text is also truncated at 1,536 characters. A pile of installed skills does not grow your context forever, but a skill you rarely use can lose its description and stop being matched.

Subagent definitions are a different mechanism with a different limit: the subagents docs say Claude Code shows a startup warning when the combined descriptions of your custom subagents pass 15,000 tokens, and still loads every subagent. If you run many custom subagents, check /context yourself rather than assuming.

How the three combine

The more useful question is how to use them together, because the docs give two direct bridges.

A skill that runs in a subagent

Adding context: fork to a skill's frontmatter changes where it runs. The docs say: "Claude Code starts a new subagent of the type set in the agent field and gives it the skill content as its prompt. The subagent doesn't see your conversation history, so the skill's instructions have to stand on their own."

---
name: summarize-logs
description: Summarize the error patterns in a log file.
context: fork
agent: Explore
---

Read the log file named in the request. Return the distinct errors with counts.
Do not paste raw log lines.

You get a reusable, typed or auto-triggered procedure, and you get isolation. The name is misleading, and the docs flag it: despite the name, context: fork does not run in a fork of the current conversation. If the task depends on what you have already discussed, fork the conversation instead.

The docs add a warning that I think is the most useful line on the page for skill authors: context: fork only makes sense for skills with explicit instructions. A skill that only contains guidelines such as "use these API conventions" gives the subagent no task, and it returns without meaningful output.

A subagent that preloads skills

The reverse direction is the skills field in a subagent's frontmatter: "Skills to preload into the subagent's context at startup. The full skill content is injected, not only the description."

Note the contrast with normal skill loading. In your main session, only the description sits in context until a skill fires. In a preloading subagent, the full body is injected up front. That is a good trade when a subagent always needs the same conventions, such as a reviewer that must follow your team's style rules, and a poor one when the skill is long and only sometimes relevant.

A command that is secretly a skill

The third combination is the simplest. The bundled commands you type, like /code-review or /debug, are skills. You can write your own in the same format and put them in a repository so the whole team gets them. I use a public skill as a reference for a new one before writing it, and wcag is a good example of a long trigger-rich description. For something more compact, mindmap-markmap-viewer by @danielcruz turns Markdown outlines into a self-contained HTML mind map.

Other pages that load without an account include write by @iris_hall, gradientdeck by @priya_77 and peer by @mei_patch. I list them as places to read real SKILL.md files, not as endorsements.

Pick a skill if, pick a subagent if, pick a slash command if

Pick a skill if:

  • The knowledge is a procedure, checklist, house style or set of conventions.
  • You want Claude to find it from its description, or you want a typed /name for it.
  • You want teammates to read and edit it as a plain file in the repository.
  • You want the same folder to work in Claude Code and Codex.

Pick a subagent if:

  • A side task reads far more than you need to see: searches, logs, large files.
  • You want different tool access or permissions for the worker than your main session has.
  • The task is self-contained and can be described without your conversation history.
  • You accept that its requests count toward your usage limits.

Pick a slash command (meaning a user-invoked skill) if:

  • The workflow has side effects you want to start deliberately, such as deploying or committing.
  • You want the manual trigger and none of Claude's guessing, so you add disable-model-invocation: true.
  • You already have .claude/commands/ files and they work well enough.

A decision I use on real projects. Release checklist: a skill with disable-model-invocation: true, because I want to type it. House code style: a skill with a trigger-rich description, because I want Claude to apply it on its own. Reading a noisy build log: a subagent, or a skill with context: fork, because I do not want the log in my conversation.

What Ragspaces adds

Ragspaces is a catalog and sync layer for skills. It deals with the skill side of this comparison only. Free skills install into your own Claude Code or Codex with one command, a hook uploads a skill when your agent saves it, and a watcher on another computer pulls it down "within a minute" (how it works).

Ragspaces does not sync subagent definitions as far as I can document, so if you keep .claude/agents/ files, commit them to your repository like any other file. For plain project skills, a committed .claude/skills/ folder needs no catalog at all.

Migrating old commands

If you have a folder of .claude/commands/*.md files, nothing breaks. The docs state the files keep working, and Claude can invoke them without you typing the command. Move one to a skill when you want any of the following:

  1. Supporting files. A command is a single markdown file. A skill is a folder, so it can carry scripts and reference documents that load only when read.
  2. A manual-only switch. Add disable-model-invocation: true to keep Claude from starting it.
  3. Hiding it from the menu while keeping it available to Claude. user-invocable: false does that.
  4. Isolation. context: fork plus agent runs it in a subagent.

The move itself is mechanical. Create .claude/skills/<name>/SKILL.md, paste the old body, add name and description frontmatter, and delete the old file. If both exist under one name, the skill wins, so you can test the new one before deleting the old file. The docs say Claude Code picks up changes within the current session, and /reload-skills handles a skill that does not appear.

Common mistakes

Using context: fork for guidelines. The subagent gets rules and no task, then returns nothing useful. Fork only skills that say what to do.

Expecting a subagent to remember the conversation. It does not see your history. Put everything it needs in the prompt or the skill.

Assuming a subagent saves usage. It saves context space. Its requests count toward the same limits as your main session.

Preloading large skills into every subagent. The full content is injected at startup, which is the opposite of the lazy loading that makes skills cheap.

Writing a subagent when a skill would do. If the job is a procedure that fits in your conversation, an extra worker adds a summary step and a cost for no gain.

Frequently asked questions

Are slash commands and skills the same thing now?

Mostly. The Claude Code docs say custom commands have been merged into skills, and your existing .claude/commands/ files keep working. Built-in commands such as /help and /compact are different: most of them run fixed logic rather than prompting Claude.

Do subagents use more tokens than skills?

They can. A subagent sends its own requests, and the docs say those count toward the same usage limits as your main conversation. What it saves is context space in your main session, because only a summary returns.

Can a skill run inside a subagent?

Yes. Add context: fork to the skill's frontmatter and, optionally, agent to pick the subagent type. The subagent receives the skill content as its prompt and does not see your conversation history.

Can a subagent use my skills?

Yes, through the skills field in its frontmatter. The docs say the full skill content is injected at startup, not only the description, so preload only the skills that subagent needs every time.

What is the difference between a bundled skill and a built-in command?

A bundled skill, such as /code-review or /debug, is prompt-based: it gives Claude instructions and lets it orchestrate the work with its tools. Most built-in commands execute fixed logic directly, according to the Claude Code docs.

Do skills and subagents work in Codex?

Skills do, because Codex builds on the same open agent skills standard and reads SKILL.md files. Codex has subagents too, but they are set up differently: its subagents docs (checked 2026-11-26) say current releases enable them by default, you ask Codex to delegate, /subagents switches between agent threads, and custom agents are TOML files in ~/.codex/agents/ or .codex/agents/, not Markdown files. Custom slash commands are the bigger gap: Codex's custom prompts in ~/.codex/prompts/ are deprecated in favor of skills. The frontmatter fields in this article, such as context: fork, are Claude Code features.

Key takeaways

  • Custom slash commands were merged into skills, and .claude/commands/ files still work.
  • A skill runs in your main conversation by default and its body stays there once invoked.
  • A subagent has its own context window and returns only a summary, but its requests count toward your usage.
  • context: fork runs a skill in a subagent, and the skills field preloads full skill content into one.
  • Bundled commands like /code-review are skills, while most built-in commands such as /compact run fixed logic.

The bottom line

Write a skill first. It covers the procedure case, the typed-command case and, with context: fork, the isolation case. Reach for a subagent when the real problem is a main conversation filling up with output you will not reuse, and budget for the usage it spends.

If you want to read real SKILL.md files before writing your own, browse the Ragspaces catalog. Skill pages show the description, README and reviews with no account.

Related articles

About this research

Dmitry Makarenko co-founded Zipy as VP R&D, leading 50+ engineers across five countries, and now builds AI agents full-time. (LinkedIn)

This article is based on the Claude Code documentation (skills, subagents, commands reference, costs), Anthropic's Agent Skills documentation, OpenAI's Codex skills documentation and the Ragspaces catalog pages, all read on 2026-11-23. Where the docs give no number, this article says so. Content reviewed and updated: 2026-11-26

Keep reading