agentleFS
D-SheyD-Shey/autoharness/.agents/skills/code-frugality/SKILL.md

code-frugality

Skill10 starsChanged todayMITView on GitHub

Code minimalism, radical YAGNI, and anti-bloat practices based on the 7-step decision ladder. Use when writing new code, refactoring, fixing bugs, or reviewing changes to keep diffs minimal, eliminate unnecessary abstractions and dependencies, and ensure tests cover risky logic.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 12 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill whenever:

    line 9
  2. Distinctive:

    Before adding new classes or functions, stop at the first rung that fully satisfies the task:

    line 23
  3. Distinctive:

    Does it need to exist?: If a feature or parameter was not requested, omit it.

    line 24
  4. Distinctive:

    Already in this codebase?: Search existing utilities, helpers, and patterns across the repository.

    line 25
  5. Distinctive:

    Standard library or runtime native?: Check standard library modules and platform primitives.

    line 26
  6. Very specific:

    Already installed dependency?: If standard library does not suffice, check existing dependencies in pyproject.toml or package.json.

    line 28
  7. Distinctive:

    Can it be a clear single line?: If a straightforward, readable one-liner solves the problem, use it without extra helper wrappers.

    line 29
  8. Distinctive:

    Minimum viable implementation: Write the smallest possible correct diff.

    line 30
  9. Very specific:

    When an intentional simplification or ceiling is chosen, document it directly in code: # shortcut: <the limit/ceiling>, <when/trigger to …

    line 33
  10. Distinctive:

    Never leave a shortcut without an explicit upgrade trigger (prevent silent rot).

    line 35
  11. Distinctive:

    Never sacrifice the following for the sake of smaller diffs:

    line 38
  12. Distinctive:

    Line Count & Lean Check: Run code review focusing on deletion over addition.

    line 45
  13. Distinctive:

    No Unrequested Dependencies: Verify git diff contains no newly added package dependencies unless explicitly requested.

    line 46
  14. Distinctive:

    Edge Case Test: Ensure any new non-trivial branch or parsing logic has a passing test that fails if the behavior is removed.

    line 47

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

code-frugality

When to use

Use this skill whenever:

  • Designing or implementing any code change (feature, bugfix, refactoring).
  • The temptation arises to introduce new dependencies, wrapper classes, generic abstractions, or speculative configuration options.
  • Reviewing code for bloat, unnecessary complexity, or over-engineering.
  • The user requests a "simple solution", "minimal change", "YAGNI", or complains about bloated diffs.

Steps

1. Pre-Implementation Scoping

  • Inspect the callers, tests, fixtures, and configuration touched by the change before writing code.
  • Understand the exact contract required by the task; identify what data or behaviors cannot be broken.
  • Separate true scope from speculative additions: extra options, premature generalizations, and configurable flags nobody asked for are out of scope.

2. The 7-Step Resolution Ladder

Before adding new classes or functions, stop at the first rung that fully satisfies the task:

  1. Does it need to exist? If a feature or parameter was not requested, omit it. Vague requests get the simplest implementation fulfilling the core requirement.
  2. Already in this codebase? Search existing utilities, helpers, and patterns across the repository. Reuse existing code conventions and abstractions rather than inventing new ones.
  3. Standard library or runtime native? Check standard library modules and platform primitives. Standard library constructs beat external libraries.
  4. Platform/environment capability? Leverage native platform features (e.g. native browser controls, OS signals, standard stream piping).
  5. Already installed dependency? If standard library does not suffice, check existing dependencies in pyproject.toml or package.json. Never add a new dependency for a few lines of logic.
  6. Can it be a clear single line? If a straightforward, readable one-liner solves the problem, use it without extra helper wrappers.
  7. Minimum viable implementation: Write the smallest possible correct diff. Non-trivial logic (branches, parsers, security, money) must leave at least one focused test or assertion.

3. Deliberate Compromises and Debt Marking

  • When an intentional simplification or ceiling is chosen, document it directly in code: # shortcut: <the limit/ceiling>, <when/trigger to upgrade>
  • Never leave a shortcut without an explicit upgrade trigger (prevent silent rot).

4. Non-Negotiable Invariants

Never sacrifice the following for the sake of smaller diffs:

  • Validation at trust boundaries.
  • Error handling that prevents data loss or silent failures.
  • Security checks and cryptographic sanity.
  • Accessibility standards.

How to verify

  1. Line Count & Lean Check: Run code review focusing on deletion over addition. Ask: Can any line in this diff be deleted without breaking tests or the spec?
  2. No Unrequested Dependencies: Verify git diff contains no newly added package dependencies unless explicitly requested.
  3. Edge Case Test: Ensure any new non-trivial branch or parsing logic has a passing test that fails if the behavior is removed.
  4. Shortcut Verification: Scan for # shortcut: comments and confirm every instance specifies both its operational ceiling and an upgrade condition.

Facts found here

  • Ponytail benchmark evidence: applying the decision ladder reduces code volume by ~50% and output tokens by ~45% while increasing test coverage on risky logic to 98%.
  • Python standard library (pathlib, re, json, dataclasses, urllib) eliminates the need for 90% of auxiliary utility libraries in CLI tools.

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.