refactoring-patterns

Detect code smells and generate testable refactoring plans for TypeScript/JavaScript codebases.

207|31|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/AbsolutelySkilled/AbsolutelySkilled --skill refactoring-patterns-absolutelyskilled
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactoring-patterns
Source: https://github.com/AbsolutelySkilled/AbsolutelySkilled/tree/main/skills/refactoring-patterns
Command: npx skills add https://github.com/AbsolutelySkilled/AbsolutelySkilled --skill refactoring-patterns-absolutelyskilled

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Refactoring-patterns provides a structured vocabulary and proven best practices to identify code smells and apply safe, repeatable transformations that improve readability, reduce duplication, and preserve behavior across codebases.

Core Features & Use Cases

  • Detects common smells (long methods, too many parameters, duplicated code) and recommends targeted, testable moves (Extract Method, Introduce Parameter Object, Move Method, etc.).
  • Guides end-to-end, production-grade refactoring workflows with safety nets like characterization tests and incremental commits.
  • Applies to TypeScript/JavaScript projects and legacy classes, helping teams evolve architectures without introducing regressions.

Quick Start

Refactor a target function by first naming the smell, then applying a single, safe refactor move and validating with tests.

Frequently Asked Questions about refactoring-patterns

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

FAQPage Schema
How do I refactor long methods and reduce too many parameters in TypeScript?

To refactor long methods and reduce parameters in TypeScript, apply targeted moves like Extract Method or Introduce Parameter Object. These transformations improve code structure while preserving observable behavior and reducing duplication.

What are the safest steps to refactor legacy JavaScript code without introducing regressions?

Safely refactoring legacy JavaScript requires an incremental refactoring plan validated by characterization tests. You name the code smell, apply a single safe transformation move, and verify behavior with tests before committing.

Do I need existing tests before applying code refactoring patterns?

Yes, you need tests or characterization tests to validate changes before applying code refactoring patterns. These safety nets confirm that transformations preserve observable behavior and prevent regressions across your codebase.

How do I identify code smells like duplicated code to know which refactoring pattern to use?

To identify code smells like duplicated code, evaluate the structure against common indicators such as long methods or excessive parameters. Once detected, apply matching refactoring patterns like Move Method to improve readability and reduce duplication.

What's the best way to plan a production-grade refactoring workflow for a large codebase?

The best way to plan a production-grade refactoring workflow is to generate an incremental, safe plan with concrete testable steps. This approach evolves architectures gradually by applying proven moves validated by characterization tests.

Can I use refactoring patterns to fix code smells in both TypeScript and JavaScript projects?

Yes, refactoring patterns work across both TypeScript and JavaScript projects to detect and fix code smells. They provide a structured vocabulary to apply safe, repeatable transformations that improve readability without changing behavior.