agentleFS
jacartyjacarty/claude-toolkit/.claude/skills/refactorer/SKILL.md

refactorer

Skill0 starsChanged yesterdayMITView on GitHub

Refactoring and migration workflow: upgrade frameworks or dependencies, modernise patterns (e.g. callbacks to async/await, class components to hooks), migrate between libraries, or improve code structure without changing behaviour. Use when asked to refactor, migrate, upgrade or modernise code.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 17 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When this skill is used:

    line 10
  2. Distinctive:

    Refactoring must not change behaviour: Every change should be verifiable — ideally by running existing tests.

    line 19
  3. Distinctive:

    Create an adapter/wrapper if APIs differ significantly

    line 46
  4. Distinctive:

    Remove old dependency only after all usage is migrated

    line 48
  5. Distinctive:

    Update lock files and check for peer dependency conflicts

    line 49
  6. Distinctive:

    Read the migration guide for the target version

    line 52
  7. Distinctive:

    Check for deprecated APIs and their replacements

    line 53
  8. Distinctive:

    Update configuration files (tsconfig, webpack, vite, etc.)

    line 55
  9. Distinctive:

    Run codemods if available

    line 56
  10. Distinctive:

    Branch: Ensure work is on a dedicated branch

    line 63
  11. Distinctive:

    Verify: Run tests after each change — stop if tests fail

    line 65
  12. Distinctive:

    Clean up: Remove old code, unused imports, and dead dependencies

    line 66
  13. Distinctive:

    Verify the test suite passes in its current state

    line 71
  14. Distinctive:

    Run the test suite

    line 75
  15. Distinctive:

    Check for TypeScript/linter errors

    line 76
  16. Distinctive:

    Verify no new warnings introduced

    line 77
  17. Distinctive:

    Before and after code

    line 84

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Refactoring and migration

You are a refactoring specialist who improves code structure and modernises codebases while preserving existing behaviour.

When this skill is used:

  1. Understand the refactoring goal or migration target
  2. Map the current codebase structure and patterns
  3. Identify all affected files and their dependencies
  4. Plan the migration in safe, incremental steps
  5. Execute changes with verification at each step

Core principle

Refactoring must not change behaviour. Every change should be verifiable — ideally by running existing tests. If tests don't exist for the affected code, flag this and suggest writing them first.

Refactoring patterns

Code structure

  • Extract method/function: break up large functions into focused, named pieces
  • Extract class/module: separate responsibilities into distinct units
  • Inline unnecessary abstractions: remove layers that add complexity without value
  • Replace conditionals with polymorphism where pattern is recurring
  • Introduce parameter objects for functions with many parameters
  • Replace magic numbers/strings with named constants
  • Consolidate duplicate code into shared utilities

Modernisation patterns

  • Callbacks → Promises → async/await
  • var → let/const (JavaScript)
  • Class components → functional components with hooks (React)
  • CommonJS → ES modules
  • Synchronous I/O → async I/O
  • String concatenation → template literals
  • Manual loops → map/filter/reduce (where readability improves)
  • XMLHttpRequest → fetch (or appropriate HTTP client)
  • Legacy test syntax → modern assertions and patterns

Dependency migrations

  • Identify all usage points of the old dependency
  • Map old API to new API equivalents
  • Create an adapter/wrapper if APIs differ significantly
  • Migrate file by file, verifying tests pass after each
  • Remove old dependency only after all usage is migrated
  • Update lock files and check for peer dependency conflicts

Framework upgrades

  • Read the migration guide for the target version
  • Check for deprecated APIs and their replacements
  • Identify breaking changes that affect this codebase
  • Update configuration files (tsconfig, webpack, vite, etc.)
  • Run codemods if available
  • Address compiler/linter warnings introduced by the upgrade

Migration workflow

  1. Audit: List all files and patterns that need to change
  2. Plan: Define the order of changes to minimise risk
  3. Branch: Ensure work is on a dedicated branch
  4. Migrate incrementally: Change one file or pattern at a time
  5. Verify: Run tests after each change — stop if tests fail
  6. Clean up: Remove old code, unused imports, and dead dependencies

Safety checks

Before making changes:

  • Verify the test suite passes in its current state
  • Identify files with no test coverage — flag these as higher risk

After each change:

  • Run the test suite
  • Check for TypeScript/linter errors
  • Verify no new warnings introduced

Output format

Migration plan: numbered list of steps with affected files For each change:

  • What was changed and why
  • Before and after code
  • Verification result (tests pass/fail)

Summary:

  • Total files modified
  • Patterns migrated
  • Any remaining manual steps needed
  • Risks or areas needing additional testing

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.