codebase-cleanup-refactor-clean

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.

31,392 stars
Complexity: easy

About this skill

This skill empowers your AI agent to act as a seasoned code refactoring expert. It meticulously analyzes provided codebases, identifying areas for improvement in quality, maintainability, and performance. Leveraging deep knowledge of clean code principles, SOLID design patterns, and modern software engineering best practices, the agent intelligently refactors code to remove technical debt, simplify complex logic, and enhance overall code health. It's designed to transform messy or suboptimal code into clean, efficient, and easily understandable components.

Best use case

Cleaning up large codebases with accumulated technical debt, removing duplication and simplifying modules, preparing a codebase for new feature development, and aligning code with high-quality standards.

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.

Clean, well-structured, and highly maintainable code. Reduced bug surface area, improved readability, better performance, and a codebase that adheres to modern software engineering best practices, making future development faster and less error-prone.

Practical example

Example input

```python
def calculate_total_price(items):
    total = 0
    for item in items:
        if item['type'] == 'book':
            total += item['price'] * 1.10 # 10% tax for books
        elif item['type'] == 'electronics':
            total += item['price'] * 1.20 # 20% tax for electronics
        else:
            total += item['price'] * 1.05 # 5% tax for others
    return total
```

Example output

```python
from typing import List

class Item:
    def __init__(self, item_type: str, price: float):
        self.item_type = item_type
        self.price = price

    def _get_tax_rate(self) -> float:
        if self.item_type == 'book':
            return 0.10
        elif self.item_type == 'electronics':
            return 0.20
        return 0.05 # Default for others

    def calculate_taxed_price(self) -> float:
        return self.price * (1 + self._get_tax_rate())

def calculate_total_price(items: List[Item]) -> float:
    total_price = sum(item.calculate_taxed_price() for item in items)
    return total_price
```

When to use this skill

  • When you need to systematically improve the quality and structure of existing code, reduce technical debt, enhance readability and maintainability for future development, or optimize code for better performance and scalability. Ideal for pre-release cleanups or before starting major new features.

When not to use this skill

  • When the primary task is a complete architectural redesign rather than code-level refactoring. Avoid using for critical production systems without human review and thorough testing. Not suitable when the code requires deep, nuanced domain-specific knowledge that the AI agent has not been explicitly trained on, or when the focus is on debugging runtime issues rather than structural improvements.

Installation

Claude Code / Cursor / Codex

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

Manual Installation

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

How codebase-cleanup-refactor-clean Compares

Feature / Agentcodebase-cleanup-refactor-cleanStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

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.

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

# Refactor and Clean Code

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.

## Use this skill when

- Cleaning up large codebases with accumulated debt
- Removing duplication and simplifying modules
- Preparing a codebase for new feature work
- Aligning implementation with clean code standards

## Do not use this skill when

- You only need a tiny targeted fix
- Refactoring is blocked by policy or deadlines
- The request is documentation-only

## Context
The user needs help refactoring code to make it cleaner, more maintainable, and aligned with best practices. Focus on practical improvements that enhance code quality without over-engineering.

## Requirements
$ARGUMENTS

## Instructions

- Identify high-impact refactor candidates and risks.
- Break work into small, testable steps.
- Apply changes with a focus on readability and stability.
- Validate with tests and targeted regression checks.
- If detailed patterns are required, open `resources/implementation-playbook.md`.

## Safety

- Avoid large rewrites without agreement on scope.
- Keep changes reviewable and reversible.

## Output Format

- Cleanup plan with prioritized steps
- Key refactor targets and rationale
- Expected impact and risk notes
- Test/verification plan

## Resources

- `resources/implementation-playbook.md` for detailed patterns and examples.

Related Skills

code-simplifier

31392
from sickn33/antigravity-awesome-skills

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.

Code Refactoring & QualityClaude

fp-refactor

31392
from sickn33/antigravity-awesome-skills

Comprehensive guide for refactoring imperative TypeScript code to fp-ts functional patterns

Software DevelopmentClaude

codebase-cleanup-deps-audit

31392
from sickn33/antigravity-awesome-skills

You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.

Security AnalysisClaude

codebase-audit-pre-push

31392
from sickn33/antigravity-awesome-skills

Deep audit before GitHub push: removes junk files, dead code, security holes, and optimization issues. Checks every file line-by-line for production readiness.

DevelopmentClaude

code-refactoring-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.

Developer ToolsClaude

code-refactoring-context-restore

31392
from sickn33/antigravity-awesome-skills

Use when working with code refactoring context restore

Code AnalysisClaude

clean-code

31392
from sickn33/antigravity-awesome-skills

This skill embodies the principles of "Clean Code" by Robert C. Martin (Uncle Bob). Use it to transform "code that works" into "code that is clean."

Code GenerationClaude

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