subagent-best-practices

Guide Claude Code SubAgent definitions with YAML frontmatter and 3-Phase structure.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/kozyszoo/antigravity-handson --skill subagent-best-practices-kozyszoo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: subagent-best-practices
Source: https://github.com/kozyszoo/antigravity-handson/tree/main/.claude/skills/subagent-best-practices
Command: npx skills add https://github.com/kozyszoo/antigravity-handson --skill subagent-best-practices-kozyszoo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to correctly defining Claude Code's SubAgents (agents/*.md), ensuring they function as intended, communicate effectively, and adhere to best practices.

Core Features & Use Cases

  • YAML Frontmatter: Details on mandatory and recommended fields (name, description, tools, model).
  • 3-Phase Structure: Guidance on implementing initialization, feedback handling, and finalization phases.
  • Context Passing: Best practices for ensuring SubAgents receive necessary information.
  • Tool Selection: Recommendations for choosing appropriate tools for different agent roles.
  • Anti-Patterns: Common pitfalls to avoid in SubAgent definitions.
  • Use Case: A developer struggling with a SubAgent that fails to access tools or pass context can use this Skill to diagnose and fix their agents/*.md file.

Quick Start

Use the subagent-best-practices skill to understand how to define the 'tools' field in an agent's YAML frontmatter.

Frequently Asked Questions about subagent-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define the YAML frontmatter for a Claude Code SubAgent?

To define a Claude Code SubAgent, use YAML frontmatter in `agents/*.md` files by specifying mandatory fields like `name`, `description`, and `tools`, alongside recommended fields such as `model` to ensure proper agent configuration.

What is the mandatory 3-Phase structure for Claude SubAgent definitions?

The mandatory 3-Phase structure for Claude SubAgent definitions consists of initialization, feedback handling, and finalization phases, ensuring agents function as intended and communicate effectively throughout their lifecycle.

Why does my Claude SubAgent fail to access tools or pass context correctly?

Claude SubAgent tool access and context passing failures often stem from incorrect tool selection in YAML frontmatter or missing context passing mechanisms, which can be diagnosed by reviewing anti-patterns in the agent definition.

What are the best practices for context passing in Claude SubAgents?

Best practices for Claude SubAgent context passing involve implementing effective context passing mechanisms within the agent definition to ensure the SubAgent receives all necessary information for its specific role.

How do I choose the right tools for different Claude SubAgent roles?

Choosing the right tools for Claude SubAgent roles requires using optimal tool selection strategies within the YAML frontmatter, matching the specified tools array to the specific tasks the agent needs to perform.

What common anti-patterns should I avoid when defining Claude SubAgents?

Common anti-patterns to avoid when defining Claude SubAgents include incorrect tool usage, missing context, and communication failures, which prevent the agent from functioning as intended.