Refactoring

🌐Community
by s-hiraoku · vlatest · Repository

Automates complex backend code refactoring tasks, improving maintainability and performance based on s-hiraoku's proven patterns.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add s-hiraoku-refactoring npx -- -y @trustedskills/s-hiraoku-refactoring
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "s-hiraoku-refactoring": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/s-hiraoku-refactoring"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill automates complex backend code refactoring tasks, improving maintainability and performance using established patterns. Refactoring involves restructuring existing computer code without altering its external behavior. The skill focuses on applying core refactoring patterns such as extracting methods, inlining methods, moving logic between objects, simplifying conditional expressions, and improving naming conventions.

When to use it

  • When encountering duplicated code ("Rule of Three").
  • When dealing with long methods or large classes (code smells).
  • Before adding new features to simplify the implementation process.

Key capabilities

  • Extract Method: Transforms a fragment of an existing method into a new, separate method.
  • Inline Method: Moves the body of a simple method directly into its callers and removes the original method.
  • Move Method/Field: Relocates code or fields to more appropriate classes to reduce coupling.
  • Decompose Conditional: Extracts complex conditional logic into clearly named methods.
  • Consolidate Conditional Expression: Merges multiple conditional checks that result in the same outcome.
  • Rename: Improves code clarity by using intention-revealing names for variables, methods and classes.
  • Replace Magic Number with Symbolic Constant: Substitutes literal numbers with named constants to enhance readability.

Example prompts

  • "Refactor this method to extract a smaller helper function."
  • "Can you move this field to the appropriate class?"
  • "Simplify this conditional expression."

Tips & gotchas

  • Ensure a comprehensive test suite is in place before starting any refactoring.
  • Make small, incremental changes and run tests frequently after each step.
  • Commit your code often after verifying each refactoring step.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
s-hiraoku
Installs
32

🌐 Community

Passed automated security scans.