refactor

Refactor code incrementally with tests and frequent commits.

2|Updated Nov 17, 2025
One-click install
npx skills add https://github.com/edyhvh/davar --skill refactor-edyhvh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/edyhvh/davar/tree/main/.github/skills/refactor-pro
Command: npx skills add https://github.com/edyhvh/davar --skill refactor-edyhvh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactor code safely without changing external behavior.

Core Features & Use Cases

  • Incremental improvements: Make small, testable changes to steadily improve code quality.
  • Structured refactoring: Extract methods, rename variables, and decompose large classes for clarity.
  • Use Case: When a module has god functions or duplicated logic, apply this skill to improve structure without introducing behavior changes.

Quick Start

Start by identifying a small, low-risk refactor target (e.g., extracting a long function). Create a minimal test, extract the new function, run tests, and commit the change.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I refactor large functions without changing external behavior?

Refactor large functions safely by extracting methods, renaming variables, and breaking down code incrementally. This approach improves structure while ensuring behavior remains stable through frequent commits and test verification.

What is the best way to eliminate code smells in an existing codebase?

Eliminate code smells by applying structured refactoring techniques like extracting functions, renaming variables, and applying design patterns. This improves code maintainability without altering the program's external behavior.

Do I need tests before starting an incremental refactoring workflow?

Yes, you need minimal tests before refactoring to ensure behavior remains stable. Creating a test for the target code allows you to verify that extracting functions or renaming variables introduces no unintended changes.

How do I decompose god functions with duplicated logic safely?

Decompose god functions by extracting duplicated logic into new methods incrementally. Apply a disciplined workflow of creating tests, extracting functions, running tests, and committing small changes to maintain stable behavior.

When should I apply design patterns during code refactoring?

Apply design patterns during refactoring when a module has god functions or duplicated logic. Use patterns alongside variable renaming and type safety improvements to clarify structure without changing external behavior.