14 min read
ByEquipo Duotach·Automation and AI consultancy
Claude CodeSubagentsSkillsGuide

Claude Code Subagents and Skills: Complete Guide [2026]

A Claude Code subagent is a specialized AI assistant that the main agent invokes to execute a specific task in its own context window: it receives the assignment, works independently with the tools you allowed, and returns only the result, without polluting the main conversation. A skill is a SKILL.md file with instructions that extends what Claude knows how to do: you create it once and Claude loads it automatically when relevant, or you invoke it directly with /skill-name.

They are the two central pieces for going from "using Claude Code" to "operating a system with Claude Code". We are not writing from theory: at Duotach we operate an internal system with 53 skills, of which 9 are validators and 5 are orchestrators (here is the documented case). Everything technical is verified against the official Claude Code documentation.

What is a subagent in Claude Code

A subagent is a separate Claude instance the main agent invokes to delegate a specific type of task. According to the official documentation, each subagent runs in its own context window, with its own system prompt, access to specific tools and independent permissions. When Claude finds a task that matches a subagent's description, it delegates to it; the subagent works on its own and returns a summarized result.

The main benefit is context preservation. If a secondary task is going to flood your conversation with search results, logs or file contents you will never look at again, that work goes to a subagent: the noise stays in its window, and only the conclusion comes back to your main conversation.

1

Preserve context

Exploration and research outside the main conversation.

2

Apply restrictions

Limit which tools it can use (for example, a read-only code reviewer).

3

Reuse configurations

User-level subagents available across all your projects.

Where subagents live

A subagent is a Markdown file with YAML frontmatter. Its location defines its scope, and when two share a name the higher-priority one wins:

LocationScopePriority
Managed settings (enterprise)Entire organization1 (highest)
CLI flag --agents (JSON at launch)Current session2
.claude/agents/Current project3
~/.claude/agents/All your projects4
A plugin's agents/ directoryWhere the plugin is enabled5 (lowest)

Project subagents (.claude/agents/) get committed to the repository: the whole team uses and improves them with version control. User subagents (~/.claude/agents/) are personal and travel with you across projects.

A subagent's frontmatter

Four fields define the behavior: name, description, tools and model. A code-review subagent, taken from the official tutorial, looks like this:

---
name: code-improver
description: Scans files and suggests improvements for readability,
  performance, and best practices. Use after writing or modifying code.
tools: Read, Grep, Glob
model: sonnet
---

You are a code improvement specialist. For each issue you find, explain
the problem, show the current code, and provide an improved version.

The description is the automatic trigger mechanism: Claude reads it to decide when to delegate. A vague description produces a subagent that is never invoked (or is invoked when it should not be).

tools is your security control. A research subagent does not need Write or Bash; giving them to it is free risk.

Version note: since Claude Code v2.1.198, the /agents command no longer opens the interactive creation wizard; the recommended way is asking Claude to write the file, or editing it directly in .claude/agents/. Files, fields and locations did not change.

What is a skill (and the SKILL.md file)

A skill is a directory with a SKILL.md file that packages procedural knowledge: instructions, checklists, output formats, reference material. Claude loads it automatically when the request matches its description, or you invoke it with /skill-name. The official skills documentation gives the exact creation criterion: create a skill when you find yourself pasting the same manual or multi-step procedure into the chat over and over, or when a section of your CLAUDE.md stopped being a fact and became a procedure.

The key difference with CLAUDE.md is deferred loading: CLAUDE.md content enters the context every session, while a skill's body loads only when used. In the official doc's words: "long reference material costs almost nothing until it is needed". That makes skills the right place for long procedures you do not want to pay for in tokens all the time.

One fact that confuses many people: custom commands merged with skills. A file in .claude/commands/deploy.md and a skill in .claude/skills/deploy/SKILL.md both create /deploy and work the same; skills add supporting files, invocation-control frontmatter and automatic loading.

Structure of a skill

my-skill/
├── SKILL.md           # main instructions (required)
├── references/        # detailed reference documentation
├── assets/            # templates, output examples
└── scripts/           # scripts Claude can execute

Only SKILL.md is required. The rest is material Claude loads on demand if SKILL.md references it. The official advice: keep SKILL.md under 500 lines and move detail into separate files.

