refactor

Refactor code safely with mandatory baseline tests and Gradle verification.

2|Updated Jan 22, 2026
One-click install
npx skills add https://github.com/abnegate/claudes --skill refactor-abnegate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/abnegate/claudes/tree/main/skills/refactor
Command: npx skills add https://github.com/abnegate/claudes --skill refactor-abnegate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents risky refactors by enforcing that all tests pass both before and after changes, reducing the chance of subtle behavior regressions.

Core Features & Use Cases

  • Baseline discovery in parallel: Collects a coverage report, runs the full test suite, and analyzes the refactoring scope to understand impacted APIs and edge cases.
  • Test gap filling with prioritization: Identifies uncovered branches, missing edge-case tests, and untested error paths, then writes characterization tests to lock in current behavior.
  • Stepwise safe refactoring workflow: Plans refactor steps, validates the plan, executes changes using isolated parallel worktrees where possible, and consolidates safely.
  • Review and final verification: Runs a reviewer pass over the full diff and performs post-refactor verification to confirm tests and behavior preservation.

Quick Start

Ask the AI to refactor the targeted code described as file(s) and intent, for example: "Refactor $ARGUMENTS while ensuring no behavior changes and that all Gradle tests pass before and after."

Frequently Asked Questions about refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely refactor code without breaking existing behavior?

To safely refactor code without breaking behavior, run the full test suite before and after modifications to establish a baseline. Identifying public APIs and writing characterization tests for uncovered branches locks in current functionality during changes.

What are characterization tests and when do I need them for a refactoring project?

Characterization tests lock in the current behavior of existing code before you refactor it. You need them when test coverage is insufficient, ensuring untested edge cases and error paths are documented to prevent regressions during structural changes.

How do I ensure my Gradle test coverage is sufficient before a major module refactor?

To ensure Gradle test coverage is sufficient before a module refactor, generate a baseline coverage report and run the full test suite. This identifies uncovered branches and missing edge-case tests that must be addressed before making safe changes.

Can I execute cross-cutting refactor requests using isolated Git worktrees?

Yes, you can execute cross-cutting refactor requests using isolated parallel worktrees. This planner and verifier workflow validates the refactor plan in separate architect worktrees, allowing safe stepwise changes before consolidating the final diff.

What is the best way to manage safe code changes when dealing with untested error paths?

The best way to manage safe code changes with untested error paths is to first fill the test gaps with prioritized characterization tests. This discovers and locks in the current behavior of error paths before executing any stepwise refactoring workflow.

Why does my refactoring workflow fail if the koverReport coverage thresholds are not met?

Your refactoring workflow fails because koverReport coverage thresholds enforce mandatory baseline testing standards. This prevents risky refactors by ensuring all public APIs and edge cases are adequately tested before and after code modifications.