implement-sub-agents
npx machina-cli add skill yu-iskw/google-cloud-observability-plugin/implement-sub-agents --openclawFiles (1)
SKILL.md
2.5 KB
Implement Sub-Agents
Create or update agent files under agents/ with explicit role boundaries, model/tool settings, and delegation patterns.
Workflow
- Assess complexity: Verify that sub-agent is needed (score 7-8). If simpler approach works, use skill instead.
- Define role: Clear purpose, responsibilities, and explicit boundaries
- Set decision authority: What agent can/cannot do autonomously
- Configure tools: Least privilege access to required tools only
- Author/update: Agent markdown with valid frontmatter
- Context strategy: Define how agent manages context (retrieval, summarization, state)
- Plan evaluations: Identify 20-50 test scenarios covering success and failure modes
- Validate: Check frontmatter and agent file structure
- Connect selectively: Link related skills/hooks only when required
Progressive Disclosure
Best Practices (Anthropic Guidelines)
- Complexity decision framework:
../implement-claude-extensions/references/decision-framework.md - Context management patterns:
../implement-claude-extensions/references/context-management.md - Evaluation strategy:
../implement-claude-extensions/references/evaluation-strategy.md
Sub-Agent Design
- Agent frontmatter rules:
references/subagent-frontmatter.md - Tool access strategy:
references/subagent-tools.md - Model selection guidance:
references/subagent-models.md - Permission boundaries:
references/subagent-permissions.md - Delegation patterns:
references/subagent-delegation.md
Validation Tools
- Agent file validator:
scripts/validate-subagent.sh - Frontmatter checker:
scripts/check-subagent-frontmatter.sh
Templates (by Complexity)
- Level 3 - Autonomous Agent (Score 7-8):
assets/templates/subagent-autonomous.md - Base sub-agent template:
assets/templates/subagent-template.md - Read-only sub-agent example:
assets/templates/subagent-readonly.md - Sub-agent with skills example:
assets/templates/subagent-with-skills.md - Sub-agent with hooks example:
assets/templates/subagent-with-hooks.md
Related Skills
- Umbrella routing and architecture:
../implement-claude-extensions/SKILL.md - Agent team coordination:
../implement-agent-teams/SKILL.md
Sources
Source
git clone https://github.com/yu-iskw/google-cloud-observability-plugin/blob/main/.claude/skills/implement-sub-agents/SKILL.mdView on GitHub Overview
Create or update agent files under agents/ with explicit role boundaries, model/tool settings, and delegation patterns. It emphasizes frontmatter correctness, least-privilege tool access, and clearly defined decision authority to ensure safe, auditable sub-agents.
How This Skill Works
Follow the eight-step workflow: assess complexity, define role, set decision authority, configure tools with least privilege, author/update a valid frontmatter-backed agent, define context strategy, plan 20-50 evaluations, and validate structure before connecting.
When to Use It
- You need a sub-agent for complex tasks (score 7-8) but a simpler approach is insufficient
- You must define clear role boundaries, responsibilities, and delegation limits
- You require least-privilege tool access and explicit decision autonomy for the agent
- You are creating or updating agent files under the agents/ directory with proper frontmatter
- You need to validate frontmatter and agent file structure using validators before linking to related skills
Quick Start
- Step 1: Assess complexity and decide if a sub-agent is needed (score 7-8) or use the base skill
- Step 2: Define role, boundaries, and least-privilege tool access; create/edit agent Markdown with valid frontmatter
- Step 3: Run validators (frontmatter checker and sub-agent validator) and connect required related skills
Best Practices
- Use the Complexity decision framework to justify sub-agent creation
- Implement robust context management patterns for retrieval and summarization
- Plan and document 20-50 test scenarios to cover success and failure modes
- Enforce frontmatter rules and run the agent file validator
- Apply least-privilege tool access and explicit delegation boundaries
Example Use Cases
- Sub-agent to monitor telemetry with read-only access to tools and no state modification
- Orchestrator sub-agent that coordinates multiple hooks with restricted permissions
- Autonomous sub-agent template built from assets/templates/subagent-autonomous.md
- Sub-agent wired to leverage related skills via selective hooks
- Validation pipeline using scripts/validate-subagent.sh and frontmatter checker
Frequently Asked Questions
Add this skill to your agents