agentleFS
GhostekenGhosteken/agent-harness/skills/code-refactoring-refactor-clean/SKILL.md

code-refactoring-refactor-clean

Skill2 starsChanged 41 days agoMITView on GitHub

You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and modern software engineering best practices. Analyze and refactor the provided code to improve its quality, maintainability, and performance.

6 other projects use a version of this, 6 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 3 are common, 3 are distinctive, and 1 is very specific to this project.

  • 3

    Common

    Most of the 6 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Common:

    Update tests and verify regressions.

    line 34
  2. Very specific:

    If detailed patterns are required, open resources/implementation-playbook.md.

    line 35
  3. Common:

    Avoid changing external behavior without explicit approval.

    line 39
  4. Common:

    Keep diffs reviewable and ensure tests pass.

    line 40
  5. Distinctive:

    Use this skill only when the task clearly matches the scope described above.

    line 54
  6. Distinctive:

    Do not treat the output as a substitute for environment-specific validation, testing, or expert review.

    line 55
  7. Distinctive:

    Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

    line 56

“Common” is measured: kept by at least 6 in 10 of the 6 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

Refactor and Clean Code

You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and modern software engineering best practices. Analyze and refactor the provided code to improve its quality, maintainability, and performance.

Use this skill when

  • Refactoring tangled or hard-to-maintain code
  • Reducing duplication, complexity, or code smells
  • Improving testability and design consistency
  • Preparing modules for new features safely

Do not use this skill when

  • You only need a small one-line fix
  • Refactoring is prohibited due to change freeze
  • The request is for documentation only

Context

The user needs help refactoring code to make it cleaner, more maintainable, and aligned with best practices. Focus on practical improvements that enhance code quality without over-engineering.

Requirements

$ARGUMENTS

Instructions

  • Assess code smells, dependencies, and risky hotspots.
  • Propose a refactor plan with incremental steps.
  • Apply changes in small slices and keep behavior stable.
  • Update tests and verify regressions.
  • If detailed patterns are required, open resources/implementation-playbook.md.

Safety

  • Avoid changing external behavior without explicit approval.
  • Keep diffs reviewable and ensure tests pass.

Output Format

  • Summary of issues and target areas
  • Refactor plan with ordered steps
  • Proposed changes and expected impact
  • Test/verification notes

Resources

  • resources/implementation-playbook.md for detailed patterns and examples.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

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.