Where skills live

LevelLocationScope
EnterpriseManaged settingsEntire organization
Personal~/.claude/skills/<name>/SKILL.mdAll your projects
Project.claude/skills/<name>/SKILL.mdThat project only
Plugin<plugin>/skills/<name>/SKILL.mdWhere the plugin is enabled

If two skills share a name, enterprise overrides personal and personal overrides project. The command name comes from the directory name: .claude/skills/deploy-staging/SKILL.md is invoked as /deploy-staging. Edits to an existing skill take effect in the current session without restarting.

A skill's frontmatter

FieldWhat it does
nameVisible label in listings (the command comes from the directory)
descriptionHow Claude decides when to load the skill automatically
disable-model-invocation: trueOnly you can invoke it. For flows with side effects (deploys, sends) where you do not want Claude deciding the moment
user-invocable: falseOnly Claude can invoke it. For background knowledge that makes no sense as a command
argumentsNamed arguments expanded as $name in the body

The two invocation-control fields are among the most underrated tools: they separate "knowledge Claude applies when appropriate" from "actions only a human triggers". In our system, everything touching money or client communication is manual invocation.

Subagent or skill: when to use each one

The short rule: a skill defines WHAT to know how to do; a subagent defines WHO does it and with what context. They do not compete, they complement each other.

CriterionSkillSubagent
What it isProcedural knowledge (SKILL.md)Claude instance with its own context
When it fitsRepeated procedure, fixed output format, checklistTask that generates a lot of context noise, or that requires restricted tools/permissions
ContextLoads into your conversation when usedSeparate context window
Token costZero until used; then stays in context for the sessionHeavy work stays outside your window
Typical example“Every monthly report follows this format”“Research these 20 results and bring me a summary”
Signal you need itYou paste the same procedure into the chat againYour conversation fills with logs and searches you never reread

And the play the documentation enables and almost nobody uses: combining them. A skill can run inside a subagent, and a subagent can have preloaded skills. The procedure lives in the skill (versioned, editable, shared by the team) and the dirty execution happens in the subagent (without polluting your context). That combination is the foundation of any serious Claude Code system.

How they combine in production: our 53-skill system

Everything above is the mechanics. What follows is what we learned operating this for real: at Duotach we built an internal system on Claude Code to deliver SEO and GEO services to multiple clients, and its current state is 53 skills in production. The architecture has three layers:

39

Work skills

Every repeatable task of the service is a skill: auditing a site, analyzing a SERP, writing a brief, drafting an article, monitoring LLM mentions, analyzing an inbound lead. Each one defines input, procedure and output format.

9

Validators

Skills whose only job is auditing another skill's output against a fixed rubric and returning violations by severity. An article, a pricing analysis or a commercial proposal is not done until its validator returns zero blockers. The article you are reading went through that loop.

5

Orchestrators

Skills that chain the others into complete pipelines (for example: SERP analysis → brief → writing → GEO optimization → validation), delegating steps to subagents so the main session's context does not burn.

The pattern that makes this work is not the number of skills but the closed loop: every piece of work goes through a validator with an objective stop condition before moving on. Without that layer, an agent system produces volume, not quality. With it, the criterion for "this is right" stops living in someone's head and becomes versioned in the repository.

The full system, with results, is documented in our case study, and the general introduction to agents is in the AI agents with Claude Code guide.

Common mistakes creating subagents and skills

The ones we saw (and made) building the system:

Vague descriptions. “Helps with code” does not tell Claude when to invoke. The description must describe the trigger situation: “Use after writing or modifying code”.

Endless skills. If your SKILL.md passes 500 lines, the reference material goes to references/ and loads on demand. Once loaded, the skill stays in context all session: every line is recurring cost.

Subagents with every tool. A read-only subagent with access to Write and Bash is an incident waiting its turn. Give it the minimum it needs.

Everything automatic. Actions with side effects (deploys, sends, publications) go with disable-model-invocation: true. That Claude knows how to do something does not mean it should decide when.

Putting procedures in CLAUDE.md. If it is a procedure and not a project fact, it is a skill: it gets versioned the same and does not pay tokens every session.

Skills without a validator. The most expensive architecture mistake. A skill producing deliverables without another one auditing them scales error production. Our current ratio is roughly one validator per four work skills.

