typescript-refactor

v2026.09.24

TypeScript refactoring and modernization guidelines from a principal specialist perspective. This skill should be used when refactoring, reviewing, or modernizing TypeScript code to ensure type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving TypeScript type architecture, narrowing, generics, error handling, or migration to modern TypeScript features.

GitHub
Install command
npx skhub add shipshitdev/typescript-refactor
Markdown
SKILL.md

TypeScript Refactor Best Practices

43 rules across 8 categories for TypeScript refactoring and modernization, prioritized by impact to guide automated refactoring, code review, and code generation.

When to Apply

  • Refactoring TypeScript code for type safety and maintainability
  • Designing type architectures (discriminated unions, branded types, generics)
  • Narrowing types to eliminate unsafe as casts
  • Adopting modern TypeScript 4.x-5.x features (satisfies, using, const type parameters)
  • Optimizing compiler performance in large codebases
  • Implementing type-safe error handling patterns
  • Reviewing code for TypeScript quirks and pitfalls

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Type ArchitectureCRITICALarch-
2Type Narrowing & GuardsCRITICALnarrow-
3Modern TypeScriptHIGHmodern-
4Generic PatternsHIGHgeneric-
5Compiler PerformanceMEDIUM-HIGHcompile-
6Error SafetyMEDIUMerror-
7Runtime PatternsMEDIUMperf-
8Quirks & PitfallsLOW-MEDIUMquirk-

Quick Reference

1. Type Architecture (CRITICAL)

2. Type Narrowing & Guards (CRITICAL)

3. Modern TypeScript (HIGH)

4. Generic Patterns (HIGH)

5. Compiler Performance (MEDIUM-HIGH)

6. Error Safety (MEDIUM)

7. Runtime Patterns (MEDIUM)

8. Quirks & Pitfalls (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

Not specified

Source path

skills/typescript-refactor

Default branch

master

Latest commit

a0f9899

Tree SHA

f05942e