Skills DirectoryCurated open-source Skills from GitHub

code-simplificationcommit f1f6fbfSKILL.md · Refactoring

Code Simplification

Reduces code complexity while preserving exact behavior, aiming for code that is easier to read, modify and debug rather than fewer lines.

npx skills add addyosmani/agent-skills --skill code-simplification
Permissions
  • read-repo
  • write-files
  • shell
  • network
Compatible with
Claude Code, Codex, Cursor, Copilot, Gemini CLI
GitHub
112.3k
Source
Community · Addy Osmani
Status
Scan passed
License
MIT
Category
Refactoring

Core rule

Preserve behavior exactly; if you are not sure a simplification preserves behavior, do not make it.

Execution Phases

  1. Phase 01Understand before touching

    Apply Chesterton's Fence: learn the code's responsibility, callers, edge cases, tests and git blame history before changing anything.

  2. Phase 02Identify opportunities

    Following project conventions, look for deep nesting, long functions, nested ternaries, unclear names, duplication, dead code and needless abstractions.

  3. Phase 03Apply incrementally

    Make one simplification at a time and run tests after each, reverting on failure; submit refactors separately from feature or bug-fix changes.

  4. Phase 04Verify the result

    Compare before and after for readability and consistency; existing tests pass unmodified and build and lint stay clean.

Permissions (summarised from SKILL.md)

CapabilityNeededDetails
File writesRequiredEdits code in scope, by default the recently modified code.
Command executionRequiredRuns tests, builds, linters and git blame, and may use codemod scripts for large changes.
Network outboundNot requiredThe skill does not call for network access.

SKILL.md frontmatter (YAML)

SKILL.md frontmatter (YAML)commit f1f6fbf
---
name: code-simplification
description: Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity. Use when asked to simplify, clean up, or reduce the nesting of a function or module that already works, even when the code is pasted inline and nothing else needs to change.
---

Related skills

A rule scan cannot catch every risk. Read this skill's SKILL.md and check its permissions before installing.