Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add gg-mo/repo-hygiene --skill keeping-files-smallgit clone --depth 1 https://github.com/gg-mo/repo-hygieneWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/gg-mo/repo-hygiene/keeping-files-small)<a href="https://agentmods.dev/skills/gg-mo/repo-hygiene/keeping-files-small"><img src="https://agentmods.dev/badge/skills/gg-mo/repo-hygiene/keeping-files-small/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/gg-mo/repo-hygiene/keeping-files-small"><img src="https://agentmods.dev/badge/skills/gg-mo/repo-hygiene/keeping-files-small.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00045 | $0.00945 |
| Opus 5 | $0.00023 | $0.00473 |
| Sonnet 5 | $0.00009 | $0.00189 |
| Haiku 4.5 | $0.00005 | $0.00094 |
Grade A, and why
keeping-files-small scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Keeping Files Small
Overview
Large files hide bugs. A 1200-line file is a god-class waiting to happen: navigation is slow, blast radius for any change is huge, merge conflicts cluster, and reviewers skim because there's too much to read. The honest agent default is "just add it where it fits, splitting is separate work" — but the next change keeps adding, and a year later you have core.py at 2000 lines.
Core principle: A file should have one job. When it grows past ~400 lines, that's a signal it's grown a second job that should live elsewhere.
Thresholds (Rules of Thumb)
| Lines | Stance |
|---|---|
| <200 | Comfortable |
| 200–400 | Fine; watch the trend |
| 400–600 | Flag it — propose a split before adding more |
| 600+ | Don't add to it without splitting first |
These are rough. A 500-line file of cohesive logic is fine; a 200-line file with 4 unrelated concerns is worse. Apply judgment around the limit, don't blindly enforce.
When To Use
- About to add a function/class to a file already >400 lines
- Your edit pushed a file past 600 lines
- Proposing where new code should live (greenfield decision)
- During the orientation pass when one file dwarfs the rest
Decision Flow
digraph file_size {
"About to add to a file" [shape=diamond];
"File <400 lines after?" [shape=diamond];
"Just add it" [shape=box];
"File 400–600 after?" [shape=diamond];
"Add + flag size + propose split" [shape=box];
"Stop. Propose split FIRST." [shape=box];
"About to add to a file" -> "File <400 lines after?";
"File <400 lines after?" -> "Just add it" [label="yes"];
"File <400 lines after?" -> "File 400–600 after?" [label="no"];
"File 400–600 after?" -> "Add + flag size + propose split" [label="yes"];
"File 400–600 after?" -> "Stop. Propose split FIRST." [label="no — >600"];
}
How to Propose a Split
Propose, don't unilaterally restructure:
- Identify the natural seams — function clusters that share helpers, types, or a concept.
- Sketch the new files — names + what moves into each.
- Show the user before doing it:
"This file is 720 lines. I'd suggest splitting it into
<fileA>(handles X) and<fileB>(handles Y). OK to do that before adding the feature?" - If yes — do the split as its own commit, no feature changes mixed in. Then add the new code in a follow-up commit.
- If no — add to the existing file but flag the tech-debt explicitly in your reply.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 11d ago First seen · 78 lines · 45 tokens per session scan A e33d0bcd592a
keeping-files-small is a skill published in the GitHub repository gg-mo/repo-hygiene (3 stars, last pushed 4mo ago), licensed MIT. It adds 45 tokens to every session and 945 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
recipe-front-review
Reviews completed frontend implementation for governing-source compliance, scope economy, repository quality, and security, then applies user-approved React corrections.
new-skill
Scaffold a new brooks-lint analysis skill so it passes npm run validate and npm run evals on the first try — generates skills/{name}/SKILL.md (with the mandatory "Do NOT trigger for:" clause and a Process section citing guide step ranges) plus skills/{name}/{name}-guide.md (sequentially numbered steps), then appends…
release
Cut a brooks-lint release: set the version in package.json, propagate it across all four plugin manifests and every version-bearing text file (README badges, docs site metadata), write the CHANGELOG entry, validate, then commit, push, tag, and publish the GitHub release. Triggers when the maintainer asks to "release"…
brooks-audit
Architecture audit that maps module dependencies, checks layering integrity, and flags structural decay across a codebase, drawing on twelve classic engineering books. Triggers when: user asks to audit architecture, review folder/module structure, check for circular imports, understand how the codebase is organized…
brooks-sweep
Full-sweep mode: runs a unified analysis across all quality dimensions — code decay, architecture, tech debt, and test quality — then applies fixes directly to the codebase. Safe changes are auto-applied; risky changes are confirmed before execution. Drawing on twelve classic engineering books. Triggers when: user…
brooks-test
Test quality review drawing on twelve classic engineering books — with primary focus on xUnit Test Patterns, The Art of Unit Testing, How Google Tests Software, and Working Effectively with Legacy Code — that diagnoses structural problems in an existing test suite: brittleness, mock abuse, coverage illusions, slow…