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.

58 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ci-cd, dependency-management and 9 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.
  • JohnJBorenSkill

    ci-cd

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

    Also in 5 projects that use this

  • dkprogSkill

    dependency-management

    Apply when wiring dependencies, integrating external services, or designing interfaces between modules. Ensures loose coupling through dependency injection, interface segregation, and proper abstraction boundaries.

    Also in 3 projects that use this

  • javalenciacaiSkill

    multi-agent-orchestration

    Design and coordinate multi-agent systems where specialized agents work together to solve complex problems. Covers agent communication, task delegation, workflow orchestration, and result aggregation. Use when building coordinated agent teams, complex workflows, or systems requiring specialized expertise across domains.

    Also in 3 projects that use this

  • harrissohail6Skill

    database-design

    Database schema design and SQL best practices. Use when designing tables, writing queries, or optimizing database performance.

    Also in 5 projects that use this

  • MicrosoftSkill

    error-handling

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

    Also in 7 projects that use this

  • klauswgSkill

    performance

    Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".

    Also in 7 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 53 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 53 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.

Reviews can't be read right now.

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.