Skip to content
Back to skills

Code Refactoring 3

ASecurity

Improve code structure, readability, and maintainability without changing external behavior through systematic refactoring

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
code-qualitypythongorefactoring

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill code-refactoring-3 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Refactoring 3?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Refactoring 3
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-code-refactoring-3/badge)](https://www.skillsdirectory.com/skills/david-li0406-code-refactoring-3)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "Code Refactoring"
description: "Improve code structure, readability, and maintainability without changing external behavior through systematic refactoring"
category: "implementation"
required_tools: ["Read", "Write", "Edit", "MultiEdit", "Grep", "Glob"]
---

# Code Refactoring

## Purpose
Improve code structure, readability, and maintainability without changing its external behavior or functionality.

## When to Use
- Code is hard to understand or modify
- Duplicated code exists
- Functions are too long or complex
- Code smells are present
- Preparing for new features

## Key Capabilities
1. **Extract Method** - Break long functions into smaller pieces
2. **Rename** - Improve variable/function names for clarity
3. **Remove Duplication** - Consolidate repeated code

## Approach
1. Identify code that needs improvement
2. Ensure tests exist before refactoring
3. Make small, incremental changes
4. Run tests after each change
5. Commit working states frequently

## Example
**Before**:
````python
def process(data):
    result = []
    for item in data:
        if item > 0 and item < 100 and item % 2 == 0:
            result.append(item * 2)
    return result
````

**After**:
````python
def is_valid_even_number(n):
    return 0 < n < 100 and n % 2 == 0

def process(data):
    valid_numbers = filter(is_valid_even_number, data)
    return [n * 2 for n in valid_numbers]
````

## Best Practices
- ✅ Always have tests before refactoring
- ✅ Make small, incremental changes
- ✅ Run tests after each change
- ❌ Avoid: Refactoring and adding features simultaneously

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…