agentleFS
danmestasdanmestas/wardrobe/skills/carmack/SKILL.md

carmack

Skill4 starsChanged 7 months agoMITView on GitHub

The John Carmack lens: minimize the mutable state you have to reason about, do the simple thing before the clever one, and treat correctness tooling — static analysis, warnings-as-errors, determinism — as non-negotiable. Apply this on sprawling mutable state, "we'll clean it up later," debugging by print- statement whack-a-mole, silenced compiler warnings, nondeterministic or non-reproducible behavior, premature abstraction, perf work that skips measurement, and any "what should we actually work on" prioritization call. Trigger even when Carmack isn't named — the smell is code whose full set of states you can't hold in your head, and effort that isn't ruthlessly focused.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask: how much mutable state does this touch?

    line 48
  2. Distinctive:

    Prefer pure functions and local reasoning.

    line 50
  3. Distinctive:

    Do the straightforward thing first.

    line 54
  4. Distinctive:

    Ask: is this abstraction paying for itself right now, or is it speculative?

    line 56
  5. Distinctive:

    Ask: are warnings treated as errors?

    line 64
  6. Distinctive:

    Ask: given the same inputs, does this produce the same result and the same path?

    line 73
  7. Distinctive:

    Ask: have you profiled, or are you optimizing what *feels* slow?

    line 81
  8. Distinctive:

    Ask: is this the highest-leverage thing to work on right now, or just the nearest?

    line 89
  9. Distinctive:

    Ask: is this being kept because it's right, or because it was expensive to write?

    line 97
  10. Distinctive:

    Don't: treat static analysis as a metric to game.

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

The Carmack Lens

John Carmack ships things that have to run correctly at 90 frames a second on hardware he doesn't control. His engineering is the meeting of two habits most people only have one of: deep empathy for the machine at the bottom, and ruthless simplicity and focus at the top. This skill encodes both as questions.

The through-line: you can only guarantee behavior you can reason about, so the whole discipline is about shrinking what you have to reason about — fewer states, simpler code, deterministic execution — and letting tools catch the rest.

Iron Law

You should be able to hold the complete set of states this code can reach in your head. Anything that defeats that — hidden mutation, action at a distance, nondeterminism — is not a style nit. It is the bug you haven't found yet.


The questions

1. Can you enumerate every state this can be in?

Most bugs are the program reaching a state the author never pictured. Shrink the state space until the whole thing is enumerable.

  • Ask: how much mutable state does this touch? Could it be a pure function of its inputs? If you inlined the callees, could you see every state in one screen?
  • Prefer pure functions and local reasoning; push mutation to the edges. When in doubt, make the flow of data explicit rather than hiding it in shared state.

2. Is this the simple version, or the clever one?

Do the straightforward thing first. Clever earns its place only against a measured, demonstrated need — not a hypothetical one.

  • Ask: is this abstraction paying for itself right now, or is it speculative? Would a dumb, obvious implementation be good enough and easier to verify?
  • Red flags: a framework introduced for a problem you don't yet have; indirection whose only justification is "we might need it later."

3. Is the machine trying to tell you something you've silenced?

The compiler and the analyzer see failure modes review never will. Treat their output as signal, not noise.

  • Ask: are warnings treated as errors? Is static analysis actually run, aggressively, and its findings driven to zero? Carmack has called adopting static analysis the single most valuable thing he did as a programmer.
  • Red flags: a wall of ignored warnings; "that warning is a false positive" without proof; analysis tooling installed but not enforced.

4. Can you reproduce it deterministically?

A bug you can reproduce on demand is nearly fixed; one you can't is a research project. Design for determinism and replay.

  • Ask: given the same inputs, does this produce the same result and the same path? Can you capture and replay a session to reproduce a failure exactly?
  • Nondeterminism (unordered iteration, uninit reads, race-dependent output) is worth hunting down for its own sake, because it destroys reproducibility everywhere else.

5. Are you measuring, or guessing?

On anything performance-sensitive, intuition is a hypothesis, not an answer. Profile, know the machine, let the data pick the target.

  • Ask: have you profiled, or are you optimizing what feels slow? Do you know the actual cost — cache misses, allocations, syscalls — or are you guessing?
  • Corollary: don't micro-optimize before you've measured, and don't optimize code that isn't hot. Understanding the machine is the point, not cleverness for its own sake.

6. Is this even the thing worth doing?

Focus is a first-class engineering skill: it is deciding what not to do. Being busy is not the same as making the important thing happen.

  • Ask: is this the highest-leverage thing to work on right now, or just the nearest? What are we doing that we could stop doing entirely?
  • Applies to features, refactors, and abstractions alike — the cheapest code to maintain is the code you talked yourself out of writing.

7. Are you being precious about code that should be deleted?

Prototypes are for learning and then throwing away. Don't let sunk cost keep a design alive past the point it's earned.

  • Ask: is this being kept because it's right, or because it was expensive to write? Would you write it this way today knowing what you now know?

How to apply

In review: walk the diff through the questions. The highest-value findings are almost always #1 (unnecessary mutable state you can't fully reason about) and #3 (a correctness tool being ignored). Phrase findings as the reduction: "This shares mutable x across three call paths — thread it as a parameter so each path's state is visible," not just "too much state."

In design: state the simplest implementation that could work first. Justify every departure from it with a measured need (perf, correctness) rather than a predicted one. Decide explicitly what you are not building.

Output shape: findings ranked by how much they shrink the state you must reason about, plus any silenced-tooling issues (those are near-automatic fixes). Keep it focused — this lens is partly about not doing unnecessary work.

Anti-patterns (when NOT to over-apply)

  • Don't weaponize "simple" to dodge a genuinely deep abstraction that would hide real complexity — that's the ousterhout lens, and it wins there.
  • Don't inline everything into unreadable megafunctions in the name of "seeing all the state." Local reasoning is the goal; readability is a constraint on it.
  • Don't micro-optimize before profiling. #5 forbids the very thing people cite it to justify.
  • Don't treat static analysis as a metric to game. It serves correctness, not a number.

Complements

  • hickey — simple-vs-easy at the design level; Carmack is the machine-and-state level
  • ousterhout — complexity and deep modules (where "simple" should yield to abstraction)
  • tigerstyle — assertions, limits, safety; a close ally on correctness tooling
  • bellard — minimal artifact; Carmack minimizes state you must reason about

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.