agent-test-delegation
Test agent delegation patterns to verify hierarchy and escalation paths. Use after modifying agent structure.
When & Why to Use This Skill
This Claude skill provides a specialized testing framework for validating multi-agent delegation patterns, hierarchy structures, and escalation paths. It helps developers ensure architectural integrity by detecting circular dependencies, verifying reference validity, and maintaining consistent delegation levels within complex agentic workflows, making it essential for maintaining robust multi-agent systems.
Use Cases
- Architectural Validation: Verify agent hierarchies after structural modifications to ensure tasks flow correctly from high-level orchestrators to specialized sub-agents.
- Circular Dependency Detection: Automatically identify and resolve logic loops where agents infinitely delegate tasks back and forth, preventing system deadlocks.
- CI/CD Pipeline Integration: Implement automated testing of agent configurations to catch broken escalation paths or orphaned agents before they reach production.
- Hierarchy Visualization: Generate and analyze delegation trees to troubleshoot 'skip-level' issues and ensure that every agent is properly integrated into the command chain.
| name | agent-test-delegation |
|---|---|
| description | "Test agent delegation patterns to verify hierarchy and escalation paths. Use after modifying agent structure." |
| mcp_fallback | none |
| category | agent |
| user-invocable | false |
Agent Delegation Testing
Verify agent hierarchy, delegation chains, and escalation paths.
When to Use
- After modifying agent hierarchy
- Verifying escalation paths work correctly
- Troubleshooting delegation issues
- CI/CD validation before merge
Quick Reference
# Test all delegation patterns
python3 tests/agents/test_delegation.py .claude/agents/
# Test specific agent delegation
./scripts/test_agent_delegation.sh implementation-specialist
# Visualize delegation tree
./scripts/visualize_delegation.sh
What Gets Tested
Hierarchy levels: Agents delegate to lower levels, escalate to higher levels
Delegation chains: L0 → L1 → L2 → L3 → L4 (proper tree structure)
Circular dependencies: Detect A → B → C → A patterns
Reference validity: All delegates_to/escalates_to targets exist
Level consistency: Level values correct and levels don't skip improperly
Validation Rules
| Rule | Example ✅ | Wrong ❌ |
|---|---|---|
| Delegate downward | L2 → L3 | L3 → L2 |
| Escalate upward | L3 → L2 | L3 → L4 |
| No circles | A → B, A → C | A → B → A |
| Valid refs | Existing agent | Nonexistent agent |
Common Issues
Circular dependency: Agent A → Agent B → Agent A
- Fix: Break circle by restructuring delegation
Skip-level delegation: L2 → L4 (skips L3)
- Fix: Document exception in agent description
Orphaned agent: No other agent delegates to it
- Fix: Add delegation or remove if unused
References
/agents/delegation-rules.md- Complete delegation guidelines.claude/agents/- All agent configurationsCLAUDE.md- Hierarchy documentation