refactor-assist
Get refactoring suggestions with colored diffs. Use when improving code quality.
Why use this skill?
Use the refactor-assist skill to improve code quality, reduce technical debt, and generate actionable diffs for your project using AI-powered insights.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/lxgicstudios/refactorerWhat This Skill Does
The refactor-assist skill is an intelligent code-optimization agent designed to streamline the technical debt reduction process. It functions by analyzing your source code files and identifying opportunities to improve readability, modularity, performance, and type safety. Rather than just offering vague advice, it provides actionable, color-coded diffs that allow developers to visualize exactly how the code will change before any modifications are committed. By leveraging GPT-4o-mini, the tool suggests modern design patterns and helps simplify complex logic into maintainable, cleaner syntax, acting as a professional pair programmer that never tires.
Installation
Installation is seamless through the OpenClaw ecosystem. You can add this capability directly to your agent environment by running the following command in your terminal: clawhub install openclaw/skills/skills/lxgicstudios/refactorer. Once installed, ensure that you have your OPENAI_API_KEY set in your environment variables, as the tool requires this to perform the semantic analysis of your codebase. No complex configuration files are needed; once installed, it is ready to analyze your repository files immediately.
Use Cases
This skill is perfect for developers managing legacy codebases who need to identify potential bottlenecks or overly complex functions. It is highly effective during code review preparation, allowing you to clean up your PRs before submitting them to human reviewers. Additionally, it serves as an excellent educational tool, helping junior developers learn better patterns by showing them how their code can be improved by an expert model. It is particularly useful during technical debt sprints where the goal is to improve code health without necessarily adding new features.
Example Prompts
- "Refactor the authentication logic in src/auth/guard.ts and suggest improvements for better error handling and cleaner code structure."
- "Analyze src/utils/formatters.ts and provide a diff to optimize the string manipulation functions for better performance."
- "Review the logic in src/api/client.ts and apply changes that improve type safety and remove code duplication using the --apply flag."
Tips & Limitations
To maximize the utility of the refactor-assist skill, always ensure you have a clean git state before running the tool, as this allows you to easily diff the proposed changes against your working directory. While the tool is powerful, it is critical to manually verify all suggestions; automated refactoring is a great aid but does not replace human testing. Always run your existing test suite immediately after applying changes to ensure that functionality remains intact. Avoid passing excessively large files to the tool to ensure the best analysis accuracy, and remember that it works best when focused on specific concerns or logical units rather than broad, undefined requests.
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-refactorer": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-write, file-read, 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.