Safe Refactor

🌐Community
by phar-dev · vlatest · Repository

Safely refactors PHP code within phar archives, minimizing breakage and ensuring continued functionality for backend applications.

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 phar-dev-safe-refactor npx -- -y @trustedskills/phar-dev-safe-refactor
2

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

~/.claude/settings.json
{
  "mcpServers": {
    "phar-dev-safe-refactor": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/phar-dev-safe-refactor"
      ]
    }
  }
}

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

About This Skill

What it does

This skill, safe-refactor, automatically refactors PHP code to improve its structure and readability while maintaining functionality. It identifies potential areas for improvement such as duplicated code or inefficient logic and applies safe, tested transformations. The goal is to reduce technical debt and make the codebase easier to maintain without introducing regressions.

When to use it

  • Legacy Codebase Cleanup: Refactor older PHP projects with accumulated complexity.
  • Code Review Assistance: Quickly identify and suggest improvements during code reviews.
  • Automated Style Improvements: Enforce consistent coding standards across a team.
  • Preparing for Feature Development: Clean up existing code before adding new features to reduce risk of introducing bugs.

Key capabilities

  • Automatic refactoring suggestions
  • Code duplication detection and removal
  • Logic optimization
  • Maintains functionality through testing

Example prompts

  • "Refactor this PHP function to improve its readability: [code snippet]"
  • "Find and eliminate duplicated code in this file: [file path]"
  • "Suggest improvements for the efficiency of this class: [class name]"

Tips & gotchas

  • The skill relies on automated testing; ensure adequate test coverage exists before running refactoring operations.
  • Review all suggested changes carefully, as automatic refactoring may not always be optimal in every situation.

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
phar-dev
Installs
3

🌐 Community

Passed automated security scans.