mcpField
T
typescript-refactor

typescript-refactor

github.com/shipshitdevDevelopment3875 installsUpdated 1d ago
Repository

About typescript-refactor

typescript-refactor is a collection of 43 prioritized rules for modernizing and refactoring TypeScript. It is aimed at developers and code-generation or review workflows, with guidance spanning type design, safety, compiler performance, and common pitfalls.

Key features

  1. 0143 rules across 8 categories
  2. 02Prioritized guidance by impact
  3. 03Type architecture and narrowing patterns
  4. 04Modern TypeScript and generics
  5. 05Compiler, error, and runtime practices

Use cases

  1. 01Refactor TypeScript for stronger type safety
  2. 02Review code for TypeScript pitfalls
  3. 03Guide automated code generation
  4. 04Improve compiler performance in large codebases

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/shipshitdev/skills --skill typescript-refactor

After installing, type/typescript-refactorin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

plugin.json
assets/templates/
_template.md
references/
_sections.md
arch-avoid-partial-abuse.md
arch-branded-types.md
arch-const-assertion.md
arch-discriminated-unions.md
arch-interfaces-over-intersections.md
arch-readonly-by-default.md
arch-satisfies-over-annotation.md
compile-avoid-deep-recursion.md
compile-base-types-over-unions.md
compile-explicit-return-types.md
compile-project-references.md
error-discriminated-error-unions.md
error-exhaustive-error-handling.md
error-never-for-unreachable.md
error-result-type.md
error-typed-catch.md
generic-avoid-distributive-surprises.md
generic-constrain-dont-overconstrain.md
generic-infer-over-annotate.md
generic-mapped-type-utilities.md
generic-return-type-inference.md
modern-accessor-keyword.md
modern-const-type-parameters.md
modern-noinfer-utility.md
modern-template-literal-types.md
modern-using-keyword.md
modern-verbatim-module-syntax.md

Details

From the project README

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

Comments

Markdown supported