refactor-assist
Get refactoring suggestions with colored diffs. Use when improving code quality.
Why use this skill?
Optimize your codebase with AI-powered refactoring. Get instant, diff-based code quality improvements and modern pattern suggestions directly in your CLI.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/lxgicstudios/refactor-assistWhat This Skill Does
The refactor-assist skill is a sophisticated developer-centric tool designed to help programmers improve code quality, readability, and performance. By leveraging GPT-4o-mini, this agent parses your source code files, identifies technical debt, suggests modern pattern adoption, and provides actionable, human-readable diffs for your files. It acts as an automated pair programmer that focuses on the nuances of syntax, complexity, and maintainability, ensuring that your codebase evolves alongside best practices without the need for manual configuration.
Installation
To integrate this tool into your OpenClaw ecosystem, execute the following command in your terminal: clawhub install openclaw/skills/skills/lxgicstudios/refactor-assist. Once installed, ensure that your environment is configured with the OPENAI_API_KEY variable, as the tool relies on external intelligence to perform its analysis. No complex setup or long-term configuration files are required; it is designed for instantaneous execution using the npx ai-refactor command pattern.
Use Cases
- Technical Debt Reduction: Systematically clean up legacy functions or classes that have accumulated complexity over time.
- Code Review Preparation: Generate a high-quality audit of your files before submitting pull requests to ensure your team sees your best work.
- Learning New Patterns: Use the assistant to suggest how to refactor old imperative code into modern functional or reactive patterns.
- Documentation Alignment: Ensure that your code implementation strictly matches your internal project standards through automated suggestions.
- Performance Tuning: Identify bottlenecks where code logic might be inefficient and receive diff-based optimizations.
Example Prompts
- "Refactor the user-auth.ts file to use more modern error handling patterns and improve type safety."
- "Please check src/components/Sidebar.tsx and suggest changes that improve performance and readability; apply the changes directly if they look good."
- "Run a refactor analysis on data-utils.js and focus specifically on reducing cyclomatic complexity in the processing functions."
Tips & Limitations
Always treat the output of refactor-assist as a suggestion rather than an absolute source of truth. Because the tool uses external AI, it may occasionally overlook context unique to your complex build systems. Always commit your changes to a clean git branch before applying suggested diffs so you can easily revert if a suggestion breaks existing logic. It is highly recommended to run your full suite of unit tests immediately after applying any automatic changes. Avoid mass-refactoring the entire project at once; instead, use the focus flag to target specific modules or files to ensure you maintain complete control over the impact of the changes.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-lxgicstudios-refactor-assist": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, file-write, external-api
Related Skills
script-gen
Generate package.json scripts with AI. Use when setting up npm scripts.
email-template-gen
Generate responsive email templates. Use when building transactional emails.
branch-namer
Generate descriptive git branch names from plain English. Use when you need a branch name that follows conventions.
cloudflare-gen
Generate Cloudflare Workers configuration and code. Use when building on the edge.
adr-writer
Generate Architecture Decision Records with AI. Use when documenting technical decisions.