Feature Request: Support subdirectories for agent organization (like Skills)
๐ฏ Feature Request: Subdirectory Support for Agents
Summary
Support organizing Agents in subdirectories (e.g., agents/development/code-reviewer.md), similar to how Skills already support subdirectories (e.g., skills/development/code-review/SKILL.md).
๐ Current State
| Feature | Subdirectory Support | Example Structure |
|---------|---------------------|-------------------|
| Skills | โ
Yes | skills/{category}/{skill-name}/SKILL.md |
| Agents | โ No | agents/{agent-name}.md (flat only) |
๐ Current Behavior
Agents must be placed directly in ~/.claude/agents/ or .claude/agents/:
~/.claude/agents/
โโโ coder.md
โโโ mcp-doctor.md
โโโ gsd-planner.md
โโโ gsd-executor.md
โโโ gsd-verifier.md
โโโ codebase-analyst.md
โโโ playwright-test-planner.md
โโโ playwright-test-generator.md
โโโ security-scanner.md
... (34+ agents in flat structure)
๐ฏ Desired Behavior
Agents should support subdirectories for better organization:
~/.claude/agents/
โโโ development/
โ โโโ coder.md
โ โโโ codebase-analyst.md
โ โโโ spec-compliance-coach.md
โโโ testing/
โ โโโ playwright-test-planner.md
โ โโโ playwright-test-generator.md
โ โโโ e2e-behavior-simulator.md
โโโ security/
โ โโโ security-scanner.md
โ โโโ db-migration-validator.md
โ โโโ accessibility-auditor.md
โโโ infrastructure/
โ โโโ mcp-doctor.md
โ โโโ daily-summary-agent.md
โโโ gsd/
โโโ gsd-planner.md
โโโ gsd-executor.md
โโโ gsd-verifier.md
โโโ gsd-debugger.md
๐ก Use Cases
- Large Agent Libraries: Projects with 30+ agents become difficult to navigate
- Team Collaboration: Different teams can maintain their own agent categories
- Logical Grouping: Group agents by domain (development, testing, security, infrastructure)
- Consistency: Aligns agent organization with existing skill organization patterns
๐ Reference: Skills Already Support This
From skills.md documentation:
"Structure multi-file Skills with detailed documentation in separate files" `` my-skill/ โโโ SKILL.md (required - overview and navigation) โโโ reference.md (detailed API docs) โโโ examples.md ``
โ Proposed Implementation
- Recursive Discovery: Scan agent directories recursively (like skills)
- Flat Namespace: Agent
namein YAML frontmatter remains unique identifier - Backward Compatible: Existing flat structure continues to work
- Priority Order: Same as skills (Enterprise > Personal > Project > Plugin)
๐ Example Agent in Subdirectory
File: ~/.claude/agents/development/coder.md
---
name: coder
description: Implementation specialist for writing code based on specifications
tools: All tools
model: sonnet
---
You are a coder agent specializing in implementing features...
Invocation (unchanged):
Use the coder agent to implement feature X
Task("coder", "implement this feature")
๐ฏ Benefits
- โ Scalability: Supports 100+ agents without clutter
- โ Consistency: Matches skill organization pattern
- โ Backward Compatible: No breaking changes
- โ Developer Experience: Easier navigation and maintenance
๐ง Minimal Implementation
- Modify agent discovery to use recursive directory scan (glob pattern:
**/*.md) - Update documentation to reflect subdirectory support
- Add examples showing categorized agent structures
---
Version: Claude Code CLI
Priority: Medium (quality-of-life improvement)
Breaking Changes: None (backward compatible)
This issue has 2 comments on GitHub. Read the full discussion on GitHub โ