agentleFS
gologo13gologo13/agent-skills/skills/refactor-code/SKILL.md

refactor-code

Skill0 starsChanged 9 months agoMITView on GitHub

Refactor the selected code to improve its quality while maintaining the same functionality, ...; keywords: performance, refactor, coverage, error. Use only on explicit request; skip in routine implementation discussions.

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 2

    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:

    Add appropriate comments where needed

    line 26
  2. Distinctive:

    Follow SOLID principles and design patterns

    line 27

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

Overview

Refactor the selected code to improve its quality while maintaining the same functionality, providing the refactored code with explanations of the improvements made.

Steps

  1. Code Quality Improvements
    • Extract reusable functions or components
    • Eliminate code duplication
    • Improve variable and function naming
    • Simplify complex logic and reduce nesting
  2. Performance Optimizations
    • Identify and fix performance bottlenecks
    • Optimize algorithms and data structures
    • Reduce unnecessary computations
    • Improve memory usage
  3. Maintainability
    • Make the code more readable and self-documenting
    • Add appropriate comments where needed
    • Follow SOLID principles and design patterns
    • Improve error handling and edge case coverage

Refactor Code Checklist

  • Extracted reusable functions or components
  • Eliminated code duplication
  • Improved variable and function naming
  • Simplified complex logic and reduced nesting
  • Identified and fixed performance bottlenecks
  • Optimized algorithms and data structures
  • Made code more readable and self-documenting
  • Followed SOLID principles and design patterns
  • Improved error handling and edge case coverage

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.