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.

5 stars
Complexity: easy

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

$curl -o ~/.claude/skills/refactor-pass/SKILL.md --create-dirs "https://raw.githubusercontent.com/alexsee/bsh3/main/.agents/skills/refactor-pass/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/refactor-pass/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How refactor-pass Compares

Feature / Agentrefactor-passStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/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

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

31392
from sickn33/antigravity-awesome-skills

Senior Laravel Engineer role for production-grade, maintainable, and idiomatic Laravel solutions. Focuses on clean architecture, security, performance, and modern standards (Laravel 10/11+).

Coding & DevelopmentClaude

debug-nw

7754
from nativewind/nativewind

Debug a Nativewind v5 setup issue. Walks through common configuration problems with metro, babel, postcss, and dependencies.

Coding & Development

Go Production Engineering

3891
from openclaw/skills

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.

Coding & Development

Database Engineering Mastery

3891
from openclaw/skills

> Complete database design, optimization, migration, and operations system. From schema design to production monitoring — covers PostgreSQL, MySQL, SQLite, and general SQL patterns.

Coding & Development

afrexai-code-reviewer

3891
from openclaw/skills

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.

Coding & Development

API Documentation Generator

3891
from openclaw/skills

Generate production-ready API documentation from endpoint descriptions. Outputs OpenAPI 3.0, markdown reference docs, and SDK quickstart guides.

Coding & Development

bili-rs

3891
from openclaw/skills

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.

Coding & Development

Puppeteer

3891
from openclaw/skills

Automate Chrome and Chromium with Puppeteer for scraping, testing, screenshots, and browser workflows.

Coding & Development

pharaoh

3891
from openclaw/skills

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.

Coding & Development

git-commit-helper

3891
from openclaw/skills

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.

Coding & Development

ask-claude

3891
from openclaw/skills

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.).

Coding & Development

bnbchain-mcp

3891
from openclaw/skills

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.

Coding & Development