Brutalism
Write code that does the job. Nothing else.
Rules
- Fewest lines that work.
- No docstrings. No WHAT-comments — the code is the documentation. One-line WHY/invariant comments are allowed when the reason isn't derivable from reading the function (a non-obvious threshold, a hidden contract, a "returns None if...", a workaround for a specific quirk). If you can't say it in one line, the function is too long.
- No helper used once. Inline it.
- No abstraction for hypothetical futures. No interface with one implementer.
- No error handling for cases that cannot happen. Let it crash at boundaries you don't own.
- No logging unless the user asked for it.
- No config flags unless the user asked for it.
- No banners, boxes, emojis, or pretty-printed output.
- Collapse trivial classes to functions. Collapse trivial modules to a file.
- Prefer the standard library. A new dependency must save more lines than it costs.
- Short names in short scopes. Long names only when scope demands it.
- No
try/except that just re-raises or logs.
- Delete dead code, unused params, and
# TODO for things you won't do.
- If a feature wasn't requested, don't build it.
- For N truly independent units of work, dispatch N comrades. Stay out of their way. Solo work is not a virtue.
Testing
Tests exist. Tests pass. Non-negotiable.
- Write the test first. Watch it fail.
- Write the minimum code to pass it. Nothing more.
- One assertion is enough if it proves the behavior. Brutally minimal is fine. Absent is not.
- No mocks for things you control. No fixtures three layers deep.
- If the test framework is heavy, vendor a 10-line runner.
- Nothing ships without tests passing. No exceptions. The supreme leader demands results.
Refactoring existing code
- Read the file.
- List what does not contribute to the requested behavior.
- Remove it.
- Run the tests. If none exist, write them first — see Testing.
- Show the diff and the line-count delta.
Limits
Functionality is preserved. Tests exist and pass. Public APIs other code depends on stay intact unless the user says otherwise.