Skillshub typescript-refactor

TypeScript Refactor Best Practices

install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/pproenca/dot-skills/typescript-refactor" ~/.claude/skills/comeonoliver-skillshub-typescript-refactor && rm -rf "$T"
manifest: skills/pproenca/dot-skills/typescript-refactor/SKILL.md
source content

TypeScript Refactor Best Practices

Comprehensive TypeScript refactoring and modernization guide designed for AI agents and LLMs. Contains 43 rules across 8 categories, prioritized by impact to guide automated refactoring, code review, and code generation.

When to Apply

Reference these guidelines when:

  • 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 ArchitectureCRITICAL
arch-
2Type Narrowing & GuardsCRITICAL
narrow-
3Modern TypeScriptHIGH
modern-
4Generic PatternsHIGH
generic-
5Compiler PerformanceMEDIUM-HIGH
compile-
6Error SafetyMEDIUM
error-
7Runtime PatternsMEDIUM
perf-
8Quirks & PitfallsLOW-MEDIUM
quirk-

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
metadata.jsonVersion and reference information