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

Status Closed โ€” not planned
Maintainer reply None cached
Activity 2 comments ยท opened Jan 19, 2026 ยท 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 โ†—