Skip to content
OpenSmartRoute
Skillv1.0.0

typescript-refactor

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

by shipshitdev(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from shipshitdev/skills (skills/typescript-refactor/SKILL.md). Install upstream with npx skills add shipshitdev/skills --skill typescript-refactor. Copyright stays with the author.

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)

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

File Description
references/_sections.md Category definitions and ordering
assets/templates/_template.md Template for new rules

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/shipshitdev-skills-typescript-refactor/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

shipshitdev-skills-typescript-refactor.ocm.jsonjson
{
  "ocm": "1",
  "id": "shipshitdev-skills-typescript-refactor",
  "kind": "skill",
  "name": "typescript-refactor",
  "description": "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.",
  "publisher": "shipshitdev",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "typescript",
      "refactoring",
      "modernization",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "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."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/shipshitdev/skills",
      "path": "skills/typescript-refactor/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/shipshitdev/skills/blob/HEAD/skills/typescript-refactor/SKILL.md",
      "key": "shipshitdev/skills/skills/typescript-refactor/SKILL.md"
    }
  },
  "instructions": "# TypeScript Refactor Best Practices\n\n43 rules across 8 categories for TypeScript refactoring and modernization, prioritized by impact to guide automated refactoring, code review, and code generation.\n\n## When to Apply\n\n- Refactoring TypeScript code for type safety and maintainability\n- Designing type architectures (discriminated unions, branded types, generics)\n- Narrowing types to eliminate unsafe `as` casts\n- Adopting modern TypeScript 4.x-5.x features (`satisfies`, `using`, const type parameters)\n- Optimizing compiler performance in large codebases\n- Implementing type-safe error handling p",
  "cost": {
    "context_tokens": 1854
  }
}

Fetch it by URL: GET /api/v1/registry/shipshitdev-skills-typescript-refactor/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.