mcpField
R
refactor-safe

refactor-safe

github.com/dzhuneytDevelopment063 installsUpdated 3w ago
Repository

About refactor-safe

refactor-safe is a code-review skill for identifying and ranking maintainability-focused refactoring suggestions. It excludes generated and vendor files, gives each suggestion a location, rationale, safety level, and effort estimate, and limits the list to ten items.

Key features

  1. 01Checks for a valid project
  2. 02Finds common refactoring opportunities
  3. 03Groups suggestions by safety level
  4. 04Provides locations and rationale
  5. 05Estimates effort and flags testing needs

Use cases

  1. 01Reviewing a codebase for safe cleanup
  2. 02Prioritizing refactoring work by risk
  3. 03Finding unused code or repeated patterns

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dzhuneyt/skills --skill refactor-safe

After installing, type/refactor-safein Claude Code to confirm it loaded.

Details

From the project README

Execute the following steps:

  1. Check if current directory is a valid project (package.json, requirements.txt, etc.)

  2. Analyze code patterns and identify safe refactoring opportunities:

    • Duplicate code blocks that can be extracted into functions
    • Long functions that can be broken down
    • Magic numbers/strings that should be constants
    • Unused imports or variables
    • Simple type improvements (TypeScript/Python)
    • Dead code that can be removed safely
  3. Prioritize suggestions by safety level:

    • Safe: No behavior change (extract constants, remove unused code)
    • Low Risk: Mechanical refactoring (extract functions, rename variables)
    • Medium Risk: Structural changes that need testing
  4. For each suggestion provide:

    • Location (file:line)
    • What to refactor
    • Why it's safe
    • Estimated effort (small/medium/large)

Safety criteria:

  • Only suggest refactoring for code patterns, not business logic changes
  • Prioritize mechanical transformations over subjective improvements
  • Flag any suggestions that require tests to verify safety
  • Exclude files that look like generated code or vendor libraries
  • Focus on maintainability improvements with clear benefits

Output format:

  • Group suggestions by safety level
  • Show file locations with line numbers
  • Provide brief rationale for each suggestion
  • Include rough effort estimates
  • Limit to top 10 most impactful suggestions

Comments

Markdown supported