agentsclimarketplace

Refactor

Skill huzaifa525/claude-code-optimizer/templates/.claude/skills/refactor

Optimize Claude Code token usage — 22 skills, 8 hooks, 6 rules. One npm install. Zero manual steps. Cut costs by 67%.

Install
npx -y skills add huzaifa525/claude-code-optimizer --skill refactor

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 9 stars9 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when the user wants to refactor, clean up, restructure, or reorganize existing code without changing behavior.

SKILL.md

1.6 KB, as published. Nobody here has run it

Refactor: $ARGUMENTS

Rules

  • NEVER change behavior — only improve structure
  • ALWAYS run tests before AND after
  • Make small, incremental changes
  • Each change should be independently verifiable

Steps

  1. Run tests first — establish baseline

    [test command]
    

    If tests fail BEFORE refactoring, STOP and tell the user.

  2. Read the code to refactor and understand it fully

  3. Read the tests for this code — understand what behavior is expected

  4. Identify refactoring opportunities:

    • Extract method (function too long)
    • Extract variable (complex expression)
    • Rename for clarity
    • Remove duplication (DRY)
    • Simplify conditionals
    • Replace magic numbers with constants
    • Reduce nesting depth
    • Split large files
    • Improve type safety
  5. Apply changes incrementally

    • One refactoring at a time
    • Run tests after each change
    • If tests fail, revert immediately
  6. Run full test suite

    [test command]
    
  7. Report

    ## Refactoring Summary
    
    ### Changes
    - [what was refactored and why]
    
    ### Before → After
    - [specific improvements]
    
    ### Tests
    - All [X] tests passing
    - No behavior changes
    
<!-- Skill by Huzefa Nalkheda Wala | github.com/huzaifa525 | claude-code-optimizer -->

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.