refactor

Identify code smells and plan behavior-preserving refactors in TypeScript and Python.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/saranskumar/anti-slop --skill refactor-saranskumar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/saranskumar/anti-slop/tree/main/skills/refactor
Command: npx skills add https://github.com/saranskumar/anti-slop --skill refactor-saranskumar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactoring is the discipline of improving code structure without changing behavior. Every change that makes code easier to read, maintain, or extend, while preserving existing behavior, reduces technical debt and future risk.

Core Features & Use Cases

  • Identify code smells, duplication, and overly complex modules to target for improvement.
  • Modularize large files into cohesive units with clear responsibility boundaries, without changing behavior.
  • Use Case: A legacy module with deeply nested logic is reorganized into smaller, well-named helpers with preserved functionality.

Quick Start

Analyze a target module, identify code smells, and propose a safe, incremental refactor plan that preserves behavior.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I refactor legacy code with deeply nested logic without changing its behavior?

To refactor nested legacy code safely, you must enforce tests before refactoring, then apply clear naming and modularization through incremental changes. This preserves existing behavior while reorganizing large modules into smaller, well-named helpers with cohesive responsibility boundaries.

What is the best way to identify code smells and duplication in a large TypeScript or Python codebase?

Identifying code smells and duplication in large TypeScript or Python codebases involves analyzing target modules to detect overly complex logic and repeated patterns. This process targets specific areas for improvement to reduce technical debt while maintaining functionality.

Can I modularize large files into cohesive units across different programming languages?

Yes, you can modularize large files across languages like TypeScript and Python. The process targets mid-to-large codebases, splitting complex modules into smaller, cohesive units with clear responsibility boundaries without altering the external behavior.

Do I need to write tests before refactoring code to improve readability?

Yes, enforcing tests before refactoring is a strict requirement. Writing tests first ensures you can safely improve code readability and apply incremental changes while verifying that the existing behavior remains completely preserved throughout the process.

How do I create a safe incremental refactor plan for technical debt reduction?

A safe incremental refactor plan is created by analyzing a target module, identifying specific code smells, and proposing step-by-step changes. This methodical approach reduces technical debt and future risk by ensuring each modification preserves behavior.

When should I avoid refactoring a module in a mid-to-large codebase?

You should avoid refactoring mid-to-large codebase modules when there are no existing tests to verify behavior. Without test coverage to enforce behavior preservation, making incremental changes or modularizing files introduces significant risk of breaking functionality.