How-To/Claude Code Plugins and Subagents: How to Install and Use Both

Claude Code Plugins and Subagents: How to Install and Use Both

Plugins and subagents are the two ways to extend Claude Code past a single conversation. Plugins package slash commands, agents, hooks, and MCP servers so a team can install one unit. Subagents are workers Claude delegates to, each running in its own context window with its own instructions and tool limits. This guide covers installing a plugin, writing a subagent, and when each one pays off.

Last updated: Nov 21, 2026

Plugins and subagents solve different problems

A plugin is a distributable bundle. It can ship custom slash commands, specialized agents, event hooks, Agent Skills, and MCP server configuration, so everyone on a team installs one thing and gets an identical setup. A subagent is a single worker definition: a name, a description, a system prompt, and a set of allowed tools. Claude reads the description to decide when to hand off a task, and the work happens in a separate context window.

  • You want a repeatable setup shared across projects or teammates: build a plugin.
  • You want research or a side task kept out of your main conversation: write a subagent.
  • You want both: ship subagents inside a plugin, which is the common pattern for team tooling.
  • You want Claude to follow a documented procedure with bundled scripts: use a Skill, which a plugin can also carry.

Install a plugin

Plugins install from a marketplace. Anthropic develops its official plugins in the claude-plugins-official repository, and the claude-code-plugins marketplace still lists them and installs them from there. You can also configure plugins in a project's .claude/settings.json so anyone who opens the repo gets the same tools.

  • Install Claude Code if you have not already: npm install -g @anthropic-ai/claude-code
  • Open a terminal inside your project and run claude.
  • Type /plugin to open the plugin manager.
  • Add or browse a marketplace, then install the plugin you want.
  • Confirm the plugin loaded by typing one of the slash commands it ships.

What is inside a plugin

Every plugin follows the same layout. Only the manifest is required; a plugin that adds three slash commands is still a plugin.

plugin-name/
  .claude-plugin/
    plugin.json      metadata
  commands/          slash commands (optional)
  agents/            specialized agents (optional)
  skills/            Agent Skills (optional)
  hooks/             event handlers (optional)
  .mcp.json          external tool configuration (optional)
  README.md          documentation

Create your first subagent

Subagents are Markdown files with YAML frontmatter. You can ask Claude to write one for you, or create the file yourself. The description matters more than anything else, because it is the routing hint Claude uses when deciding whether to delegate.

---
name: code-reviewer
description: Reviews diffs for readability, performance, and missing tests. Use after finishing a feature or before opening a pull request.
tools: Read, Grep, Glob
model: sonnet
---

You review code changes. For every issue, explain the problem, show the
current code, and give a concrete fix. Rank findings by severity. Do not
edit files; report only.

Save personal subagents in ~/.claude/agents/ so they follow you into every project, or project subagents in .claude/agents/ so the whole team gets them with the repo. If you would rather not remember the frontmatter, describe the worker to Claude and ask it to create the file.

Keep descriptions short

Claude loads every subagent description into context. When the combined descriptions of your custom subagents pass 15,000 tokens, Claude Code warns you at startup. Move detail into the subagent's system prompt, which only loads when that subagent actually runs.

Built-in subagents you already have

Claude Code ships with subagents that Claude reaches for automatically. They inherit the parent conversation's permission rules, and most run with a restricted tool set.

  • Explore: fast, read-only codebase search. Write and Edit are denied, so it cannot change anything.
  • Plan: research used during plan mode, so exploration output stays out of your main conversation.
  • General-purpose: the catch-all for tasks that need both exploration and edits.
  • Helpers such as claude-code-guide and web-fetch, which handle narrow jobs on cheaper models.

When to use a subagent

  • A side task would flood your conversation with logs, search results, or file contents you will never reference again.
  • You want to enforce a constraint, for example a reviewer that can read but never write.
  • You want routine work on a cheaper model while the main conversation stays on a stronger one.
  • You keep spawning the same kind of worker with the same instructions, which is the cue to write it down once.

Cost and context habits

  • Subagent requests count toward the same usage limits as your main conversation, so a subagent is not free parallelism.
  • Set model: haiku on subagents that do simple, bounded work.
  • Keep the tool list tight. Fewer tools means fewer wrong turns and a smaller prompt.
  • Prefer one well-described subagent over five vague ones, since every description costs context.

Start with one subagent for the task you repeat most, then package it in a plugin once you want that setup to travel with your team.

THE CLAUDE INSIDER

Get the Claude playbook in your inbox.

One weekly email for Claude and Claude Code users. Real workflows, no hype. Subscribe and we send you The Claude Power-User Cheatsheet.

Frequently Asked Questions

RELATED