← ClaudeAtlas

typescript-refactorlisted

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.
shipshitdev/skills · ★ 35 · Code & Development · score 74
Install: claude install-skill shipshitdev/skills
# 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 | Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Type Architecture | CRITICAL | `arch-` | | 2 | Type Narrowing & Guards | CRITICAL | `narrow-` | | 3 | Modern TypeScript | HIGH | `modern-` | | 4 | Generic Patterns | HIGH | `generic-` | | 5 | Compiler Performance | MEDIUM-HIGH | `compile-` | | 6 | Error Safety | MEDIUM | `error-` | | 7 | Runtime Patterns | MEDIUM | `perf-` | | 8 | Quirks & Pitfalls | LOW-MEDIUM | `quirk-` | ## Quick Reference ### 1. Type Architecture (CRITICAL) - [`arch-discriminated-unions`](references/arch-discriminated-unions.md) — Use discriminated unions over string enums for exhaustive pattern matching - [`arch-branded-types`](references/arch-branded-types.md) — Use branded types for domain identifiers to prevent value mix-ups - [`a