Skip to main content
skill CX Codex

sub-agents — Claude Code skill: what it does, how to install

Configures specialized Claude Code sub-agents with isolated contexts, dedicated models, and restricted toolsets for specific coding workflows.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add parcadei/Continuous-Claude-v3 --skill sub-agents -a claude-code
Open on GitHub

What sub-agents does

This skill provides reference guides and instructions for setting up isolated Claude Code sub-agents. It covers interactive setup with /agents, CLI definitions via --agents, and Markdown configuration files inside .claude/agents/ or ~/.claude/agents/. The skill operates using Read, Write, and Bash.

Agents are configured with YAML frontmatter specifying name, description, tools, and model, followed by a markdown system prompt. The reference maps Haiku to fast searches, Sonnet to general tasks by default, and Opus to deep reasoning. Project-level definitions in .claude/agents/ take priority over global files in ~/.claude/agents/, which ensures team settings override local user defaults.

What it helps with

  • configure sub-agents with custom system prompts and isolated contexts
  • restrict tool access for specialized review or debugging workflows
  • assign specific models (Haiku, Sonnet, Opus) across different tasks
  • chain agents together to run multi-step code analysis and fixes

Example prompts for the agent

  • How do I create a sub-agent for code review?
  • Configure agent tools and pick the right model
  • What built-in agents exist in Claude Code?

How to install sub-agents

1Skills CLI (Vercel)

npx skills add parcadei/Continuous-Claude-v3 --skill sub-agents -a claude-code

2Manually: put the files in place

~/.claude/skills/sub-agents/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/sub-agents/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about sub-agents

How do I install sub-agents in Claude Code?

Run npx skills add parcadei/Continuous-Claude-v3 --skill sub-agents -a claude-code in your terminal.

What does the sub-agents skill do?

It teaches Claude Code how to define, configure, and chain sub-agents using Markdown files, CLI parameters, or the /agents menu.

Where are agent configuration files stored?

Project configurations go into .claude/agents/, while user-level defaults live in ~/.claude/agents/. Project files take higher priority.

Source text

SKILL.md · MIT
---
name: sub-agents
description: Create and configure Claude Code sub-agents with custom prompts, tools, and models
allowed-tools: [Read, Write, Bash]
user-invocable: false
---

# Sub-Agents Reference

Create specialized AI agents with isolated contexts for specific tasks.

## When to Use

- "How do I create a sub-agent?"
- "Configure agent tools"
- "What built-in agents exist?"
- "Agent model selection"
- "Agent chaining patterns"

## Quick Start

### Interactive (Recommended)
```bash
/agents
```
Opens menu to create, edit, and manage agents.

### Manual Creation
```bash
mkdir -p .claude/agents
cat > .claude/agents/reviewer.md << 'EOF'
---
name: reviewer
description: Code review specialist. Use proactively after code changes.
tools: Read, Grep, Glob, Bash
model: sonnet
---

You are a senior code reviewer focusing on quality and security.

## Review Checklist
- Code clarity and naming
- Error handling
- Security vulnerabilities
- Test coverage
EOF
```

### CLI-Based
```bash
claude --agents '{
  "reviewer": {
    "description": "Code reviewer",
    "prompt": "Review for quality and security",
    "tools": ["Read", "Bash"],
    "model": "sonnet"
  }
}'
```

## Agent File Format

```yaml
---
name: agent-name
description: When/why to use this agent
tools: Read, Edit, Bash      # Optional, inherits all if omitted
model: sonnet                 # sonnet, haiku, claude-opus-4-5-20251101, inherit
---

System prompt content here...
```

## Configuration Fields

| Field | Required | Options |
|-------|----------|---------|
| `name` | Yes | lowercase, hyphens |
| `description` | Yes | When to use |
| `tools` | No | Tool list (inherits all if omitted) |
| `model` | No | `sonnet`, `haiku`, `claude-opus-4-5-20251101`, `inherit` |

## Built-In Agents

| Agent | Model | Tools | Purpose |
|-------|-------|-------|---------|
| General-purpose | Sonnet | All | Complex multi-step tasks |
| Plan | Sonnet | Read-only | Plan mode research |
| Explore | Haiku | Read-only | Fast codebase search |

## Model Selection

| Model | Speed | Best For |
|-------|-------|----------|
| Haiku | Fastest | Search, quick lookups |
| Sonnet | Fast | Most tasks (default) |
| Opus | Slower | Complex reasoning |

## Tool Combinations

```yaml
# Code Reviewer (read-only)
tools: Read, Grep, Glob, Bash

# Debugger
tools: Read, Edit, Bash, Grep, Glob

# Implementer
tools: Read, Write, Edit, Bash, Glob
```

## Example Agents

### Code Reviewer
```yaml
---
name: code-reviewer
description: Reviews code for quality and security. Use after code changes.
tools: Read, Grep, Glob, Bash
model: sonnet
---

Review code for:
- Security vulnerabilities
- Code quality issues
- Missing error handling
- Test coverage gaps

Output findings by priority: Critical > Warning > Suggestion
```

### Debugger
```yaml
---
name: debugger
description: Debug errors and test failures.
tools: Read, Edit, Bash, Grep, Glob
model: inherit
---

Debugging process:
1. Capture error details
2. Identify failure location
3. Form hypotheses
4. Test and verify
5. Implement fix
```

## File Locations

| Type | Location | Priority |
|------|----------|----------|
| Project | `.claude/agents/` | Highest |
| User | `~/.claude/agents/` | Lower |

## Advanced Patterns

### Resumable Agents
```
[Agent returns agentId: "abc123"]

# Later: resume with context
claude -r "abc123" "Continue analysis"
```

### Agent Chaining
```
Use code-analyzer to find issues,
then use optimizer to fix them
```

## Best Practices

1. **Single responsibility** - One clear purpose per agent
2. **Restrict tools** - Only grant what's needed
3. **Clear descriptions** - Action-oriented, include "proactively"
4. **Version control** - Check `.claude/agents/` into git

© parcadei · MIT · parcadei/Continuous-Claude-v3

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set77

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor