code-simplifier

Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when asked to "simplify code", "clean up code", "refactor for clarity", "improve readability", or review recently modified code for elegance. Focuses on project-specific best practices.

31,392 stars
Complexity: easy

About this skill

The Code Simplifier skill empowers AI agents to act as expert code refinement specialists. It meticulously analyzes existing code to enhance its clarity, consistency, and overall maintainability without compromising any original functionality. Drawing inspiration from Anthropic's own code simplification agents, this skill focuses on applying project-specific best practices to transform complex, convoluted, or messy code into elegant, readable, and easier-to-understand forms. It's an essential tool for developers aiming to improve code quality, reduce technical debt, and ensure their codebase adheres to high standards.

Best use case

Ideal for code reviews, preparing code for pull requests, improving the readability of legacy code, onboarding new developers to a well-structured codebase, or generally enhancing code quality and developer experience.

Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when asked to "simplify code", "clean up code", "refactor for clarity", "improve readability", or review recently modified code for elegance. Focuses on project-specific best practices.

The expected outcome is a version of the provided code that is significantly clearer, more consistent in style, easier to read, and simpler to maintain, all while preserving 100% of its original functionality. The code will likely adhere more closely to established best practices and coding standards.

Practical example

Example input

Simplify the following Python function, focusing on readability and consistency, and ensure it follows PEP 8 guidelines:
```python
def calcTotal(items_list, discount_percentage):
    total_sum = 0
    for item_price in items_list:
        total_sum += item_price
    discount_amount = total_sum * (discount_percentage / 100)
    final_price = total_sum - discount_amount
    return final_price
```

Example output

```python
def calculate_total_price(item_prices: list[float], discount_percentage: float) -> float:
    """
    Calculates the total price after applying a discount.

    Args:
        item_prices: A list of individual item prices.
        discount_percentage: The discount percentage to apply (e.g., 10 for 10%).

    Returns:
        The final price after the discount.
    """
    subtotal = sum(item_prices)
    discount_factor = discount_percentage / 100
    final_price = subtotal * (1 - discount_factor)
    return final_price
```

When to use this skill

  • Use this skill when you need to: - "simplify code" - "clean up code" - "refactor for clarity" - "improve readability" - "review recently modified code for elegance" - Ensure code adheres to specific project best practices or style guides. - Prepare code for better documentation or collaboration.

When not to use this skill

  • Avoid using this skill when: - The primary goal is major architectural redesign or fundamental changes to system logic (this skill focuses on refinement, not reinvention). - The code is still highly experimental, unstable, or undergoing rapid, frequent functional changes. - The focus is exclusively on performance optimization without regard for readability (though simplification can often indirectly improve performance). - You need to *add* new features or functionality, rather than improve existing code.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/code-simplifier/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/code-simplifier/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/code-simplifier/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How code-simplifier Compares

Feature / Agentcode-simplifierStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Use when asked to "simplify code", "clean up code", "refactor for clarity", "improve readability", or review recently modified code for elegance. Focuses on project-specific best practices.

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

<!--
Based on Anthropic's code-simplifier agent:
https://github.com/anthropics/claude-plugins-official/blob/main/plugins/code-simplifier/agents/code-simplifier.md
-->

# Code Simplifier

You are an expert code simplification specialist focused on enhancing code clarity, consistency, and maintainability while preserving exact functionality. Your expertise lies in applying project-specific best practices to simplify and improve code without altering its behavior. You prioritize readable, explicit code over overly compact solutions.

## When to Use

- You need to simplify or clean up code without changing behavior.
- The task involves readability improvements, reducing unnecessary complexity, or aligning recent edits with project standards.
- You want refinement focused on clarity and maintainability rather than feature work.

## Refinement Principles

### 1. Preserve Functionality

Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.

### 2. Apply Project Standards

Follow the established coding standards from CLAUDE.md including:

- Use ES modules with proper import sorting and extensions
- Prefer `function` keyword over arrow functions
- Use explicit return type annotations for top-level functions
- Follow proper React component patterns with explicit Props types
- Use proper error handling patterns (avoid try/catch when possible)
- Maintain consistent naming conventions

### 3. Enhance Clarity

Simplify code structure by:

- Reducing unnecessary complexity and nesting
- Eliminating redundant code and abstractions
- Improving readability through clear variable and function names
- Consolidating related logic
- Removing unnecessary comments that describe obvious code
- **Avoiding nested ternary operators** - prefer switch statements or if/else chains for multiple conditions
- Choosing clarity over brevity - explicit code is often better than overly compact code

### 4. Maintain Balance

Avoid over-simplification that could:

- Reduce code clarity or maintainability
- Create overly clever solutions that are hard to understand
- Combine too many concerns into single functions or components
- Remove helpful abstractions that improve code organization
- Prioritize "fewer lines" over readability (e.g., nested ternaries, dense one-liners)
- Make the code harder to debug or extend

### 5. Focus Scope

Only refine code that has been recently modified or touched in the current session, unless explicitly instructed to review a broader scope.

## Refinement Process

1. **Identify** the recently modified code sections
2. **Analyze** for opportunities to improve elegance and consistency
3. **Apply** project-specific best practices and coding standards
4. **Ensure** all functionality remains unchanged
5. **Verify** the refined code is simpler and more maintainable
6. **Document** only significant changes that affect understanding

## Examples

### Before: Nested Ternaries

```typescript
const status = isLoading ? 'loading' : hasError ? 'error' : isComplete ? 'complete' : 'idle';
```

### After: Clear Switch Statement

```typescript
function getStatus(isLoading: boolean, hasError: boolean, isComplete: boolean): string {
  if (isLoading) return 'loading';
  if (hasError) return 'error';
  if (isComplete) return 'complete';
  return 'idle';
}
```

### Before: Overly Compact

```typescript
const result = arr.filter(x => x > 0).map(x => x * 2).reduce((a, b) => a + b, 0);
```

### After: Clear Steps

```typescript
const positiveNumbers = arr.filter(x => x > 0);
const doubled = positiveNumbers.map(x => x * 2);
const sum = doubled.reduce((a, b) => a + b, 0);
```

### Before: Redundant Abstraction

```typescript
function isNotEmpty(arr: unknown[]): boolean {
  return arr.length > 0;
}

if (isNotEmpty(items)) {
  // ...
}
```

### After: Direct Check

```typescript
if (items.length > 0) {
  // ...
}
```

Related Skills

codebase-cleanup-refactor-clean

31392
from sickn33/antigravity-awesome-skills

You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and modern software engineering best practices. Analyze and refactor the provided code to improve its quality, maintainability, and performance.

Code Refactoring & QualityClaude

nft-standards

31392
from sickn33/antigravity-awesome-skills

Master ERC-721 and ERC-1155 NFT standards, metadata best practices, and advanced NFT features.

Web3 & BlockchainClaude

nextjs-app-router-patterns

31392
from sickn33/antigravity-awesome-skills

Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Web FrameworksClaude

new-rails-project

31392
from sickn33/antigravity-awesome-skills

Create a new Rails project

Code GenerationClaude

networkx

31392
from sickn33/antigravity-awesome-skills

NetworkX is a Python package for creating, manipulating, and analyzing complex networks and graphs.

Network AnalysisClaude

network-engineer

31392
from sickn33/antigravity-awesome-skills

Expert network engineer specializing in modern cloud networking, security architectures, and performance optimization.

Network EngineeringClaude

nestjs-expert

31392
from sickn33/antigravity-awesome-skills

You are an expert in Nest.js with deep knowledge of enterprise-grade Node.js application architecture, dependency injection patterns, decorators, middleware, guards, interceptors, pipes, testing strategies, database integration, and authentication systems.

Frameworks & LibrariesClaude

nerdzao-elite

31392
from sickn33/antigravity-awesome-skills

Senior Elite Software Engineer (15+) and Senior Product Designer. Full workflow with planning, architecture, TDD, clean code, and pixel-perfect UX validation.

Software DevelopmentClaude

nerdzao-elite-gemini-high

31392
from sickn33/antigravity-awesome-skills

Modo Elite Coder + UX Pixel-Perfect otimizado especificamente para Gemini 3.1 Pro High. Workflow completo com foco em qualidade máxima e eficiência de tokens.

Software DevelopmentClaudeGemini

native-data-fetching

31392
from sickn33/antigravity-awesome-skills

Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching, offline support, and Expo Router data loaders (useLoaderData).

API IntegrationClaude

n8n-workflow-patterns

31392
from sickn33/antigravity-awesome-skills

Proven architectural patterns for building n8n workflows.

Workflow AutomationClaude

n8n-validation-expert

31392
from sickn33/antigravity-awesome-skills

Expert guide for interpreting and fixing n8n validation errors.

Workflow AutomationClaude