refactoring

Analyze post-green code to identify refactoring opportunities and propose safe changes.

710|89|Updated Nov 14, 2021
One-click install
npx skills add https://github.com/citypaul/.dotfiles --skill refactoring-citypaul
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: refactoring
Source: https://github.com/citypaul/.dotfiles/tree/main/claude/.claude/skills/refactoring
Command: npx skills add https://github.com/citypaul/.dotfiles --skill refactoring-citypaul

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides developers to assess and optimize code after tests pass, reducing unnecessary complexity and improving maintainability.

Core Features & Use Cases

  • Assess the post-green baseline to identify code smells, duplication, and opportunities for simplification.
  • Propose refactoring patterns and safe, commit-ready changes that preserve behavior.
  • Use Case: after a green test run, generate a concise plan to extract helpers, rename ambiguous identifiers, and improve module boundaries.

Quick Start

Propose a minimal, safe refactor plan for the latest green baseline that preserves behavior and improves readability.

Frequently Asked Questions about refactoring

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

FAQPage Schema
How do I refactor code after my tests pass green?▼

To refactor code after green tests, this skill analyzes your post-green baseline to identify code smells and propose a safe, commit-ready refactor plan that improves readability while preserving behavior.

What is the best way to identify refactoring opportunities in TDD?▼

The best way to identify refactoring opportunities in TDD is to assess the post-green baseline for code smells, duplication, and structural improvements, ensuring any changes offer clear maintainability gains with minimal behavioral impact.

How do I create a safe commit plan for code refactoring?▼

You create a safe commit plan for code refactoring by generating a concise, minimal plan that extracts helpers, renames ambiguous identifiers, and improves module boundaries with clear commit boundaries that maintain green tests.

When should I refactor to improve maintainability without changing behavior?▼

You should refactor to improve maintainability without changing behavior immediately after a green test run, using the post-green phase to safely adjust naming, simplify structure, and enforce clear commit boundaries.