metal
Skill0 starsChanged 2 months agoMITView on GitHub
The 600-line file limit and how to split a file that hits it. Use when a write is denied by the metal hook, when a file needs splitting into a module directory, or when the user says "metal" or "split this file".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- wolffe/three.js-skillstheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- wolffe/three.js-skills★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Files
metal
One rule, enforced by a hook rather than by asking nicely.
No large files
Hard limit: 600 lines of code per source file. A PreToolUse hook denies any Write over it, and a PostToolUse hook warns on any Edit that pushes a file past it. Do not work around it: no 400-character lines, no heredoc through Bash, no "just for now".
It counts code, not prose. Comments, blank lines and string bodies are stripped before counting, so a file is judged on what you have to read to understand it. Measured across 555 files in seven repos: median comment share 33%, so 600 code lines is roughly 900 raw.
Advisory at 440. Act on it then. At 601 you cut wherever you happen to be standing, which is how one coherent file becomes two incoherent ones.
Test files: 1000, advisory at 800. A suite is a list of cases, not logic that decomposes. Detected by path (test/, tests/, spec/, __tests__/, a test_ prefix, a .test./.spec. in the name), so latest.cpp and contest.c are not tests.
Only code you wrote. Skipped by path segment: node_modules, target, vendor, dist, build, .git, .venv, venv, site-packages, __pycache__, .cache, .next, third_party, plus /tmp and scratchpad/. Nobody maintains a vendored dependency, so "split it into a directory" is a method with no one left to apply it.
The one legal exception. A genuinely cohesive unit may grant itself room, in the file, with a reason:
// metal: allow 700 - one lexer state machine, the transition table does not splitAt most 1000, the reason must be a real sentence, and going past your own number is denied like any other file. If you cannot write the sentence, the file splits.
How to split
- Directory named after the file, one concern per file, one entry point re-exporting them. Rust:
parser.rs→parser/lex.rs+parser/expr.rs+parser/emit.rs, withparser.rskeeping only themod/pub uselines. C:render.c→render/lex.c+render/emit.cbehindrender.h. Python:parser.py→parser/with__init__.pyre-exporting. - Cut along seams that already exist: parse / emit / state / io / errors. Never at an arbitrary line.
- One file, one job. If naming that job takes more than three words, it is two files.
- Eight 80-line files beat one 640-line file. Every file fits on a screen and is findable by its name alone.
metal has no opinion about which language you write in, and no opinion about your build flags.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

