code-refactor

Refactor JavaScript and TypeScript code to improve quality and maintainability.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/ms-moar/ccc-media --skill code-refactor-ms-moar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-refactor
Source: https://github.com/ms-moar/ccc-media/tree/main/ailabspro/files/extracted/v31-resources/cursor-context-in-claude/.claude/skills/code-refactor
Command: npx skills add https://github.com/ms-moar/ccc-media --skill code-refactor-ms-moar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Improve the readability, maintainability, and performance of JavaScript and TypeScript code by identifying code smells, modernizing patterns, and applying clean code principles to reduce technical debt and prevent regressions.

Core Features & Use Cases

  • Code analysis & reports: Systematic detection of code smells, long functions, incorrect naming, overused any types, and problematic patterns with a prioritized remediation plan.
  • Refactoring patterns & modernization: Apply TypeScript/ESM patterns, replace promise chains with async/await, convert class components to hooks, and modernize syntax while preserving behavior.
  • Verification & safety: Incremental changes with risk assessment, TypeScript type-safety checks, and guidance to run tests or validation steps after each change.

Quick Start

Ask the assistant to refactor the attached TypeScript file to improve naming, remove any uses of the any type, extract long functions, and preserve existing behavior while noting potential breaking changes.

Frequently Asked Questions about code-refactor

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

FAQPage Schema
How do I refactor JavaScript code to improve readability and maintainability?

Refactoring JavaScript code involves detecting code smells, modernizing syntax, and applying clean code principles like SOLID and DRY. This process reduces technical debt by systematically applying incremental changes that preserve runtime behavior while enhancing overall code quality.

What is the best way to modernize legacy TypeScript code and remove any types?

Modernizing legacy TypeScript code requires replacing overused any types with strict type-safety checks and migrating to ESM patterns. This enforces cleaner type definitions, reduces problematic patterns, and prevents potential regressions through prioritized remediation and verification steps.

Can I convert React class components to hooks while preserving runtime behavior?

Yes, converting React class components to hooks preserves runtime behavior by applying incremental refactoring patterns. This modernization technique improves React project maintainability while guided by risk assessment and validation steps to ensure functionality remains intact throughout the transition.

How do I replace promise chains with async await in Node projects?

Replacing promise chains with async await in Node projects is a refactoring pattern that improves code readability. By modernizing asynchronous syntax incrementally, developers can enforce clean code principles while running tests to verify that runtime behavior remains completely preserved.

Does this refactoring approach work for both React and Node projects?

Yes, this refactoring approach works across React and Node projects by analyzing files and modules systematically. It detects long functions and incorrect naming, applies incremental refactors, and enforces TypeScript type-safety to improve code quality regardless of the specific JavaScript environment.

What are the limitations when applying incremental refactors to existing code?

Limitations when applying incremental refactors include potential breaking changes that require risk assessment. Developers must run tests or validation steps after each change to ensure TypeScript type-safety and preserve runtime behavior, preventing regressions when modernizing problematic patterns.