module-by-module-migration
About module-by-module-migration
module-by-module-migration is a migration-planning skill for JavaScript-to-TypeScript projects, including large codebases and teams. It recommends converting modules individually from dependency-graph leaves upward so dependencies are typed first.
Key features
- 01Order migration by dependency graph
- 02Start with dependency-free leaf modules
- 03Convert JavaScript module by module
- 04Type dependencies before higher-level modules
Use cases
- 01Plan a large codebase's TypeScript migration
- 02Sequence conversion of utilities and services
- 03Coordinate a staged JavaScript migration across a team
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ marius-townhouse/ effective-typescript-skills --skill module-by-module-migrationAfter installing, type/module-by-module-migrationin Claude Code to confirm it loaded.
Details
From the project READMEConvert Module by Module Up Your Dependency Graph
Overview
When migrating JavaScript to TypeScript, follow the dependency graph: start with leaf modules (those with no dependencies) and work upward. This ensures that when you convert a module, all its dependencies are already typed. This minimizes type errors and makes migration manageable.
When to Use This Skill
- Migrating large codebases to TypeScript
- Converting JavaScript to TypeScript
- Managing dependencies during migration
- Planning migration order
- Teams adopting TypeScript
The Iron Rule
Migrate modules starting from leaves (no dependencies) and work up the dependency graph. This ensures dependencies are typed before dependents.
Migration Order
Leaf modules (no dependencies):
- utils.js → utils.ts
- constants.js → constants.ts
- helpers.js → helpers.ts
Middle modules (depend on leaves):
- api.js → api.ts
- components.js → components.ts
Entry points (most dependencies):
- app.js → app.ts
- index.js → index.ts
Example
# 1. Convert utilities first (no dependencies)
# utils.js → utils.ts
# constants.js → constants.ts
# 2. Then services (depend on utilities)
# api.js → api.ts
# store.js → store.ts
# 3. Finally entry points (depend on everything)
# app.js → app.ts
# main.js → main.ts
Reference
- Effective TypeScript, 2nd Edition by Dan Vanderkam
- Item 82: Convert Module by Module Up Your Dependency Graph