refactoring-patterns

Identify code smells and recommend test-backed refactorings that preserve behavior.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/JoaoPedroAmaral/backBarbearia --skill refactoring-patterns-joaopedroamaral
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring-patterns
Source: https://github.com/JoaoPedroAmaral/backBarbearia/tree/main/.claude/skills/refactoring-patterns
Command: npx skills add https://github.com/JoaoPedroAmaral/backBarbearia --skill refactoring-patterns-joaopedroamaral

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured approach to improving code quality, readability, and maintainability by identifying code smells and guiding safe refactors that do not change behavior.

Core Features & Use Cases

  • Identify common code smells such as duplicate code, long methods, long parameter lists, magic numbers, dead code, and unclear names.
  • Safe refactoring workflow: baseline measurement, ensure tests, refactor in small steps, verify changes, and commit atomically.
  • Use Case: Convert duplicated business logic spread across multiple classes into a single shared service with accompanying unit tests and measured complexity reduction.

Quick Start

Ask the skill to analyze a code snippet and propose a small, test-backed refactor that preserves behavior and removes duplication.

Frequently Asked Questions about refactoring-patterns

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

FAQPage Schema
How do I remove duplicate code and long methods without changing behavior?

Refactoring duplicate code and long methods without changing behavior requires identifying code smells, ensuring changes are backed by tests, performing small atomic commits, and verifying the test suite passes. This approach preserves functionality while improving readability and maintainability.

What are common code smells to look for before refactoring?

Common code smells include duplicate code, long methods, long parameter lists, magic constants, dead code, and unclear names. Identifying these issues is the first step to improving code quality and maintainability through targeted, test-backed refactoring.

What is the best way to refactor a codebase safely?

The best way to refactor safely involves baseline measurement of complexity and coverage, ensuring adequate tests exist, refactoring in small steps, verifying changes by running the test suite, and committing atomically to preserve behavior throughout the process.

Can I use this refactoring workflow for large enterprise codebases?

This refactoring workflow is designed for developers and teams working on small- to medium-sized codebases. It targets iterative refactor sessions addressing specific issues like duplicate logic and long parameter lists, making it less suitable for large enterprise environments.

Do I need unit tests before starting a code refactor?

Yes, unit tests are required before starting a code refactor. Changes must be backed by tests and verified by running the test suite before and after modifications to ensure the refactoring preserves behavior and reduces complexity safely.