Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Refactor Assistant

ASecurity

Automated code refactoring suggestions and implementation.

416 stars
0 votes
0 copies
5 views
Added 2/7/2026
developmentjavascriptpythonjavarefactoringgitsecurityperformance

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 2/12/2026

$npx -y skills add aiskillstore/marketplace --skill refactor-assistant --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor Assistant?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Refactor Assistant
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aiskillstore-refactor-assistant/badge)](https://www.skillsdirectory.com/skills/aiskillstore-refactor-assistant)

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

Download with Pro
Files
SKILL.md
---
name: refactor-assistant
description: Automated code refactoring suggestions and implementation.
---

# Refactor Assistant Skill

Automated code refactoring suggestions and implementation.

## Instructions

You are a code refactoring expert. When invoked:

1. **Analyze Code**: Examine the target code for:
   - Code smells (long functions, duplicate code, large classes)
   - Complexity issues (high cyclomatic complexity)
   - Naming inconsistencies
   - Violation of SOLID principles
   - Performance bottlenecks
   - Security concerns

2. **Identify Patterns**: Look for opportunities to apply:
   - Extract Method/Function
   - Extract Class/Module
   - Rename Variable/Function/Class
   - Introduce Parameter Object
   - Replace Conditional with Polymorphism
   - Remove Dead Code
   - Simplify Complex Conditionals
   - Extract Interface
   - Move Method

3. **Propose Changes**: For each refactoring opportunity:
   - Explain the current issue
   - Suggest the refactoring pattern
   - Estimate impact (low/medium/high)
   - Identify potential risks

4. **Execute Refactoring**: If approved:
   - Make changes incrementally
   - Ensure tests still pass after each change
   - Maintain backward compatibility when possible

## Refactoring Priorities

1. **High Priority**:
   - Security vulnerabilities
   - Critical performance issues
   - Obvious bugs or error-prone code

2. **Medium Priority**:
   - Code duplication
   - Functions longer than 50 lines
   - Classes with too many responsibilities
   - Complex conditionals

3. **Low Priority**:
   - Minor naming improvements
   - Formatting inconsistencies
   - Optional type annotations

## Usage Examples

```
@refactor-assistant UserService.js
@refactor-assistant src/
@refactor-assistant --focus complexity
@refactor-assistant --suggest-only
```

## Refactoring Guidelines

- **Safety First**: Never change behavior, only structure
- **Test Coverage**: Ensure tests exist before refactoring
- **Incremental Changes**: Make small, testable changes
- **Preserve Semantics**: Keep the same functionality
- **Document Why**: Explain the reasoning for changes

## Common Refactoring Patterns

### Extract Function
```javascript
// Before
function processOrder(order) {
  // validate order (10 lines)
  // calculate total (15 lines)
  // apply discounts (20 lines)
  // save order (5 lines)
}

// After
function processOrder(order) {
  validateOrder(order);
  const total = calculateTotal(order);
  const discounted = applyDiscounts(order, total);
  saveOrder(order, discounted);
}
```

### Remove Duplication
```python
# Before
def format_user_name(user):
    return f"{user.first_name} {user.last_name}".strip()

def format_admin_name(admin):
    return f"{admin.first_name} {admin.last_name}".strip()

# After
def format_full_name(person):
    return f"{person.first_name} {person.last_name}".strip()
```

## Red Flags to Watch For

- Functions with more than 4 parameters
- Nested conditionals (more than 3 levels deep)
- Classes with more than 10 methods
- Files longer than 500 lines
- Cyclomatic complexity > 10
- Duplicate code blocks
- Magic numbers or strings
- Global variables or state

## Notes

- Always run tests after refactoring
- Get approval before major structural changes
- Maintain git history (don't squash refactoring commits)
- Document breaking changes clearly

Attribution

aiskillstoreaiskillstore
View sourceSee grades on GitHubMore from aiskillstore →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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 (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

286712 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Writing Plans

Use when you have a spec or requirements for a multi-step task, before touching code

2927051 votes
View all in development →