Works with the AI Agents you already use

    JavaScript to TypeScript Migration (Node/Express)

    by Sohail

    1

    Converts your JavaScript codebase to TypeScript without fake types.

    $7

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    JavaScript to TypeScript Migration (Node/Express)

    JavaScript to TypeScript Migration (Node/Express)

    Example session with this skill installed

    Convert src/services/cache.service.js in our Express + Mongoose API to TypeScript. We run Node 24 in production. Don't change any behaviour.

    • Read your context and instructions
    • Compiled the javascript to typescript

    Summary

    Converted cache.service.js to cache.service.ts with no behaviour change. Node 24 runs it directly via type stripping, so there is no build step. One PR, revertable on its own.

    What changed

    FileChange
    src/services/cache.service.js → .tsgit mv, types added, logic identical
    src/controllers/user.controller.jsrequire('../services/cache.service.ts')
    src/controllers/product.controller.jsrequire('../services/cache.service.ts')
    tests/cache.service.test.jsstub regex cache.service(\.js)?$ → cache.service(\.ts)?$
    .github/ts-migration.jsonremoved from inProgress

    The converted module

    const redis: typeof import('ioredis') = require('ioredis');
    const client = new redis(process.env.REDIS_URL);
    
    async function get<T = any>(key: string): Promise<T | null> {
      const raw = await client.get(key);
      return raw ? JSON.parse(raw) : null;
    }
    
    async function set(key: string, value: unknown, ttl = 300): Promise<void> {
      await client.set(key, JSON.stringify(value), 'EX', ttl);
    }
    
    async function del(key: string): Promise<void> {
      await client.del(key);
    }
    
    const service = { get, set, del };
    module.exports = service;
    export type CacheService = typeof service;
    

    Still CommonJS, erasable syntax only, library type derived with typeof import('ioredis'), no ! or as added. Callers can now type it with import type { CacheService } from './cache.service.ts'.

    Verified

    • npm run typecheck: clean
    • Unit tests: 142 passing, same as before
    • Added a test pinning the cache key names and JSON encoding
    • node -e "require('./src/services/cache.service.ts')" in the production image: loads, no warnings
    • Migration-rules check: green

    Next steps

    helpers/format.js and services/mailer.service.js are leaves and ready now; user.service.js waits on this PR. Merge, then say "continue".

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Converts your JavaScript codebase to TypeScript without fake types.

    The problem it solves

    Let an AI agent convert a Node/Express API to TypeScript and it will make the compiler happy, but not always honestly. In one real 219-file migration, strict mode and CI were green on every PR. Underneath: about 530 lines of hand-written fake library types, 88 const x: T = require(...) lines that check nothing, and 246 as casts. It all started from one compiler error inside node_modules that a single skipLibCheck would have fixed. The first shortcut became the template for every module after it, and "strict mode passes" hid it all.

    On top of that, extra-strict flags on loose types pushed hundreds of ?? '' and early-return edits, quietly turning 500s into 404s and nulls into missing keys, breaking callers that depended on the old responses.

    This skill makes the agent do the conversion the way an experienced TypeScript engineer would, and adds a PR check so the shortcuts can't come back.

    How it works

    • No build step. New and converted files are .ts, and Node 22.18+/24 runs them directly by stripping types. The repo stays CommonJS, so dotenv and APM load order is untouched.
    • Type checking in CI. tsc --noEmit checks the mixed .js / .ts codebase on every PR.
    • One file at a time. git mv, add types without changing logic, update every require('./x.ts'), fix test stubs keyed on the old path, and verify the file loads in the production image.
    • A migration-rules PR check that fails PRs which add new .js in TypeScript-only folders, hand-type a require(), add ! or as to silence the compiler, rewrite a package's types with declare module, or turn on skipLibCheck without saying why.
    • Library types done properly. Uses the package's own types or @types, works through version fixes library by library, and only then falls back to a documented skipLibCheck. Never hand-written interfaces for a library.
    • Phased plan. Type checking only → guardrails → leaf modules → optional ORM upgrade → models (Mongoose generics) → routes and controllers → tighten strict flags.
    • Works in rounds. A status script shows what's ready to convert, what's waiting and on which files, and which files belong in one PR, so several PRs can be open at once and merge in any order.

    Use it to

    • Plan or run a JS → TS migration of a Node/Express/Mongoose backend
    • Write a new file in TypeScript inside a JavaScript repo
    • Convert "just this one service" to .ts safely
    • Audit a migration someone (or an AI agent) already did: hand-written library types, unchecked typed requires, !/as added to silence errors, or "strict passes, so is it fine?"

    Requirements

    Node.js 22.18+ or 23.6+ (Node 24 recommended), a CommonJS codebase, Git. MIT licensed.

    Targets CommonJS Node.js codebases. Needs Node 22.18+/23.6+ in production for no-build type stripping (older Node needs the dist/ fallback). Enums, namespaces and parameter properties are not allowed in converted files, since Node can only strip erasable syntax. ESM-first repos are not covered.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 7 days ago

    Software
    Node.jstscGit

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables

    Shell to run git, npm, tsc and tests; read and write files to rename .js to .ts, add types, update requires and add the tsconfig, CI workflow and migration-check script.

    Listed7 days ago

    What's inside

    Frequently Asked Questions

    It converts a JavaScript (CommonJS) Node.js/Express backend to TypeScript one file at a time, in small revertable PRs, with production behaviour unchanged. Node runs the .ts files directly via type stripping, so there is no build step.

    Not necessarily. A typed require like const x: Foo = require(...) is never checked against the real module, and hand-written library types compile while being wrong. Ask the skill to audit the migration: it counts hand-typed requires, fake library interfaces and added !/as casts.

    Agents are very good at making the compiler quiet: hand-writing a library's types, adding casts, or adding ?? '' and early returns that change API responses. This skill gives the agent house rules and a PR check that fails on exactly those shortcuts.

    No. The repo stays CommonJS and Node 22.18+/24 runs .ts files directly. tsc --noEmit only type-checks in CI, so load order for dotenv and APM agents is untouched.

    The skill works through it library by library: the package's own types, then @types, then version fixes, and only then a documented skipLibCheck. It never hand-writes the library's types.

    Any agent that reads SKILL.md, including Claude Code, Codex CLI, Cursor and Gemini CLI.

    New in APIs & Backend

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.