refactor-pass
Performs an automated refactor pass on recent code changes to improve simplicity, remove dead code, and straighten logic flows. It includes a critical step to verify behavior by running build/tests after modifications.
About this skill
This AI agent skill automates the crucial task of performing a 'refactor pass' on code that has recently been modified. Its primary goal is to enhance the overall simplicity, readability, and maintainability of the codebase. The skill systematically identifies and addresses common issues such as the presence of dead code, overly complex logic flows, excessive function parameters, and premature optimizations, ensuring the code adheres to best practices for cleanliness and efficiency. Developers can leverage this skill after implementing new features, fixing bugs, or making any significant code alterations where the immediate focus was functionality rather than optimal structure. By delegating this cleanup phase to an AI agent, teams can maintain a consistently high standard of code quality without requiring manual, time-consuming refactoring efforts. A key benefit is the integrated step of running build and test suites post-refactoring, which provides a safety net by verifying that all changes preserve the original functionality and do not introduce regressions.
Best use case
This skill is ideal for individual developers and development teams committed to maintaining robust and easily understandable codebases. Its primary use case is to clean up and solidify code after initial development or modification, ensuring that new contributions integrate seamlessly and do not accumulate technical debt. It's particularly beneficial before submitting code for review or merging branches, guaranteeing that the codebase remains lean, logical, and maintainable.
Performs an automated refactor pass on recent code changes to improve simplicity, remove dead code, and straighten logic flows. It includes a critical step to verify behavior by running build/tests after modifications.
Users should expect cleaner, simpler, and more readable code that maintains its original behavior, confirmed by passing builds and tests.
Practical example
Example input
Okay, I've finished implementing the new user authentication flow. Could you perform a refactor pass focused on simplicity and remove any dead code before I submit it for review? Ensure all tests still pass.
Example output
Refactor pass completed. Simplified `AuthService` logic and removed unused code in `UserRepository`. All builds and tests passed, ensuring functionality is preserved. Ready for your review.
When to use this skill
- After completing a new feature implementation or bug fix, before final commit.
- When a user explicitly requests a 'refactor pass,' 'cleanup,' 'simplification,' or 'dead-code removal.'
- To straighten complex logic flows or reduce excessive parameters in recently changed code.
- When you need to verify code correctness through builds and tests after refactoring.
When not to use this skill
- When the task involves adding new features or extending existing functionality.
- For major architectural overhauls or significant design changes requiring deep human insight.
- If the codebase is entirely new and has no 'recent changes' to simplify.
- When the primary goal is performance optimization that requires complex algorithmic changes, rather than structural simplification.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/refactor-pass/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How refactor-pass Compares
| Feature / Agent | refactor-pass | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
Performs an automated refactor pass on recent code changes to improve simplicity, remove dead code, and straighten logic flows. It includes a critical step to verify behavior by running build/tests after modifications.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
SKILL.md Source
# Refactor Pass ## Workflow 1. Review the changes just made and identify simplification opportunities. 2. Apply refactors to: - Remove dead code and dead paths. - Straighten logic flows. - Remove excessive parameters. - Remove premature optimization. 3. Run build/tests to verify behavior. 4. Identify optional abstractions or reusable patterns; only suggest them if they clearly improve clarity and keep suggestions brief.
Related Skills
laravel-expert
Senior Laravel Engineer role for production-grade, maintainable, and idiomatic Laravel solutions. Focuses on clean architecture, security, performance, and modern standards (Laravel 10/11+).
debug-nw
Debug a Nativewind v5 setup issue. Walks through common configuration problems with metro, babel, postcss, and dependencies.
Go Production Engineering
You are a Go production engineering expert. Follow this system for every Go project — from architecture decisions through production deployment. Apply phases sequentially for new projects; use individual phases as needed for existing codebases.
Database Engineering Mastery
> Complete database design, optimization, migration, and operations system. From schema design to production monitoring — covers PostgreSQL, MySQL, SQLite, and general SQL patterns.
afrexai-code-reviewer
Enterprise-grade code review agent. Reviews PRs, diffs, or code files for security vulnerabilities, performance issues, error handling gaps, architecture smells, and test coverage. Works with any language, any repo, no dependencies required.
API Documentation Generator
Generate production-ready API documentation from endpoint descriptions. Outputs OpenAPI 3.0, markdown reference docs, and SDK quickstart guides.
bili-rs
Development skill for bili-rs, a Rust CLI tool for Bilibili (B站). Use when implementing features, fixing bugs, or extending the bilibili-cli-rust codebase. Provides architecture conventions, API endpoints, coding patterns, and project-specific constraints. Triggers on tasks involving adding CLI commands, calling Bilibili APIs, handling authentication, implementing output formatting, or working with the layered cli/commands/client/payloads architecture.
Puppeteer
Automate Chrome and Chromium with Puppeteer for scraping, testing, screenshots, and browser workflows.
pharaoh
Codebase knowledge graph with 23 development workflow skills. Query architecture, dependencies, blast radius, dead code, and test coverage via MCP. Requires GitHub App installation (read-only repo access) and OAuth authentication. Connects to external MCP server at mcp.pharaoh.so.
git-commit-helper
Generate standardized git commit messages following Conventional Commits format. Use this skill when the user asks to commit code, write a commit message, or create a git commit. Enforces team conventions for type prefixes, scope naming, message length, and breaking change documentation.
ask-claude
Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).
bnbchain-mcp
Interact with the BNB Chain Model Context Protocol (MCP) server. Blocks, contracts, tokens, NFTs, wallet, Greenfield, and ERC-8004 agent tools. Use npx @bnb-chain/mcp@latest or read the official skill page.