Skip to content

Commit 81e9bc2

Browse files
aRustyDevclaude
andcommitted
docs(adr): Add ADR-009 slash command file organization
Documents the finding that: - Claude Code follows symlinks during command discovery - Non-command files must be moved outside commands/ to hide from picker - Schema specs go in docs/src/context/ - Test/example files go in tests/ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 93772c8 commit 81e9bc2

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# ADR-009: Slash Command File Organization
2+
3+
## Status
4+
5+
Accepted
6+
7+
## Context
8+
9+
Claude Code discovers slash commands by scanning `.claude/commands/` for markdown files. This project symlinks `.claude/commands/` to `context/commands/` to organize commands alongside other context components (agents, rules, skills).
10+
11+
We encountered an issue where non-command files (schema specifications, example plans) were appearing in the slash command autocomplete menu. These files:
12+
13+
- `context/commands/context/plan/SCHEMA.md` - Schema specification document
14+
- `context/commands/context/plan/examples/*.md` - Example/test plan files
15+
16+
We needed to hide these from the command picker while keeping them accessible for reference.
17+
18+
## Decision
19+
20+
**Move non-command markdown files outside the commands directory.**
21+
22+
### File Organization
23+
24+
| Content Type | Location | Appears in `/` menu |
25+
|--------------|----------|---------------------|
26+
| Slash commands | `context/commands/**/*.md` | Yes |
27+
| Schema specifications | `docs/src/context/*/schema.md` | No |
28+
| Test/example files | `tests/**/*.md` | No |
29+
30+
### Tested Approaches
31+
32+
| Approach | Result |
33+
|----------|--------|
34+
| Symlinks pointing outside commands/ | **Failed** - symlinks ARE followed |
35+
| Files without YAML frontmatter | **Failed** - still discovered |
36+
| `user-invocable: false` frontmatter | Not tested - would require adding frontmatter to non-commands |
37+
| Move files out of commands/ | **Works** - files not discovered |
38+
39+
### Key Finding
40+
41+
Claude Code follows symlinks during command discovery. A symlink at `context/commands/foo/bar.md` pointing to `../../docs/bar.md` will still include `bar.md` in the command picker.
42+
43+
## Consequences
44+
45+
### Positive
46+
47+
- Clean separation between commands and reference documentation
48+
- Slash command autocomplete only shows actual commands
49+
- Test files live in `tests/` following standard conventions
50+
- Documentation lives in `docs/` for mdbook integration
51+
52+
### Negative
53+
54+
- Commands must use longer paths to reference schema/examples
55+
- Moving files requires updating cross-references
56+
57+
### Implementation
58+
59+
```bash
60+
# Schema specifications
61+
docs/src/context/
62+
└── plan/
63+
└── schema.md
64+
65+
# Test/example files
66+
tests/
67+
└── plans/
68+
├── valid-plan.md
69+
├── invalid-missing-objectives.md
70+
├── invalid-missing-phases.md
71+
└── invalid-phase-missing-files.md
72+
73+
# Commands reference these locations
74+
context/commands/context/plan/create.md → refs docs/src/context/plan/schema.md
75+
context/commands/context/plan/review.md → refs docs/src/context/plan/schema.md
76+
```
77+
78+
## Related
79+
80+
- ADR-001: Primary Data Store (project organization context)
81+
- `.claude/commands/` symlink to `context/commands/`

0 commit comments

Comments
 (0)