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-simplificationCommand selected. Copy it manually.
- 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
Phase 01Understand before touching
Apply Chesterton's Fence: learn the code's responsibility, callers, edge cases, tests and git blame history before changing anything.
Phase 02Identify opportunities
Following project conventions, look for deep nesting, long functions, nested ternaries, unclear names, duplication, dead code and needless abstractions.
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.
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)
| Capability | Needed | Details |
|---|---|---|
| File writes | Required | Edits code in scope, by default the recently modified code. |
| Command execution | Required | Runs tests, builds, linters and git blame, and may use codemod scripts for large changes. |
| Network outbound | Not required | The skill does not call for network access. |
SKILL.md frontmatter (YAML)
---
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.
---