agentleFS
hi-donwihi-donwi/Donwi-Skills/skills/code-simplification/SKILL.md

code-simplification

Skill0 starsChanged 10 days agoMITView on GitHub

Simplify code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be.

101 other projects use a version of this, 72 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use accessibility-engineering, constraint-driven-development and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • steven123397Skill

    accessibility-engineering

    Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.

    Also in 4 projects that use this

  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 22 projects that use this

  • xfstudioSkill

    postmortem-writing

    Write effective blameless postmortems with root cause analysis, timelines, and action items. Use when conducting incident reviews, writing postmortem documents, or improving incident response processes.

    Also in 3 projects that use this

  • MicrosoftSkill

    ask-emil

    Ask which skill or flow fits your situation. A router over the skills in this repo.

    Also in 3 projects that use this

  • MicrosoftSkill

    choreograph

    Coordinate several elements that animate together — decide what moves, in what order, how much they overlap, and what stays still — so a group reads as one intentional motion instead of a pile of separate animations. Use when building or fixing a staggered list, a hero entrance, a view swap inside a container, a multi-step flow, an element leaving while its siblings close the gap, a morph between rich states, or any interaction with several moving parts (icon + background + lines, panel + content, items flying into a target). Triggers on — stagger, sequence, choreography, "one after another", crossfade, AnimatePresence mode, hero entrance, multi-step, useAnimate, "feels mechanical", "too much going on", "feels slow to open".

    Also in 3 projects that use this

  • AJBcodingSkill

    sql-optimization-patterns

    Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

    Also in 4 projects that use this

  • +3 more from microsoft

The file

We split this skill into the rules it gives an agent

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

  • 6

    Common

    Most of the 95 edited versions we read keep these.

  • 4

    Distinctive

    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. Common:

    After a feature is working and tests pass, but the implementation feels heavier than it needs to be

    line 19
  2. Common:

    When you encounter deeply nested logic, long functions, or unclear names

    line 21
  3. Common:

    When refactoring code written under time pressure

    line 22
  4. Common:

    When consolidating related logic scattered across files

    line 23
  5. Common:

    After merging changes that introduced duplication or inconsistency

    line 24
  6. Distinctive:

    Do not use when the code is already readable, when you do not yet understand it, when a simpler version would be measurably slower in a …

    line 26
  7. Distinctive:

    Understand before touching (Chesterton's Fence): If you cannot say why the code exists, read more first.

    line 32
  8. Distinctive:

    One simplification at a time: Run tests after each change.

    line 33
  9. Distinctive:

    Stay in scope: Default to recently modified code.

    line 34
  10. Common:

    After completing a simplification pass:

    line 49

“Common” is measured: kept by at least 6 in 10 of the 95 edited versions of this file we could read. “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 Simplification

Inspired by the Claude Code Simplifier plugin. Adapted here as a model-agnostic, process-driven skill for any AI coding agent.

Overview

Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines — it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"

When to use

  • After a feature is working and tests pass, but the implementation feels heavier than it needs to be
  • During code review when readability or complexity issues are flagged
  • When you encounter deeply nested logic, long functions, or unclear names
  • When refactoring code written under time pressure
  • When consolidating related logic scattered across files
  • After merging changes that introduced duplication or inconsistency

Do not use when the code is already readable, when you do not yet understand it, when a simpler version would be measurably slower in a performance-critical path, or when the module is about to be rewritten.

Process

  1. Preserve behaviour exactly. Same outputs, errors, side effects, and ordering. If you are not sure, do not change it. Tests must still pass without modification.
  2. Follow project conventions. Match neighboring code; do not impose external style.
  3. Prefer clarity over cleverness. Explicit beats compact when compact needs a mental pause.
  4. Understand before touching (Chesterton's Fence). If you cannot say why the code exists, read more first.
  5. One simplification at a time. Run tests after each change. Submit refactoring separately from features. If a pass would touch more than 500 lines, use automation rather than hand edits.
  6. Stay in scope. Default to recently modified code. Unscoped simplification is churn.

Opportunity tables and language-specific examples: references/simplification-patterns.md.

Red flags

  • Simplification that requires modifying tests to pass (you likely changed behavior)
  • "Simplified" code that is longer and harder to follow than the original
  • Renaming things to match your preferences rather than project conventions
  • Removing error handling because "it makes the code cleaner"
  • Simplifying code you don't fully understand
  • Batching many simplifications into one large, hard-to-review commit
  • Refactoring code outside the scope of the current task without being asked

Verification

After completing a simplification pass:

  • All existing tests pass without modification
  • Build succeeds with no new warnings
  • Linter/formatter passes (no style regressions)
  • Each simplification is a reviewable, incremental change
  • The diff is clean — no unrelated changes mixed in
  • Simplified code follows project conventions (checked against CLAUDE.md or equivalent)
  • No error handling was removed or weakened
  • No dead code was left behind (unused imports, unreachable branches)
  • A teammate or review agent would approve the change as a net improvement
  • Architecture classification is correct — extracted code lands in the right layer (Component renders, Hook owns state and effects, Utility stays pure, Service talks to APIs and owns business workflows)

References

  • references/simplification-patterns.md — opportunity tables, language examples, rationalizations

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.