typescript-refactor

Refactor TypeScript codebases for type safety and compiler performance.

193|17|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/pproenca/dot-skills --skill typescript-refactor-pproenca
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-refactor
Source: https://github.com/pproenca/dot-skills/tree/main/skills/.experimental/typescript-refactor
Command: npx skills add https://github.com/pproenca/dot-skills --skill typescript-refactor-pproenca

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill addresses the challenges of maintaining and modernizing complex TypeScript codebases, ensuring type safety, improving compiler performance, and adopting idiomatic patterns.

Core Features & Use Cases

  • Type Architecture: Guides design of discriminated unions, branded types, and interface composition.
  • Type Narrowing: Provides strategies to eliminate unsafe as casts and enforce type guards.
  • Modern Features: Details usage of satisfies, using, const type parameters, and other modern TypeScript constructs.
  • Use Case: Refactor a legacy JavaScript project migrated to TypeScript, ensuring robust type safety and leveraging the latest language features for better maintainability and performance.

Quick Start

Apply the typescript-refactor skill to improve the type safety of the provided TypeScript code.

Frequently Asked Questions about typescript-refactor

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

FAQPage Schema
How do I refactor TypeScript code to eliminate unsafe type casts?

TypeScript refactoring to eliminate unsafe casts involves applying type narrowing strategies and enforcing type guards rather than relying on `as` assertions. This Skill provides comprehensive rules for designing discriminated unions and eliminating unsafe casts.

What are the best practices for modernizing a legacy TypeScript codebase?

Modernizing a legacy TypeScript codebase requires adopting idiomatic patterns like `satisfies`, `using`, and const type parameters to improve compiler performance and maintainability. This Skill details 43 rules covering type architecture and modern features.

How does TypeScript generic pattern design affect compiler performance?

TypeScript generic pattern design directly impacts compiler performance, as complex or poorly structured generics can slow down type checking. This Skill provides guidelines for generic patterns and compiler performance optimization across 43 rules.

Can I use branded types and discriminated unions for TypeScript type architecture?

Yes, you can use branded types and discriminated unions for TypeScript type architecture. This Skill guides the design of interface composition, branded types, and discriminated unions to ensure robust type safety in refactored codebases.

When do I need to use modern TypeScript features like the satisfies operator?

You need to use modern TypeScript features like the `satisfies` operator when modernizing codebases to ensure type safety without widening or altering the inferred types. This Skill details usage of `satisfies`, `using`, and const type parameters.