Back to Skills

refactor

verified

Refactor code with code-simplifier

View on GitHub

Marketplace

frad-dotclaude

FradSer/dotclaude

Plugin

refactor

development

Repository

FradSer/dotclaude
203stars

refactor/skills/refactor/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/FradSer/dotclaude/blob/main/refactor/skills/refactor/SKILL.md -a claude-code --skill refactor

Installation paths:

Claude
.claude/skills/refactor/
Powered by add-skill CLI

Instructions

# Refactor Command

## Core Principles

- **Fully automated**: Execute refactoring immediately without user confirmation
- **Aggressive refactoring**: Apply thorough improvements, remove legacy compatibility code
- **Self-discovery**: Agent discovers best practices from skills automatically
- **Git safety net**: Trust git to revert if needed, no preview confirmations

## Context

- **If arguments are provided**:
  - First, check if they are valid file/directory paths relative to the repo root.
  - If paths exist, treat them as target paths.
  - If paths don't exist or arguments contain semantic descriptions (e.g., "authentication logic", "user login components"), search the codebase for code matching that description.
- **If no arguments are provided**:
  - Default to refactoring code associated with the current session context.
  - Identify recently modified files from the current session.
  - If no recent changes are found, inform user to provide specific file/directory paths.

## Step 1: Determine Target Scope

### If Arguments Provided

1. **Check if arguments are file/directory paths**:
   - Verify if paths exist in the repository
   - If paths exist, use them directly as target scope

2. **If paths don't exist or arguments are semantic descriptions**:
   - Search the codebase for code matching the semantic description
   - **Automatically include ALL matching files** in the refactoring scope
   - No user confirmation needed - trust the search results

### If No Arguments Provided (Default: Session Context)

1. **Identify recently modified files**:
   - Find files that have been recently changed in the repository
   - Filter to focus on code files (exclude configuration, documentation, lock files unless needed)

2. **If no recent changes found**:
   - Inform user that no recent changes were detected
   - Suggest providing specific file/directory paths or semantic descriptions as arguments
   - Exit without refactoring

3. **Automatically proceed**:
   - Use all

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3955 chars