agentsclimarketplace

Code simplification

Skill vignesh2027/AI-AGENT-SKILLS/skills/code-simplification

Turn your ai agent into senior engineer..The result is fast code that fails slowly. AI Agent Skills solves this by giving agents the same disciplined workflows senior engineers use

Install
npx -y skills add vignesh2027/AI-AGENT-SKILLS --skill code-simplification

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Remove accidental complexity without changing behavior — apply Chesterton's Fence

SKILL.md

2.8 KB, as published. Nobody here has run it

Overview

Every line of code is a liability. Complexity that serves no purpose makes systems harder to understand, harder to test, and harder to change. This skill removes accidental complexity while preserving intentional complexity and essential behavior.

When to Use

  • When a PR review reveals unnecessarily complex code
  • When a function is hard to test because it does too many things
  • When adding a feature to existing code requires understanding too much context
  • As part of the /simplify workflow

Process

Step 1: Understand before you remove (Chesterton's Fence)

Before removing any code that seems unnecessary: understand why it was written. If you don't know why a fence exists, don't remove it. Find out first.

Step 2: Identify the complexity types

  • Accidental complexity: complexity from poor implementation choices
  • Essential complexity: complexity inherent to the problem domain

Only remove accidental complexity. Essential complexity cannot be removed — only managed.

Step 3: Look for these simplification opportunities

Dead code: Code that is never executed. Remove it (git remembers it).

Premature abstraction: Abstractions that are more complex than the thing they abstract. Inline them.

Unnecessary indirection: Function A calls function B which calls function C and each is 5 lines. Collapse them.

Redundant comments: Comments that say what the code already says. Delete them. Keep comments that explain WHY.

Magic numbers: Replace if (retries > 3) with if (retries > MAX_RETRIES).

Over-engineered error handling: 10 levels of nested try/catch for a case that can't happen. Simplify.

Duplicate logic: The same logic in 3 places. Extract to one place.

Step 4: Simplify in small steps

One simplification at a time. Run tests after each step.

Step 5: Verify behavior is unchanged

The test suite must pass. If there are no tests, write tests for the behavior you're simplifying before you simplify it.

Step 6: Check: is it simpler for a new reader?

Have someone unfamiliar with this code read it. Is it easier to understand than before?

Anti-Rationalizations

"Removing this might break something I don't know about" This is Chesterton's Fence. Understand it first. Then remove it.

"The abstraction makes it more extensible" If you are not extending it now, the abstraction is premature. Three identical lines are better than a wrong abstraction.

Verification Requirements

  • Every removal preceded by understanding why it was written
  • Tests pass after each simplification step
  • No behavior changes (confirmed by tests)
  • A new reader finds it simpler (validation)

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.