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 β