refactor-extract

Extract duplicated or complex code blocks into reusable pure functions.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/CaptainPhantasy/floyd-v5 --skill refactor-extract
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-extract
Source: https://github.com/CaptainPhantasy/floyd-v5/tree/main/extensibility/skills/refactoring/refactor-extract
Command: npx skills add https://github.com/CaptainPhantasy/floyd-v5 --skill refactor-extract

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identify and resolve code smells by extracting duplications and overly complex blocks into pure, reusable functions.

Core Features & Use Cases

  • Detect DRY violations and long functions, then extract into clean helpers.
  • Improve maintainability, testability, and readability across modules.
  • Use Case: refactor a module with repeated logic to reusable utilities and simplify branching.

Quick Start

Please provide a sample file or snippet and request refactoring to extract reusable functions.

Frequently Asked Questions about refactor-extract

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

FAQPage Schema
How do I refactor duplicated code into reusable pure functions?

To refactor duplicated code into reusable pure functions, provide your code snippet and request extraction. The process identifies DRY violations and complex blocks, transforming them into clean, test-friendly helpers while preserving original behavior.

What is the best way to reduce maintenance effort for long functions with tangled logic?

Reducing maintenance effort for long functions involves extracting tangled logic into pure, reusable functions. This simplifies branching and improves readability across modules, ensuring safe transformations that keep the codebase maintainable.

Does this refactoring approach work across different programming languages?

Yes, this refactoring approach works across different programming languages. It applies to any codebase with DRY violations, long functions, or tangled logic, allowing you to extract clean helpers regardless of the specific module or language.

How do I extract reusable utility functions without breaking existing behavior?

To extract reusable utility functions without breaking existing behavior, the refactoring process applies safe transformations. It preserves the original logic while simplifying branching and converting complex blocks into test-friendly pure functions.

When do I need to extract pure functions from my codebase?

You need to extract pure functions when your codebase suffers from DRY violations, long functions, or repeated logic across modules. This technique reduces maintenance effort and improves the testability and readability of your software.

Can I use this to simplify branching and repeated logic in a single module?

Yes, you can use this to simplify branching and repeated logic in a single module. It detects duplications and overly complex blocks, extracting them into clean helpers to resolve code smells and improve overall maintainability.