Feature Request: Support subdirectories for agent organization (like Skills)

Resolved πŸ’¬ 2 comments Opened Jan 19, 2026 by simfor99 Closed Feb 27, 2026

🎯 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

  1. Large Agent Libraries: Projects with 30+ agents become difficult to navigate
  2. Team Collaboration: Different teams can maintain their own agent categories
  3. Logical Grouping: Group agents by domain (development, testing, security, infrastructure)
  4. 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

  1. Recursive Discovery: Scan agent directories recursively (like skills)
  2. Flat Namespace: Agent name in YAML frontmatter remains unique identifier
  3. Backward Compatible: Existing flat structure continues to work
  4. 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

  1. Modify agent discovery to use recursive directory scan (glob pattern: **/*.md)
  2. Update documentation to reflect subdirectory support
  3. Add examples showing categorized agent structures

---

Version: Claude Code CLI
Priority: Medium (quality-of-life improvement)
Breaking Changes: None (backward compatible)

View original on GitHub β†—

This issue has 2 comments on GitHub. Read the full discussion on GitHub β†—