agentleFS
Mingo07-devMingo07-dev/claude_skills/refactoring/SKILL.md

refactoring

Skill2 starsChanged 7 months agoApache-2.0View on GitHub

Refactor code for readability and structure without changing behavior. Use when the user asks to refactor, clean up, improve readability, rename variables, extract functions, or reduce code smells. Runs a two-subagent pipeline: reader/planner then executor.

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 10 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

  • CloudAI-XSkill

    database-design

    Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.

    Also in 5 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 14 projects that use this

  • AnthropicSkill

    documentation

    Write and maintain technical documentation. Trigger with "write docs for", "document this", "create a README", "write a runbook", "onboarding guide", or when the user needs help with any form of technical writing — API docs, architecture docs, or operational runbooks.

    Also in 8 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 34 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run tests if present and save baseline output

    line 33
  2. Very specific:

    Use the checklist and plan format in references/checklist.md.

    line 38
  3. Very specific:

    Write the plan to /tmp/refactoring-plan.md.

    line 39
  4. Distinctive:

    Do not rename public APIs without explicit confirmation.

    line 56

“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

Refactoring pipeline (two subagents)

When to use

  • Code is hard to read or maintain
  • Functions are too long or doing too many things
  • Naming is unclear or inconsistent
  • The user explicitly asks for refactoring or clean code

Goal

Produce human-readable, well-structured code without behavior changes.

Pipeline overview

Parent Agent
  -> Subagent 1: Reader/Planner (analyze, plan, no edits)
  -> Subagent 2: Executor (apply plan, run tests, report)

Phase 1: Parent scope and baseline

  1. Determine scope (files, directory, or full codebase)
  2. Scan for existing tests
  3. Run tests if present and save baseline output
  4. Pass scope and context to Subagent 1

Phase 2: Subagent 1 (Reader/Planner)

Use the checklist and plan format in references/checklist.md. Write the plan to /tmp/refactoring-plan.md.

Phase 3: Subagent 2 (Executor)

Apply the plan from /tmp/refactoring-plan.md and follow the execution rules in references/execution.md. Write REFACTORING_REPORT.md.

Phase 4: Parent validation

  1. Read REFACTORING_REPORT.md
  2. Compare tests vs baseline (if any)
  3. Summarize changes and deviations

Notes

  • Subagent 1 never edits files.
  • Subagent 2 must follow the plan exactly.
  • Do not rename public APIs without explicit confirmation.

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.