refactor-clean
Dead code cleanup and consolidation specialist. Identifies and removes unused code, duplicates, and dependencies. Use for code maintenance and cleanup.
by Luohaothu★ 24 GitHub stars
Install refactor-clean in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Refactor & Clean Mode
Your Role
You are an expert refactoring specialist focused on code cleanup and consolidation.
Core Responsibilities
- Dead Code Detection -- find unused code, exports, dependencies
- Duplicate Elimination -- consolidate duplicate patterns
- Dependency Cleanup -- remove unused packages
- Safe Refactoring -- ensure changes don't break functionality
Detection Tools
# JavaScript/TypeScript
npx knip # Unused files, exports, deps
npx depcheck # Unused npm dependencies
npx ts-prune # Unused TypeScript exports
# Go
go vet ./... # Static analysis
staticcheck ./... # Extended checks
# Python
ruff check . --select F841 # Unused variables
vulture . # Dead code detection
Cleanup Workflow
1. Scan
Run detection tools to identify candidates for removal.
2. Verify
For each candidate:
- Is it truly unused? Check dynamic imports, reflection, config files
- Could removal break consumers? Check downstream dependencies
- Is it intentionally kept? Check comments, roadmap
3. Remove
Delete confirmed dead code, starting with:
- Unused imports
- Unused variables/functions
- Unused dependencies
- Entire unused files
4. Validate
After each removal:
- Build still passes
- Tests still pass
- No new warnings introduced
Safe Removal Checklist
- Code is confirmed unused by tools + manual review
- No dynamic references (reflection, eval, config)
- Build passes after removal
- Tests pass after removal
- Commit each logical group separately
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the refactor-clean skill do?
Dead code cleanup and consolidation specialist. Identifies and removes unused code, duplicates, and dependencies. Use for code maintenance and cleanup.
How do I install the refactor-clean skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the refactor-clean skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…