refactoring-code

Apply bounded, behavior-preserving refactors to reduce code complexity and duplication.

4|1|Updated Jul 23, 2024
One-click install
npx skills add https://github.com/flexigpt/flexigpt-app --skill refactoring-code-flexigpt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring-code
Source: https://github.com/flexigpt/flexigpt-app/tree/main/internal/builtin/skills/software-dev/refactoring-code
Command: npx skills add https://github.com/flexigpt/flexigpt-app --skill refactoring-code-flexigpt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Selects and performs bounded, behavior-preserving refactors to reduce complexity, duplication, coupling, and change risk without rewriting functionality.

Core Features & Use Cases

  • Bounded cleanup and modernization of a codebase to improve testability and maintainability without altering external behavior.
  • Execution model-guided workflow that progresses through slice-selection, refactor-plan, and refactor-apply with safety checks and rollback guidance.
  • Accepts inputs from a workspace (attached files or pasted code) to determine the most impactful debt-slice and plan a minimal-change path.

Quick Start

Describe the code area to refactor and confirm a bounded, behavior-preserving plan for refactoring.

Frequently Asked Questions about refactoring-code

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

FAQPage Schema
What is a bounded, behavior-preserving code refactor?

A bounded, behavior-preserving code refactor reduces complexity, duplication, and coupling within a specific file, module, or subsystem without altering external functionality. It targets a minimal debt-slice to lower change risk while maintaining existing software behavior.

How do I tackle technical debt without rewriting functionality?

To tackle technical debt without rewriting functionality, apply a staged execution model: slice-selection identifies the most impactful area, refactor-plan maps a minimal-change path, and refactor-apply executes with strict safety checks and rollback guidance.

What is the best way to reduce complexity and duplication in legacy code?

The best way to reduce complexity in legacy code is performing bounded cleanup and modernization. This improves testability and maintainability by selecting a specific debt-slice and planning a minimal-change refactoring path rather than executing a full rewrite.

Can I refactor a specific subsystem if I only paste the code?

Yes, you can refactor a specific subsystem by pasting the code or attaching files to the workspace. The process analyzes the provided workspace inputs to determine the most impactful debt-slice and generates a bounded refactoring plan.

When should I not use a bounded refactoring approach?

You should not use a bounded refactoring approach when your goal is to alter external behavior or completely rewrite functionality. This method is strictly designed for behavior-preserving code cleanup, complexity reduction, and risk mitigation.

How does the refactor execution model handle rollback and safety?

The refactor execution model handles rollback and safety by progressing through slice-selection, refactor-plan, and refactor-apply stages with strict safety checks. It provides explicit rollback guidance to ensure behavior-preserving changes and minimize risk.