From ai-helpers
Claude Code subagent lifecycle: creation, configuration, evaluation, and troubleshooting. Invoke whenever task involves any interaction with Claude Code subagents — designing, debugging, iterating, or deciding when to delegate work to isolated agent contexts.
npx claudepluginhub xobotyi/cc-foundry --plugin ai-helpersThis skill uses the workspace's default tool permissions.
Manage the full lifecycle of Claude Code subagents: creation, evaluation, iteration, and troubleshooting.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Automates semantic versioning and release workflow for Claude Code plugins: bumps versions in package.json, marketplace.json, plugin.json; verifies builds; creates git tags, GitHub releases, changelogs.
Manage the full lifecycle of Claude Code subagents: creation, evaluation, iteration, and troubleshooting.
**Subagent prompts are system prompts.** Before creating or improving a subagent, invoke `prompt-engineering` to load instruction design techniques.Skill(ai-helpers:prompt-engineering)
Skip only for trivial edits (typos, formatting).
${CLAUDE_SKILL_DIR}/references/spec.md] All fields with constraints, hooks
schema, CLI-defined agents, storage locations${CLAUDE_SKILL_DIR}/references/creation.md] Detailed process, common agent
type templates, proactive delegation${CLAUDE_SKILL_DIR}/references/evaluation.md] 5-dimension scoring rubric with
weights, testing protocol (5 levels), benchmarking${CLAUDE_SKILL_DIR}/references/iteration.md] Prompt refinement techniques, A/B
testing, version control, redesign criteria${CLAUDE_SKILL_DIR}/references/troubleshooting.md] Diagnostic steps, error message
catalog, debug mode${CLAUDE_SKILL_DIR}/references/patterns.md] Full agent examples,
pipeline/parallel/master-clone patterns, multi-agent coordination, agent team lifecycle and patternsRead the relevant reference for extended depth. The rules below are sufficient for correct work without loading references.
Use subagents when:
Use main conversation when:
Use skills instead when:
.claude/agents/my-agent.md # Project-level
~/.claude/agents/my-agent.md # User-level
---
name: my-agent
description: What it does. When to use it.
tools: Read, Grep, Glob
model: sonnet
---
You are a [role]. When invoked:
1. [First step]
2. [Second step]
3. [Final output format]
--agents CLI flag (session only).claude/agents/ (project)~/.claude/agents/ (user)When names collide, higher priority wins.
name< or > characters.md)descriptionClaude sees ONLY name and description when deciding to delegate. The body loads AFTER delegation. This makes the
description the highest-leverage field.
Formula:
[What it does in 1 sentence]. [When to use it — specific trigger context].
Rules:
< or > characters.Good:
description: "Expert code review specialist. Proactively reviews code for
quality, security, and maintainability. Use immediately after writing
or modifying code."
description: "PostgreSQL database expert for query optimization and schema
design. Use when working with .sql files or database performance issues."
Bad:
description: "Helps with code" # Too vague
description: "Review code. Steps: 1. Read 2..." # Execution details
description: "Code review. Keywords: review..." # Keyword stuffing
toolsAllowlist of tools the subagent can use. If omitted, inherits ALL tools from the main conversation (including MCP tools). Be intentional — don't leave it blank unless you want full access.
Principle: grant minimum necessary permissions.
Read-only (reviewers, analysts): Read, Grep, GlobResearch (with web): Read, Grep, Glob, WebFetch, WebSearchCode writers: Read, Write, Edit, Bash, Glob, GrepDocumentation: Read, Write, Edit, Glob, Grep, WebFetchAvailable built-in tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch, Task (main agent
only), NotebookEdit.
Use disallowedTools when you want most tools but need to exclude a few.
modelhaiku: Quick searches, docs, simple analysis — fast and cheapsonnet: Everyday coding, debugging, refactoringopus: Architecture decisions, security audits, complex reasoninginherit: Match parent model (default if omitted)permissionModedefault: Standard permission checkingacceptEdits: Auto-accept file editsdontAsk: Auto-deny prompts (allowed tools still work)bypassPermissions: Skip all permission checksplan: Plan mode (read-only exploration)Security rules:
plan mode for read-only agents — enforce safety at the permission level, not just in the prompt.bypassPermissions skips ALL checks including file writes and command execution. Only use for trusted, well-tested
agents.bypassPermissions, child agents inherit it and cannot override to a more restrictive mode.skillsSkills to inject into the subagent's context at startup. Subagents don't inherit skills from parent — list them explicitly.
skills:
- api-conventions
- error-handling-patterns
hooksLifecycle hooks scoped to this subagent. Supported events: PreToolUse, PostToolUse, Stop (converted to
SubagentStop).
Full hook schema and examples: see ${CLAUDE_SKILL_DIR}/references/spec.md.
Everything after the frontmatter becomes the subagent's system prompt. Subagents receive ONLY this prompt plus basic environment details — not the full Claude Code system prompt.
You are a [role] specializing in [domain].
## When Invoked
1. [First action]
2. [Second action]
3. [Continue until complete]
## Guidelines
- [Guideline 1]
- [Guideline 2]
## Constraints
- [Boundary 1 — what NOT to do]
## Output Format
[Specify exact structure with example]
Description is the trigger. Claude sees ONLY name + description when deciding to delegate. Vague descriptions
cause wrong triggers. Specific descriptions enable correct delegation.
Single responsibility. Each subagent excels at ONE task. Don't create Swiss Army knife agents — they're hard to trigger correctly and mediocre at everything.
Minimal tool access. Grant only necessary permissions. Read-only agents don't need Edit/Write. Excess tools invite scope creep.
Clear handoffs. Design subagents to return actionable summaries, not raw data dumps. The parent agent (or user) should be able to act on the output immediately.
Context efficiency. Subagents should use Grep before Read, stop when they have enough information, and return synthesized findings. Verbose returns consume parent context.
When work exceeds a single subagent's context window, needs sustained parallelism, or requires cross-session coordination — use agent teams instead of standalone subagents.
Teams vs standalone subagents:
SendMessage summaries, each teammate has
its own context windowCore mechanics:
TeamCreate — creates a named teamTaskCreate — adds tasks to the team's shared task list (with optional blockedBy dependencies)team_name parameter — they join as teammates, claim tasks, coordinate via SendMessageTeammateIdle hooks can inject follow-up workDesign rules:
TaskOutput. Teammates communicate via short SendMessage summaries and share task lists.blockedBy for sequencing. When task B depends on task A's output, set the dependency explicitly rather than
relying on execution order.When to use teams:
Architecture patterns, team coordination examples, and pipeline designs: see
${CLAUDE_SKILL_DIR}/references/patterns.md.
When evaluating a subagent, assess these five dimensions:
Scoring: 4.5+ excellent, 3.5-4.4 good, 2.5-3.4 needs revision, <2.5 redesign. Full rubric with testing protocol: see
${CLAUDE_SKILL_DIR}/references/evaluation.md.
Description is too narrow or name has a typo. Broaden the description, add "use proactively", and verify the file loads
with /agents.
Description is too vague or overlaps with other agents. Narrow the scope, add explicit boundaries: "Security review for auth code only. NOT for general code review."
No format specification in the prompt, or no example. Add an explicit ## Output Format section with a concrete example
of the expected structure.
Workflow isn't explicit enough. Add numbered steps with "IN ORDER", a completion checklist ("Before returning, verify:"), and explicit completion criteria.
Tools are too permissive or prompt doesn't set boundaries. Restrict the tools list and add a ## Constraints section
with explicit prohibitions.
No efficiency guidance. Add: "Use Grep to locate relevant code BEFORE reading entire files. Stop searching once you have sufficient information. Return a concise summary (max 500 words)."
Detailed diagnostic steps, error messages, and debug mode: see ${CLAUDE_SKILL_DIR}/references/troubleshooting.md.
Before deploying a subagent:
name is lowercase with hyphens, no "anthropic" or "claude"description explains what AND when (under 1024 chars)description has no execution instructionstools is minimal (only what's needed)model matches task complexityprompt-engineering — Load first for instruction design techniques (subagent prompts are system prompts)skill-engineering — Skills and subagents complement each other; skills run in main context, subagents run in
isolationclaude-code-sdk — Consult for API/configuration details