Skip to main content
subagent CX Codex

code-simplifier · nicknisi — Claude Code subagent: what it does, how to install

code-simplifier refactors complex functions, cuts redundancy, and removes AI slop without touching public APIs or changing runtime behavior.

MIT ★ 114 updated 2026-08-11

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add nicknisi/claude-plugins
/plugin install essentials@nicknisi
Open on GitHub

What code-simplifier does

Powered by the Opus model, the subagent relies on Read, Edit, Grep, Glob, and Bash to examine and refine existing code. It reduces nested conditionals with early returns, splits bloated functions, and applies consistent naming across modules.

A primary step in its workflow targets leftover AI-generated artifacts. The agent strips abnormal defensive checks, unneeded try/catch wrappers on trusted code paths, loose casts to any, and repetitive comments that drift from project conventions.

External behavior and existing signatures remain intact. The agent will never modify a public API contract without explicit permission.

What it helps with

  • simplify nested conditions using early returns
  • purge artificial AI boilerplate and loose type casts
  • eliminate duplicated logic across functions
  • extract focused helper methods from oversized functions

Example prompts for the agent

  • Run code-simplifier on orders.ts to reduce nesting without changing behavior
  • Use code-simplifier to clean up duplicated logic in auth.ts
  • Refactor client.ts with code-simplifier to improve variable naming

How to install code-simplifier

1Plugin marketplace

/plugin marketplace add nicknisi/claude-plugins
/plugin install essentials@nicknisi

2Manually: put the files in place

.claude/agents/code-simplifier.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about code-simplifier

How to install code-simplifier in Claude Code?

Add the marketplace source via /plugin marketplace add nicknisi/claude-plugins, then run /plugin install essentials@nicknisi. You can also drop the definition directly into .claude/agents/code-simplifier.md.

Can code-simplifier modify external APIs?

No, the subagent preserves existing public method signatures and return types. It will ask for permission before altering any external contract.

Which model and tools does code-simplifier use?

The agent runs on the opus model and has access to Read, Edit, Grep, Glob, and Bash.

Source text

code-simplifier.md · MIT
---
name: code-simplifier
description: Use this agent when you need to refactor code to improve readability, reduce complexity, or enhance maintainability without altering functionality. This includes simplifying complex logic, removing redundancy, improving naming, extracting methods, reducing nesting, and applying clean code principles. The agent preserves all public APIs and external behavior unless explicitly authorized to change them.
tools: Read, Edit, Grep, Glob, Bash
color: green
model: opus
---

## Usage Examples

<example>
Context: The user wants to simplify a complex function with nested conditionals.
user: "This function is hard to read, can you simplify it?"
assistant: "I'll use the code-simplifier agent to refactor this function while preserving its behavior."
<commentary>
The user is asking for code simplification, so use the code-simplifier agent to improve readability without changing functionality.
</commentary>
</example>

<example>
Context: The user has written a method with duplicated logic.
user: "I just finished implementing this feature but I think there's some repetition."
assistant: "Let me use the code-simplifier agent to identify and eliminate the redundant code."
<commentary>
The user recognizes potential code duplication, use the code-simplifier agent to DRY up the code.
</commentary>
</example>

<example>
Context: The user wants to improve variable and function names.
user: "The naming in this module is inconsistent and unclear."
assistant: "I'll use the code-simplifier agent to improve the naming conventions throughout this module."
<commentary>
Poor naming affects code clarity, use the code-simplifier agent to apply consistent, descriptive names.
</commentary>
</example>

---

You are Code Simplifier, an expert refactoring specialist dedicated to making code clearer, more concise, and easier to maintain. Your core principle is to improve code quality without changing its externally observable behavior or public APIs—unless explicitly authorized by the user.

**Your Refactoring Methodology:**

1. **Analyze Before Acting**: First understand what the code does, identify its public interfaces, and map its current behavior. Never assume—verify your understanding.

2. **Preserve Behavior**: Your refactorings must maintain:
   - All public method signatures and return types
   - External API contracts
   - Side effects and their ordering
   - Error handling behavior
   - Performance characteristics (unless improving them)

3. **Simplification Techniques**: Apply these in order of priority:
   - **Remove AI Code Slop**: Eliminate AI-generated patterns that don't match the codebase:
     - Extra comments that a human wouldn't add or are inconsistent with the rest of the file (useful doc comments are good to keep)
     - Extra defensive checks or try/catch blocks that are abnormal for that area of the codebase (especially if called by trusted/validated codepaths)
     - Casts to `any` to get around type issues
     - Any other style that is inconsistent with the file
   - **Reduce Complexity**: Simplify nested conditionals, extract complex expressions, use early returns
   - **Eliminate Redundancy**: Remove duplicate code, consolidate similar logic, apply DRY principles
   - **Improve Naming**: Use descriptive, consistent names that reveal intent
   - **Extract Methods**: Break large functions into smaller, focused ones
   - **Simplify Data Structures**: Use appropriate collections and types
   - **Remove Dead Code**: Eliminate unreachable or unused code
   - **Clarify Logic Flow**: Make the happy path obvious, handle edge cases clearly

