
Code Simplification
Refactor working code for clarity and maintainability after tests pass, without changing behavior or chasing line-count vanity.
Overview
code-simplification is an agent skill most often used in Ship (also Build, Operate) that simplifies working code for clarity and maintainability without changing behavior.
Install
npx skills add https://github.com/addyosmani/agent-skills --skill code-simplificationWhat is this skill?
- Behavior-preserving simplification guided by the “new team member understands faster” test
- Triggers after features work and tests pass, or when review flags complexity
- Consolidates scattered related logic and reduces nesting without performance rewrites
- Anti-patterns: skip when already clean, when you have not comprehended the code yet, or for performance-critical hot pat
- Model-agnostic process adapted from Claude Code Simplifier-style review rituals
Adoption & trust: 4.3k installs on skills.sh; 49.1k GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+200% hot-view momentum).
What problem does it solve?
Your feature passes tests but the implementation is nested, duplicated, or hard to extend, so every small change feels risky.
Who is it for?
Solo builders post-feature or mid-review who want a structured clarity pass without a risky behavioral rewrite.
Skip if: Already-readable code, code you have not understood yet, or performance-sensitive paths where you have not profiled and justified changes.
When should I use this skill?
Refactoring code for clarity without changing behavior; code works but is harder to read, maintain, or extend; reviewing code with accumulated unnecessary complexity.
What do I get? / Deliverables
You get behavior-identical code that reads faster for the next contributor—including future you—with complexity removed only where comprehension clearly improves.
- Refactored source with preserved behavior and improved readability
- Review notes tying changes to complexity drivers (nesting, naming, duplication)
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Code simplification lands on the Ship shelf because it assumes working behavior and focuses on readability before merge or release-quality review. The skill explicitly targets review and post-feature cleanup—nested logic, unclear names, and duplication—rather than greenfield implementation.
Where it fits
After an API endpoint works, flatten nested conditionals and rename handlers before you wire the next integration.
Respond to review comments about duplication by consolidating helpers without altering response contracts.
Simplify a hotfix branch that fixed production but left confusing control flow before merging back to main.
How it compares
Use as a behavior-locked readability workflow instead of ad-hoc “clean up while you’re here” refactors that silently change semantics.
Common Questions / FAQ
Who is code-simplification for?
Solo and indie developers using any AI coding agent who ship working code but need a repeatable way to improve readability during review or after time-pressured implementation.
When should I use code-simplification?
After tests pass but the code feels heavy; during Ship review when complexity is flagged; when consolidating duplication post-merge; and during Operate iterate when production fixes left tangled patches.
Is code-simplification safe to install?
It is procedural guidance with no required network or secrets by default, but it can drive large refactors—review diffs carefully and check the Security Audits panel on this Prism page before trusting third-party skill sources.
SKILL.md
READMESKILL.md - Code Simplification
# Code Simplification > Inspired by the [Claude Code Simplifier plugin](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/code-simplifier/agents/code-simplifier.md). 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 **When NOT to use:** - Code is already clean and readable — don't simplify for the sake of it - You don't understand what the code does yet — comprehend before you simplify - The code is performance-critical and the "simpler" version would be measurably slower - You're about to rewrite the module entirely — simplifying throwaway code wastes effort ## The Five Principles ### 1. Preserve Behavior Exactly Don't change what the code does — only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it. ``` ASK BEFORE EVERY CHANGE: → Does this produce the same output for every input? → Does this maintain the same error behavior? → Does this preserve the same side effects and ordering? → Do all existing tests still pass without modification? ``` ### 2. Follow Project Conventions Simplification means making code more consistent with the codebase, not imposing external preferences. Before simplifying: ``` 1. Read CLAUDE.md / project conventions 2. Study how neighboring code handles similar patterns 3. Match the project's style for: - Import ordering and module system - Function declaration style - Naming conventions - Error handling patterns - Type annotation depth ``` Simplification that breaks project consistency is not simplification — it's churn. ### 3. Prefer Clarity Over Cleverness Explicit code is better than compact code when the compact version requires a mental pause to parse. ```typescript // UNCLEAR: Dense ternary chain const label = isNew ? 'New' : isUpdated ? 'Updated' : isArchived ? 'Archived' : 'Active'; // CLEAR: Readable mapping function getStatusLabel(item: Item): string { if (item.isNew) return 'New'; if (item.isUpdated) return 'Updated'; if (item.isArchived) return 'Archived'; return 'Active'; } ``` ```typescript // UNCLEAR: Chained reduces with inline logic const result = items.reduce((acc, item) => ({ ...acc, [item.id]: { ...acc[item.id], count: (acc[item.id]?.count ?? 0) + 1 } }), {}); // CLEAR: Named intermediate step const countById = new Map<string, number>(); for (const item of items) { countById.set(item.id, (countById.get(item.id) ?? 0) + 1); } ``` ### 4. Maintain Balance Simplification has a failure mode: over-simplification. Watch for these traps: - **Inlining too aggressively** — removing a helper that gave a concept a name makes the call site harder to read - **Combining unrelated logic** — two simple functions merged into one complex function is not simpler - **Removing "unnecessary" abstraction** — some abstractions exist for extensibility or testability, not