I'm working on optimizing my workflow with Claude Code for a project that has about 250,000 lines of code. I'm torn between organizing the code into many smaller files (like 500 files with roughly 500 lines each) or a few larger files (around 50 files with about 5,000 lines each). Has anyone here experimented with different file structures and noticed performance differences or issues with Claude Code?
1 Answer
From what I've seen, AI models like Claude tend to perform better with many smaller files, especially if they're typed. In my experience, having a hard limit of about 350 lines per file was crucial for the other systems I worked with; otherwise, they would struggle with token outputs. Claude seems to handle up to 700-800 lines pretty well, which is an improvement!
That's super interesting! I wonder if that's really the case across the board. Take Elm, for instance, which promotes using larger files until you need to break them up. The creator even has a YouTube video titled "The Life of a File" discussing this. I have a big Elm project, and while Claude has been documenting it, I haven't actually worked with Claude on the code yet.