Subagents are specialized AI assistants defined as Markdown files with YAML frontmatter. Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions. When a task matches a subagent's description, the parent conversation delegates to it automatically, preserving main context while enforcing constraints.
When to use: Isolating high-volume operations (tests, logs), enforcing read-only access for reviewers, routing simple tasks to cheaper models, running parallel research, creating reusable team workflows.
When NOT to use: Tasks requiring frequent back-and-forth, quick targeted changes, workflows needing nested delegation (subagents cannot spawn subagents), latency-sensitive operations where fresh context gathering is costly.
Creates custom subagents for Claude Code with YAML frontmatter configuration in Markdown files. Covers agent scoping (project, user, CLI, plugin), tool access control, model selection, permission modes, skill preloading, and lifecycle hooks. Use when building specialized subagents, configuring tool access, selecting models, setting permission modes, or designing delegation patterns. Use for agent creation, subagent configuration, custom agent setup. Source: oakoss/agent-skills.