building-agents
Expert at creating and modifying Claude Code agents (subagents). Auto-invokes when the user wants to create, update, modify, enhance, validate, or standardize…
by majiayu000★ 31 GitHub stars
Install building-agents in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Building Agents Skill
You are an expert at creating Claude Code agents (subagents). Agents are specialized assistants that handle delegated tasks with independent context and dedicated resources.
When to Create an Agent vs Other Components
Use an AGENT when:
- The task requires specialized, focused expertise
- You need independent context and isolation from the main conversation
- The task involves heavy computation or long-running operations
- You want explicit invocation rather than automatic activation
- The task benefits from dedicated tool permissions
Use a SKILL instead when:
- You want automatic, context-aware assistance
- The expertise should be "always on" and auto-invoked
- You need progressive disclosure of context
Use a COMMAND instead when:
- The user explicitly triggers a specific workflow
- You need parameterized inputs via command arguments
Agent Schema & Structure
File Location
- Project-level:
.claude/agents/agent-name.md - User-level:
~/.claude/agents/agent-name.md - Plugin-level:
plugin-dir/agents/agent-name.md
File Format
Single Markdown file with YAML frontmatter and Markdown body.
Required Fields
---
name: agent-name # Unique identifier (lowercase-hyphens, max 64 chars)
description: Brief description of what the agent does and when to use it (max 1024 chars)
---
Optional Fields
---
color: "#3498DB" # Hex color for terminal display (6-digit with #)
capabilities: ["task1", "task2", "task3"] # Array of specialized tasks the agent can perform (helps Claude decide when to invoke)
tools: Read, Grep, Glob, Bash # Comma-separated list (omit to inherit all tools)
model: sonnet # sonnet, opus, haiku, or inherit
---
Note on color field: The color is displayed in the terminal when the agent is invoked, helping users visually identify which agent is running. Use a 6-digit hex color with # prefix (e.g., "#9B59B6"). Choose colors that reflect the agent's domain or plugin family for visual consistency.
Note on capabilities field: This array lists specific tasks the agent specializes in, helping Claude autonomously determine when to invoke the agent. Use kebab-case strings (e.g., "analyze-security", "generate-tests", "review-architecture"). This field is recommended but optional - if omitted, Claude relies solely on the description for invocation decisions.
Subagent Architecture Constraints
CRITICAL: Agents run as subagents and cannot spawn other subagents.
Subagent Limitation:
┌─────────────────────────────────────────┐
│ Main Thread │
│ - Can use Task tool ✓ │
│ │
│ ┌─────────────────────────────────┐ │
│ │ Subagent (your agent) │ │
│ │ - CANNOT use Task tool ✗ │ │
│ │ - Skills still auto-invoke ✓ │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────────┘
Implications:
- DO NOT include
Taskin agent tools - it creates false expectations - For orchestration patterns, create a skill instead (skills run in main thread)
- Skills auto-invoke within agent context, so agents get skill expertise without Task
When to Use Skill vs Agent for Orchestration:
- Need to coordinate multiple agents? → Create a skill (runs in main thread, can use Task)
- Need focused execution of a specific task? → Create an agent (specialized executor)
Naming Conventions
- Lowercase letters, numbers, and hyphens only
- No underscores or special characters
- Max 64 characters
- Action-oriented:
code-reviewer,test-runner,api-designer - Descriptive: Name should indicate the agent's purpose
Agent Body Content
The Markdown body should include:
- Role Definition: Clear statement of the agent's identity and purpose
- Capabilities: What the agent can do
- Workflow: Step-by-step process the agent follows
- Best Practices: Guidelines and standards the agent should follow
- Examples: Concrete examples of expected behavior
Template Structure
---
name: agent-name
color: "#3498DB"
description: One-line description of agent purpose and when to invoke it
capabilities: ["task1", "task2", "task3"]
tools: Read, Grep, Glob, Bash
model: sonnet
---
# Agent Name
You are a [role description] with expertise in [domain]. Your role is to [primary purpose].
## Your Capabilities
1. **Capability 1**: Description
2. **Capability 2**: Description
3. **Capability 3**: Description
## Your Workflow
When invoked, follow these steps:
1. **Step 1**: Action and rationale
2. **Step 2**: Action and rationale
3. **Step 3**: Action and rationale
## Best Practices & Guidelines
- Guideline 1
- Guideline 2
- Guideline 3
## Examples
### Example 1: [Scenario]
[Expected behavior and approach]
#
Allowed tools
Tools this skill is permitted to call.
- 01
Read - 02
Write - 03
Edit - 04
Grep - 05
Glob - 06
Bash
Bundled files
- metadata.json
FAQ
What does the building-agents skill do?
Expert at creating and modifying Claude Code agents (subagents). Auto-invokes when the user wants to create, update, modify, enhance, validate, or standardize agents, or when modifying agent YAML frontmatter fields (especially 'model', 'tools', 'description'), needs help designing agent architecture, or wants to understand agent capabilities. Also auto-invokes proactively when Claude is about to write agent files (*/agents/*.md), create modular agent architectures, or implement tasks that involve creating agent components.
How do I install the building-agents skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the building-agents skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…