agentleFS
atgreenatgreen/hackinator/skills/reading-like-prose/SKILL.md

reading-like-prose

Skill1 starsChanged 3 months agoMITView on GitHub

Use when making code a joy to read — a function is hard to follow top to bottom, nesting is deep, the reader has to scroll up to understand, or high-level intent is buried under low-level detail

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a function mixes "what we're doing" with "how a byte gets shifted," extract the *how*.

    line 24
  2. Very specific:

    Prefer a flat sequence of steps to a pyramid of if/else.

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Reading-Like-Prose

Overview

Core principle: Code is read far more often than it's written, and mostly by someone with no context — often you, months later. Structure it for that reader: top-down, one idea at a time, in the order a person would want to learn it. Good code reads like a well-edited paragraph, not a puzzle you assemble by jumping around.

The Three Moves

1. One altitude per function

A function should operate at a single level of abstraction. High-level intent and low-level mechanics in the same body forces the reader to change gears every line.

  • The top-level function reads like a table of contents: named steps, each a call.
  • Details live one level down, each in its own well-named function (see naming-as-design).
  • If a function mixes "what we're doing" with "how a byte gets shifted," extract the how.

2. Read top-down, important-first

Order code the way a newspaper orders a story: headline first, details below.

  • The thing the reader most wants to know goes first — the main path, the answer.
  • Supporting detail comes after, so the reader never scrolls up to understand what they're reading.
  • Define-before-use is a compiler's need, not a human's. Where the language allows, order for the human.

3. Flatten the happy path

Deep nesting hides the main story inside a staircase of conditions.

  • Return early on the exceptional cases — guard clauses at the top — so the happy path runs down the left margin, unindented.
  • Handle errors and edge cases and get them out of the way, rather than wrapping the real work inside them.
  • Prefer a flat sequence of steps to a pyramid of if/else.
# staircase — the real work is buried three levels deep
if user:
    if user.active:
        if user.has_permission:
            do_the_thing()

# prose — exceptions handled and dismissed; the point runs down the margin
if not user:               return denied("no user")
if not user.active:        return denied("inactive")
if not user.has_permission: return denied("forbidden")
do_the_thing()

Quick Reference

SymptomMove
Reader scrolls up to understandReorder important-first
Function changes altitude mid-bodyExtract the low-level part
Three-deep if staircaseGuard clauses, return early
"What does this whole block do?"Extract it and name it
Detail before the main pointPut the point first

Common Mistakes

  • Extracting into badly-named fragments. Splitting a function into helper1/helper2 moves the confusion, it doesn't cure it. Extraction only pays off with names that read (naming-as-design).
  • Flattening past clarity. Ten early returns can be as hard to follow as deep nesting. The goal is a readable story, not a metric of zero indentation.
  • Reordering that fights the language. Some languages need define-before-use. Order for the human within what the language allows; don't break the build for aesthetics.
  • Turning prose into golf. Collapsing readable steps into one dense expression is the opposite of this skill. Elegance is low effort to read, not fewest lines.

Relationship to Other Skills

This is the whittler's third pass. It depends on naming-as-design (extraction is only worthwhile with good names) and often follows subtraction-first (flattening removes structure outright rather than reorganizing it).

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.