ts-migrate

A guided tool for changing JavaScript files into TypeScript files. TypeScript adds checks that describe what kinds of values code should use.

In plain words
What is it for?
Use it to assess a JavaScript-to-TypeScript migration, create a migration plan, prepare configuration, and convert files step by step.
Why use it?
It helps plan the conversion, account for file dependencies, prepare project settings, and handle the work in a sensible order.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/andronics/claude-plugin-typescript-pro/ts-migrate
Clone the repo
git clone --depth 1 https://github.com/andronics/claude-plugin-typescript-pro
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 946 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.00946
Opus 5 $0.00006 $0.00473
Sonnet 5 $0.00002 $0.00189
Haiku 4.5 $0.00001 $0.00095

Measured 2d ago against content hash 7ef1ada8eeca, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ts-migrate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/ts-migrate.md · 140 lines

What it actually says

Migrate JavaScript code to TypeScript with step-by-step guidance:

  1. Analyze Migration Scope

    • If $ARGUMENTS provided, use as file pattern to migrate
    • Otherwise, analyze entire project:
      • Count JS vs TS files
      • Identify dependencies between files
      • Determine migration complexity
      • Calculate estimated effort
    • Create dependency graph to determine migration order
  2. Plan Migration Strategy

    • Order of Migration:
      1. Type definition files (create .d.ts)
      2. Utility functions and constants
      3. Leaf modules (no internal dependencies)
      4. Core business logic
      5. React components (if applicable)
      6. Main application files
    • Show migration plan with file groups
    • Identify high-risk files (complex, many dependencies)
  3. Prepare Environment

    • Check if TypeScript is installed
    • Review tsconfig.json settings (should be permissive initially)
    • Ensure allowJs: true for gradual migration
    • Set up @types packages for dependencies
    • Create custom type declarations for untyped libraries
  4. Migrate Files One by One

    For each file in migration order:

    Step A: Rename & Basic Typing

    • Rename .js → .ts (or .jsx → .tsx)
    • Add explicit return types to functions
    • Type function parameters
    • Type variable declarations where needed

    Step B: Convert Patterns

    • PropTypes → TypeScript interfaces (React)
    • JSDoc types → TypeScript annotations
    • require() → import statements (if needed)
    • module.exports → export statements

    Step C: Handle Type Issues

    • Resolve implicit any errors
    • Add type guards for dynamic code
    • Type event handlers correctly
    • Handle null/undefined properly

    Step D: Improve Type Safety

    • Replace any with specific types
    • Add union types for multiple possibilities
    • Use discriminated unions for state
    • Add readonly for immutability

    Step E: Verify

    • Run type checker: tsc --noEmit
    • Fix any type errors
    • Ensure tests still pass
    • Verify build succeeds
  5. Handle Common Migration Challenges

    Dynamic Property Access:

    // Before
    function getValue(obj, key) {
      return obj[key];
    }
    
    // After
    function getValue<T, K extends keyof T>(obj: T, key: K): T[K] {
      return obj[key];
    }
    

    Mixed Return Types:

    // Before
    function getUser(id) {
      if (!id) return null;
      return fetchUser(id);
    }
    
    // After
    function getUser(id: number | undefined): Promise<User> | null {
      if (!id) return null;
      return fetchUser(id);
    }
    

    Untyped Libraries:

    // Create ambient declaration
    // types/my-library.d.ts
    declare module 'my-library' {
      export function doSomething(arg: string): number;
    }
    
  6. Track Progress

    • Show percentage of files migrated
    • Count remaining JS files
    • List next files to migrate
    • Estimate remaining effort
  7. Post-Migration Cleanup

    • Remove PropTypes dependencies
    • Delete unnecessary @ts-ignore comments
    • Remove redundant type assertions
    • Update build scripts (remove Babel if using tsc)
    • Update documentation
  8. Gradual Strict Mode Adoption

    • After basic migration, suggest enabling strict flags
    • Recommend using /ts-strict command
    • Set timeline for full strict mode adoption
  9. Create Migration Report

    • Files migrated count
    • Type errors resolved count
    • Remaining TODOs
    • Suggested next steps
    • Breaking changes (if any)

Examples:

  • /ts-migrate - Migrate entire project
  • /ts-migrate src/components/*.js - Migrate specific files
  • /ts-migrate --dry-run - Show plan without changes
  • /ts-migrate src/utils - Migrate directory

The migration will be incremental, safe, and preserve all functionality while adding type safety.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 140 lines · 12 tokens per session scan A 7ef1ada8eeca

Subscribe to this mod's changes

ts-migrate is a command published in the GitHub repository andronics/claude-plugin-typescript-pro (4 stars, last pushed 10mo ago), licensed MIT. It adds 12 tokens to every session and 946 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.