agentleFS
aleen42aleen42/PersonalContext/skills/simplify-for-readability/SKILL.md

simplify-for-readability

Skill3 starsChanged 8 months agoMITView on GitHub

Use before any code generation, code modification, or refactor to check whether the implementation can be made simpler, more direct, and more readable without changing behavior. Also use when a user explicitly asks to simplify code, reduce indirection, improve readability, or remove over-engineering.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 7 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer the simplest code that preserves behavior and defaults.

    line 10
  2. Distinctive:

    Delete indirection before adding structure.

    line 18
  3. Distinctive:

    Keep shared state generic, then map it to tool-specific values only where the concrete API is called.

    line 22
  4. Distinctive:

    Do not eagerly overwrite built-in defaults just because shared state exists.

    line 25
  5. Distinctive:

    Do not introduce constants for single-use values, temporary mappings, or values that exist only to make code look more abstract.

    line 28
  6. Very specific:

    Prefer expression-bodied arrows for return-only callbacks.

    line 33
  7. Very specific:

    When an arrow callback only returns one expression, remove braces and return.

    line 34
  8. Very specific:

    Prefer short-circuit expressions for truthy-or-null choices.

    line 36
  9. Very specific:

    When an expression only chooses between a value and null, prefer condition && value over condition ?

    line 37
  10. Very specific:

    Prefer a single expression for small return-only branches.

    line 39
  11. Very specific:

    When a function only selects one value from a short ordered set of conditions, prefer a ternary expression over multiple if returns, as …

    line 40
  12. Distinctive:

    Remove leftover helpers, wrappers, and dead branches.

    line 47
  13. Distinctive:

    Before finishing any code change, explicitly check:

    line 51

≈ “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

Simplify For Readability

Overview

Prefer the simplest code that preserves behavior and defaults.

This skill is for refactors where the main goal is not “more architecture”, but “less to read, less to remember, less to mentally simulate”.

Apply this skill by default before finalizing any code change, even when the user did not explicitly ask for simplification.

Core Rules

  1. Delete indirection before adding structure. Inline helper methods if they are only forwarding state or hiding a one-line operation.
  2. Convert at the boundary when different implementations need different concrete values. Keep shared state generic, then map it to tool-specific values only where the concrete API is called.
  3. Preserve native defaults. Do not eagerly overwrite built-in defaults just because shared state exists. Only apply shared state after it is meaningfully set.
  4. Extract constants only when they are real constants and referenced in multiple places. Do not introduce constants for single-use values, temporary mappings, or values that exist only to make code look more abstract.
  5. Optimize for scanability. A reader should understand the control flow without jumping between multiple tiny helpers.
  6. Prefer expression-bodied arrows for return-only callbacks. When an arrow callback only returns one expression, remove braces and return; for multi-line expressions, break immediately after => and indent the returned expression one level so the expression remains the visual focus.
  7. Prefer short-circuit expressions for truthy-or-null choices. When an expression only chooses between a value and null, prefer condition && value over condition ? value : null.
  8. Prefer a single expression for small return-only branches. When a function only selects one value from a short ordered set of conditions, prefer a ternary expression over multiple if returns, as long as the result is still easy to scan top-to-bottom.

Refactor Order

  1. Identify the real state being shared.
  2. Collapse duplicate storage into the minimum number of variables.
  3. Move conversion logic to the call site or a single lookup helper when implementations differ.
  4. Remove leftover helpers, wrappers, and dead branches.

Required Check

Before finishing any code change, explicitly check:

  • Can one layer of helpers, wrappers, or state be removed?
  • Can the same behavior be expressed more directly?
  • Did any extracted constant, helper, or abstraction actually improve readability?
  • Is there a simpler version that preserves defaults and behavior?

Decision Tests

Choose the version that makes more of these true:

  • Fewer moving parts
  • Fewer state variables
  • Fewer helper hops
  • Fewer places where defaults can be broken
  • Easier to explain in one short paragraph

Session Pattern

Bad:

  • Different call sites each handle the same special case differently
  • Helpers exist only to shuffle values around
  • Shared state and concrete state drift apart

Better:

  • Shared behavior is expressed once
  • Special handling is concentrated at the boundary
  • Readers can see the real control flow without chasing helpers
  • Small ordered choices can be read as one expression instead of several return branches

Anti-Patterns

  • Introducing a manager/helper layer for a single direct assignment
  • Restoring shared state before checking whether the user ever changed it
  • Storing the same idea in multiple representations at once
  • Extracting constants that are not truly constant
  • Extracting single-use constants
  • Extracting constants that make the code longer but not clearer
  • Converting long or side-effecting branches into nested ternaries that are harder to scan than the original if

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.