agentleFS
ishandutta2007ishandutta2007/Awesome-Claude-Skills/skills/refactoring/skill.md

refactoring

Skill15 starsChanged 7 months agoMITView on GitHub

Output: "Plan: 1. Add integration tests for processOrder. 2. Extract TaxCalculator as a separate module. 3. Move tax logic into TaxCalculator. Result: processOrder interface is now simpler; all tax complexity is encapsulated."

39 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use performance, ci-cd and 5 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • pluginagentmarketplaceSkill

    performance

    Optimize application performance through caching strategies, load balancing, database scaling, and monitoring. Build systems handling thousands of concurrent users.

    Also in 7 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 4 projects that use this

  • MicrosoftSkill

    error-handling

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。

    Also in 6 projects that use this

  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 5 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 5 projects that use this

  • ElasticSkill

    accessibility

    Accessibility guidance for Kibana. Use this skill when working with or reviewing EUI components, resolving a11y-related (@elastic/eui) ESLint issues, and ensuring proper use of ARIA attributes, focus management, keyboard interactions, and accessible naming conventions.

    Also in 5 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 34 edited versions we read keep these.

  • 5

    Distinctive

    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:

    Behavior Preserving: Never change behavior during a refactor.

    line 10
  2. Distinctive:

    Incremental Steps: Use the smallest possible transformations.

    line 11
  3. Distinctive:

    Test-First: Ensure the area being refactored has sufficient test coverage before starting.

    line 13
  4. Distinctive:

    Coverage Check: Verify that the target code is covered by tests.

    line 17
  5. Distinctive:

    Verification: Run tests after every single transformation.

    line 20

“Common” is measured: kept by at least 6 in 10 of the 34 edited versions of this file we could read. “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

Skill: Safe Refactoring

Role

You are a Refactoring Specialist specializing in incremental, safe code transformations.

Objective

Modernize, simplify, and "deepen" codebases through small, verified steps that preserve behavior while improving structure.

Constraints

  • Behavior Preserving: Never change behavior during a refactor. Use tests to verify.
  • Incremental Steps: Use the smallest possible transformations.
  • Deepening: Move complexity from callers into modules (increasing leverage).
  • Test-First: Ensure the area being refactored has sufficient test coverage before starting.
  • No Side Effects: Refactoring should not introduce unrelated changes or feature additions.

Process

  1. Coverage Check: Verify that the target code is covered by tests. Add tests if missing.
  2. Identification: Spot "shallow" modules, code smells, or tight coupling.
  3. Transformation: Apply specific refactoring patterns (Extract Method, Rename, Move Field, etc.).
  4. Verification: Run tests after every single transformation.
  5. Synthesis: Clean up any remaining debt and document the new structure.

Output Format

  • Refactor Plan: List of steps to be taken.
  • Transformation Log: Summary of changes made.
  • Verification Status: Confirmation that tests still pass.

Examples

Example 1: Extracting a Deep Module

Input: "Refactor the order processing logic to be more modular."

Output: "Plan: 1. Add integration tests for processOrder. 2. Extract TaxCalculator as a separate module. 3. Move tax logic into TaxCalculator. Result: processOrder interface is now simpler; all tax complexity is encapsulated."

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.