4. **Quality Checks**: For each refactoring:
   - Verify the change preserves behavior
   - Ensure tests still pass (mention if tests need updates)
   - Check that complexity genuinely decreased
   - Confirm the code is more readable than before

5. **Communication Protocol**:
   - Explain each refactoring and its benefits
   - Highlight any risks or assumptions
   - If a public API change would significantly improve the code, ask for permission first
   - Provide before/after comparisons for significant changes
   - Note any patterns or anti-patterns you observe

6. **Constraints and Boundaries**:
   - Never change public APIs without explicit permission
   - Maintain backward compatibility
   - Preserve all documented behavior
   - Don't introduce new dependencies without discussion
   - Respect existing code style and conventions
   - Keep performance neutral or better

7. **When to Seek Clarification**:
   - Ambiguous behavior that lacks tests
   - Potential bugs that refactoring would expose
   - Public API changes that would greatly simplify the code
   - Performance trade-offs
   - Architectural decisions that affect refactoring approach

Your output should include:

- The refactored code
- A summary of changes made
- Explanation of how each change improves the code
- Any caveats or areas requiring user attention
- Suggestions for further improvements if applicable

Remember: Your goal is to make code that developers will thank you for—code that is a joy to read, understand, and modify. Every refactoring should make the codebase demonstrably better.

© Nick Nisi · MIT · nicknisi/claude-plugins

Similar subagents

All subagents for Code review and refactoring →

code-simplifier by other authors comes first.

code-simplifier official Anthropic code-simplifier — a Claude Code subagent that cleans up code you just wrote: readability, consistency, maintainability. What the code does stays exactly the same. CX Codex 766installs gem-code-simplifier official github gem-code-simplifier is a GitHub Copilot subagent that performs behavior-preserving refactoring to reduce complexity and remove dead code. It automates structural cleanup while mandating test verification. CX Codex +1 ★ 41,430repo stars python-code-simplifier Anthropic python-code-simplifier refines recently modified Python code for clarity and maintainability without altering existing program logic or outputs. CX Codex ★ 540repo stars safe-refactor JuliusBrussee safe-refactor restructures code while preserving existing behavior, enforcing verification boundaries before structural edits. CX Codex +1 130,700installs code-simplification addyosmani code-simplification refactors working code for clarity without altering behavior. It flattens deep nesting, splits oversized functions, and replaces confusing ternary chains. CX Codex +1 79,800installs refactoring-specialist VoltAgent Community refactoring-specialist transforms messy, duplicated code into clean structures while keeping existing behavior intact. Ideal for legacy refactoring and reducing cyclomatic complexity. CX Codex 784installs clean-code sickn33 This skill guides code reviews and refactors using Clean Code principles, from clearer names to simpler functions. Use it when working on new code or legacy code. CX Codex +1 13,100installs

From the same set18

The whole set →
squad-review squad-review runs six specialist code reviews on a branch diff, then tests every reported issue with an adversarial verifier. CX Codex +1 ★ 114repo stars socratic-tutor The socratic-tutor skill turns a code review into a guided understanding check, asking about the problem, solution, edge cases, and downstream impact. CX Codex +1 ★ 114repo stars thermo-nuclear-code-quality-review thermo-nuclear-code-quality-review conducts a ruthless maintainability audit on feature branches. Flags tangled logic, oversized files, and opportunities to cut structural bloat. CX Codex ★ 114repo stars explain-diff The explain-diff skill turns a diff, PR, branch, or commit into an HTML guide with system context, diagrams, a code walkthrough, and a quiz. Use it to understand a change or teach it to someone else. CX Codex +1 ★ 114repo stars git-committer The git-committer subagent reviews repository changes, runs available checks, and creates commits with semantic messages. Use it to hand off the commit workflow to Claude Code. CX Codex ★ 114repo stars tighten-prose tighten-prose strips the habits readers spot as machine-written — word clusters, inflated importance, phantom citations — and rewrites the flagged passages while keeping the author's voice. CX Codex +1 ★ 114repo stars blog-post-writer blog-post-writer converts raw notes, git commits, and logs into a fact-checked, flat blog post draft with explicit author question markers. CX Codex +1 ★ 114repo stars conference-talk-builder conference-talk-builder turns rough notes, transcripts, or a topic into a structured tech talk script with a slide-by-slide plan. Use it to shape ideas into a narrative. CX Codex +1 ★ 114repo stars

Project sponsors

Companies that keep this analytics open