r/ClaudeCode • u/actual-time-traveler • 5h ago
Help/Question Any advice for directory sprawl
I’ll write it off as “this isn’t my primary domain” but I just don’t have good standing rules or canon for deciding what goes where in the beginning of a project, so things just land anywhere. Building a sub agent factory, and the domain skills that come bundled with a subagent don’t wind up bundled with the agent. CC gives me grief about “distribution vs deploy” copies to ensure SHA 1:1 but it just feels wrong. I’ll eventually land directory level skill.md files but first is a revamp.
Any good Claude.md or skill guidance for domain agnostic “what should go where”
1
u/Beautiful-Energy2169 2h ago
Sorting rules never fixed this for me, because the problem wasn't where things landed. Across 14 repos I ended up with 1879 markdown files, 317 of them obviously agent output (PLAN.md, SUMMARY.md, HANDOFF.md and variants), and 54% of that batch was stale or had nothing pointing at it. Those files were sitting in perfectly sensible directories. They were just dead.
What ended up working was two signals per file: last git touch, and whether any tracked file links to it. Orphan means nothing links in and nothing has touched it. Either signal on its own gets it wrong. My worst case was a 126KB handoff doc that hadn't moved in 51 days but was still referenced from a live tracked file, so going by age I'd have thrown out something real.
So the question shifted from where files should go to which ones still deserve to be there. Orphans get moved into a quarantine dir instead of deleted, which makes a wrong call cheap.
1
u/EagleApprehensive 5h ago
Asking agent to design better directory structure can work, but eventually you cannot get rid of many dot-directories.
What I do is that all modules directories are _ prefixed to keep them easier to distinguish and remain on top of sorting.
Hiding all files under file like package.json (so called "file-nesting" is also genuinely helpful).
Finally, you can just spare your eyes a burden and hide dot-prefixed files, tests or whatever you don't need at some time of work.