Not committing project subagents. .claude/agents/ and .claude/skills/ in the repo turn the team's criteria into a shared, versioned asset. Outside the repo, everyone reinvents their own.

Step by step: your first skill and your first subagent

Minimum reproducible setup, verified against the official documentation.

Your first skill (5 minutes)

  1. Create the directory: mkdir -p ~/.claude/skills/change-summary
  2. Save this in ~/.claude/skills/change-summary/SKILL.md:
---
description: Summarizes recent repository changes in plain
  language. Use when asked for a summary of what changed.
---

Review the latest commits with git log and summarize the changes
in 3-5 bullets, grouped by area. Close with one line on what
deserves a closer review.

Invoke it with /change-summary, or ask Claude "summarize what changed" and it will load it on its own via the description.

Your first subagent (5 minutes)

  1. In Claude Code, ask for it in natural language: "Create a reviewer subagent in .claude/agents/ that reviews code for readability and security issues. Read-only, with the Read, Grep and Glob tools."
  2. Claude writes the file with name, description, tools and the system prompt. Review the frontmatter before using it.
  3. Try it: "Use the reviewer subagent on this project". If it cannot find it and the .claude/agents/ directory did not exist when the session started, restart Claude Code.

From there, the path is incremental: every time you repeat a procedure, new skill; every time a task dirties your context, new subagent; every time a skill produces important deliverables, a validator to audit it.

What this means for a company

For a team already using Claude (not just developers), skills and subagents are the difference between "each person chats with the AI their own way" and "the company has versioned procedures the AI executes the same way every time". The quality manual stops being a PDF nobody opens and becomes a skill applied automatically to every task.

At Duotach we work on this in two ways:

Claude training for teams: programs where the team learns to work in an orderly way with Claude on their own real cases, including how to turn their procedures into skills.

Custom builds: we design and build agent systems with this architecture (skills + validators + orchestrators) for client-specific operations.

If you are evaluating this for your team, write to us and we will discuss it over your concrete case. And if you are just arriving at Claude Code, start with the pricing and usage guide.

Frequently Asked Questions

What is the difference between a subagent and a skill?+
A skill is knowledge: a SKILL.md file with a procedure Claude loads when relevant. A subagent is an executor: a separate Claude instance with its own context window, tools and permissions. The skill defines what to do; the subagent defines who does it and isolated from what. They can be combined: a skill can run inside a subagent.
Do skills consume tokens even when unused?+
The skill body does not: it loads only when the skill is invoked. What is always in context is its description (unless you use disable-model-invocation: true). That is why the official docs recommend concise bodies and reference material in separate files: once loaded, the skill stays in context for the rest of the session.
Where are subagents and skills stored?+
Subagents: .claude/agents/ (project) or ~/.claude/agents/ (all your projects). Skills: .claude/skills/<name>/SKILL.md (project) or ~/.claude/skills/<name>/SKILL.md (personal). Both also support distribution via plugins and managed organization settings, with priority rules when names collide.
Can I prevent Claude from triggering a skill automatically?+
Yes. With disable-model-invocation: true in the frontmatter, only you can invoke it with /name. It is the right option for actions with side effects: deploys, message sending, publishing. The inverse also exists: user-invocable: false removes it from the / menu and lets only Claude use it as background knowledge.
Are they useful for non-programming work?+
Yes, and that is where they grow the most. Our 53-skill system produces SEO audits, lead analyses, briefs and articles: agency work, not code. Any repeatable procedure that lives today in a manual or in someone's head can become a skill.
What should I learn first: MCP, skills or subagents?+
Skills first: they are the simplest entry point (a Markdown file) and the return is immediate. Subagents when your tasks start polluting the context. MCP solves a different problem, connecting Claude with external systems (databases, APIs, your ERP), and makes sense once you have orderly procedures that need outside data.

Ready to operate with Claude Code?

Want a skills-and-subagents system for your operation?

We train teams to work in an orderly way with Claude and build custom agent systems with the architecture in this article. Free intro call, implementation quoted by scope.

Duotach is an automation and artificial intelligence consultancy from Buenos Aires that builds agent systems with Claude Code for clients in Argentina, Mexico and Spain. This article was produced and validated with the skill system it describes.