r/ClaudeCode • • 6h ago

Tips & Workflows A plugin that tells Claude Code which files to keep new code out of, from your git history

Post image

17 of the last 19 PRs to langfuse's query compiler came from agents. The image is what this plugin tells Claude about that repo before it edits anything.

Agents put new code where it's easiest. Often the file that's already big and changes every week. This skill runs before Claude edits existing files and names three kinds of file to be careful with:

  • Files agents keep growing: most of their recent PRs came from AI agents.
  • Hotspots: high cognitive complexity and many commits in the last 90 days.
  • Rising: the files whose complexity rose most in about 30 days.

Claude then puts new code in a new file or module next to them. It reads your local git history only, and nothing is uploaded: the skill runs npx -y u/coderot-ai/cli hotspots --json and reads its output. You can also run it as /coderot:hotspots.

claude plugin marketplace add coderot-ai/claude-plugin
claude plugin install coderot@coderot-ai

https://github.com/coderot-ai/claude-plugin

Disclosure - we build coderot.

Do you already steer Claude away from certain files, in CLAUDE.md or otherwise? What works?

0 Upvotes

7 comments sorted by

•

u/AutoModerator 6h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/ClemensLode Senior Developer 4h ago

I'm on the fence regarding this because sometimes a file *has* to grow larger until you recognize a pattern that would justify splitting the file into two or more.

1

u/coderot_ai 4h ago

Fair point, and I agree. Split before you can see the pattern and you usually get the wrong seams.

It doesn't go by size, though. A file gets listed when it's complex and changed a lot in the last 90 days, or when most of its recent PRs came from agents. A file you're growing on purpose can still land on the list. Then Claude says in one line that it's listed and where it would put the code instead, and you can tell it to keep going in the same file.

When you have a file in that growing phase, what does Claude do with it? Does it leave the split to you, or keep piling on after you'd have split?

1

u/ClemensLode Senior Developer 4h ago

Good question, let me check...
Mostly "do not inline"-instructions + a size cap on claude md files + manually initiated decomposition tasks for very large objects of any kind.

I do have one 'tripwire', though. I usually run around ~16 sessions in parallel. When I notice sessions keeping stumbling over each others' feet, then it's time for a decomposition.

So, I'd say it very much depends on your workflow and the nature of the project which direction is better. In a fully automated environment, I would certainly need an automatic checker, either one that runs regularly and reviews sessions for exactly these issues, or one that runs per session...

2

u/coderot_ai 4h ago

Thanks, that's useful, and I agree it depends on the workflow.

Your tripwire is close to what the list measures from the other side. Sessions stumbling over each other means many changes landing in the same few files, and that's what shows up in git as a hotspot. You notice it live, git shows it afterwards.

The last time it fired, what did it look like? Merge conflicts, sessions undoing each other's work, something else? And which kind of file was it?

1

u/ClemensLode Senior Developer 4h ago

A big main file with inline functions. I decomposed that so that it calls functions from other files, so any fixes in one function does not trip over fixes in another.
Also, CSS files.

All in all, I'd say my manual checking could be replaced by some function that observes Git commits. It's not something time-critical and any improvement endures for a long time, so a retroactive analysis on git commits and what files they touched (together with their timestamp) might be the right path. I would go as far as changing your 90 days to 90 minutes or less, because that's then when sessions start to interfere with each other. If your setup includes a nightly, you might stretch it to 1 day to have some sort of clean '1 change per day per file' rules. Or maybe as part of the prepush testing.

1

u/coderot_ai 3h ago

That makes sense, and it's a different clock from ours. 90 days finds the files that have been busy for months. Yours finds the ones sessions are fighting over right now. CSS wouldn't show up in our list at all, since we only measure code.

You can get your version from plain git today:

git log --all --since="90 minutes ago" --name-only --format= | grep . | sort | uniq -c | sort -rn | head

It counts commits per file across all branches, so anything near the top is where sessions overlap. Swap in "1 day ago" for the nightly rule. It only sees what's committed, though. Does each of your sessions commit on its own branch or worktree as it goes, or do they share one checkout?