mcpField
M
migrate-js-to-modern-typescript

migrate-js-to-modern-typescript

github.com/pproencaDevelopment218136 installsUpdated 11w ago
Repository

About migrate-js-to-modern-typescript

A reference skill with 42 rules for incrementally migrating JavaScript codebases to strict, modern TypeScript. It guides developers through configuration, typing, runtime validation, idiom changes, and build tooling while keeping compilation viable throughout.

Key features

  1. 0142 rules across seven migration categories
  2. 02Prioritized incremental migration guidance
  3. 03Strategies for strictness and tsconfig
  4. 04Guidance on typing and runtime validation
  5. 05Build, tooling, and CI recommendations

Use cases

  1. 01Plan a gradual JavaScript-to-TypeScript conversion
  2. 02Introduce strict TypeScript checks in a mixed codebase
  3. 03Replace unsafe any, casts, and assertions
  4. 04Type-check external data and environment variables

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill migrate-js-to-modern-typescript

After installing, type/migrate-js-to-modern-typescriptin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
assets/templates/
_template.md
references/
_sections.md
idiom-default-export-to-named.md
idiom-enum-to-union-or-const.md
idiom-optional-chaining-over-guards.md
idiom-prototype-to-class.md
idiom-replace-arguments-object.md
idiom-require-to-import.md
idiom-type-only-imports.md
runtime-derive-types-from-schemas.md
runtime-type-environment-variables.md
runtime-type-guards-at-boundaries.md
runtime-type-json-parse.md
runtime-validate-external-data.md
setup-allowjs-checkjs-bridge.md
setup-jsdoc-before-rename.md
setup-migrate-leaves-first.md
setup-modern-module-resolution.md
setup-noemitonerror-isolatedmodules.md
setup-prefer-ts-expect-error.md
setup-skiplibcheck-during-migration.md
strict-enable-flags-incrementally.md
strict-exact-optional-property-types.md
strict-no-implicit-any.md
strict-no-unchecked-indexed-access.md
strict-prioritize-null-checks.md
strict-use-unknown-in-catch.md
surface-annotate-exported-signatures.md

Details

From the project README

JavaScript to TypeScript Migration Best Practices

Guide for taking a JavaScript codebase to strict, modern TypeScript without a big-bang rewrite. Contains 42 rules across 7 categories, prioritized by impact to drive an incremental, file-by-file migration that keeps the build compiling at every step.

When to Apply

Reference these guidelines when:

  • Converting a .js codebase to .ts (whole project or one module at a time)
  • Adding types to existing JavaScript via JSDoc or annotations
  • Choosing a tsconfig and allowJs strategy for a mixed JS/TS repo
  • Turning on strict mode or individual strict flags on a large codebase
  • Replacing any, as casts, and ! assertions left over from a quick conversion
  • Validating external data (JSON, env, API responses) so the types you wrote are true at runtime
  • Converting CommonJS to ESM, prototypes to classes, and other JS idioms to TS
  • Updating the build, runner, and CI to type-check and publish TypeScript

How the Migration Flows

tsconfig & strategy → strictness ratchet → type the surfaces → kill any/casts
   → validate runtime boundaries → convert JS idioms → tooling/build/CI

Decisions at the front cascade: a wrong tsconfig or a top-down conversion order forces you to re-type modules twice, and an early any flood poisons everything downstream. Work from the front of this pipeline and from the leaves of the dependency graph inward.

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Migration Setup & tsconfigCRITICALsetup-
2Strictness RatchetingCRITICALstrict-
3Typing Public SurfacesHIGHsurface-
4Replacing any & Unsafe CastsHIGHunsafe-
5Runtime Data ValidationMEDIUM-HIGHruntime-
6JS-to-TS Idiom ConversionMEDIUMidiom-
7Tooling & Build MigrationLOW-MEDIUMtooling-

Quick Reference

1. Migration Setup & tsconfig (CRITICAL)
2. Strictness Ratcheting (CRITICAL)
3. Typing Public Surfaces (HIGH)
4. Replacing any & Unsafe Casts (HIGH)
5. Runtime Data Validation (MEDIUM-HIGH)
6. JS-to-TS Idiom Conversion (MEDIUM)
7. Tooling & Build Migration (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Related Skills

  • typescript-refactor — Refactoring and modernizing code that is already TypeScript
  • typescript-advanced-patterns — Advanced type-level patterns once the migration is done

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information

Comments

Markdown supported