refactor-assistant

Automate TypeScript code refactoring by detecting code smells and applying design patterns.

84|15|Updated Dec 31, 2025
One-click install
npx skills add https://github.com/AIDotNet/MoYuCode --skill refactor-assistant-aidotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-assistant
Source: https://github.com/AIDotNet/MoYuCode/tree/main/skills/community/refactor-assistant
Command: npx skills add https://github.com/AIDotNet/MoYuCode --skill refactor-assistant-aidotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enhances code quality by identifying and rectifying code smells, suggesting design patterns, and ensuring behavioral integrity during refactoring.

Core Features & Use Cases

  • Design Pattern Suggestions: Recommends and applies relevant design patterns like Strategy and Factory.
  • Code Smell Detection: Identifies issues such as long methods and suggests refactoring strategies.
  • Behavior Preservation: Ensures that refactored code maintains its original functionality.
  • Use Case: Improve a complex, hard-to-maintain function by extracting logic into smaller, reusable methods and applying appropriate design patterns.

Quick Start

Use the refactor assistant to refactor the provided TypeScript code using the Strategy pattern.

Frequently Asked Questions about refactor-assistant

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

FAQPage Schema
How do I identify code smells and refactor a long method in TypeScript?

To refactor a long method, this assistant detects code smells like complex functions and applies the Extract Method pattern to break logic into smaller, reusable methods while preserving original behavior.

When do I need to apply the Strategy pattern during code refactoring?

Apply the Strategy pattern during code refactoring when you need to encapsulate interchangeable algorithms, reducing conditional complexity and improving structure without altering functional equivalence.

How does code refactoring ensure functional equivalence and behavior preservation?

Code refactoring ensures behavior preservation by analyzing original logic and applying design patterns strictly to improve maintainability, guaranteeing the refactored code maintains its original functionality.

Can I use this refactoring assistant to implement the Factory pattern in TypeScript?

Yes, you can use this assistant to implement the Factory pattern in TypeScript, as it recommends and applies relevant design patterns to improve code structure and maintainability.

What is the best way to improve code quality and maintainability in complex TypeScript functions?

The best way to improve code quality is identifying code smells and applying design patterns like Strategy or Factory, extracting reusable methods to ensure functional equivalence and better maintainability.

Does automated code refactoring work with other languages or only TypeScript?

Automated code refactoring currently supports TypeScript, analyzing code to identify smells and apply design patterns for structural improvement and behavior preservation.