TypeScript Strict Migration: Remove any, Stay Green

    by Ignasi

    1

    Incrementally migrate JS to TS and enable strict mode flags without breaking the build.

    Free

    1 useSecurity scanned

    Works with the AI Agents you already use

    TypeScript Strict Migration: Remove any, Stay Green

    Example session with this skill installed

    Run a baseline audit on my src directory and suggest the first three steps to enable strictNullChecks in this React project.

    • Read your context and instructions
    • Compiled the typescript strict migration

    I have completed the baseline audit of your src directory. The codebase currently has a significant number of implicit any types and unhandled null/undefined values.

    Migration Audit & Strategy

    MetricCurrent Count
    Total TS Errors412
    any / as any usages87
    @ts-ignore instances14
    JS to TS coverage65%

    Error Distribution

    • TS2532 (Object is possibly undefined): 156 instances
    • TS7006 (Implicit any): 92 instances
    • TS2339 (Property does not exist): 44 instances

    Suggested Implementation Plan

    1. Initialize Flag Ladder: Set skipLibCheck: true and checkJs: false in tsconfig.json to stabilize the current build environment while we target specific modules.
    2. Leaf Module Conversion: Begin renaming .js files to .tsx in src/utils and src/components/ui. I will add explicit return types to these utility functions first to allow the compiler to infer types in the calling components.
    3. Zod Boundary Protection: Replace the three main fetch calls in src/api/user.ts with Zod schemas. This will transform any responses into validated types, clearing approximately 40% of the TS2532 errors in the downstream data flow.

    Next steps

    • Run the baseline script: npx tsc --noEmit --pretty false | tee .ts-baseline.txt.
    • Apply noImplicitAny to the utils folder using a nested tsconfig.strict.json.
    • Review the zod schema definitions for the User and Profile interfaces.

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

    About this skill

    Struggling with a codebase full of any types, suppressed errors, or legacy JavaScript? Migrating to strict TypeScript is a slog that often breaks the build or stalls due to the sheer volume of errors. This skill manages the incremental conversion of JavaScript to TypeScript and the systematic activation of strict compiler flags without halting development.

    What it does

    • Baseline auditing generates a precise count of TS errors and any escape hatches to track progress.
    • Incremental flag migration sequences the activation of noImplicitAny, strictNullChecks, and noUncheckedIndexedAccess.
    • Type-safe boundary enforcement implements Zod schemas for API and JSON inputs to replace unsafe any types.
    • Pattern-based fixing replaces @ts-ignore and type assertions with narrowing, guards, and discriminated unions.
    • Framework-specific typing applies best practices for React props, Vue script setup, and Next.js server actions.

    How it works

    1. Analyze the current state using tsc and grep to identify the highest concentration of type debt.
    2. Execute the flag ladder, enabling one strict compiler flag at a time and resolving resulting errors.
    3. Refactor leaf modules first, converting .js to .ts and replacing JSDoc with native types.
    4. Lock progress by configuring ESLint rules and CI ratcheting to prevent new any declarations.

    Frameworks & tools

    Works with TypeScript, React, Vue (vue-tsc), Next.js, and Node.js. Uses Zod for runtime validation and @typescript-eslint for linting enforcement.

    Why this beats prompting it yourself

    Standard LLM prompts often suggest "any" or "as" assertions to silence errors quickly. This skill enforces a "correct over silent" philosophy, ensuring that type safety actually improves runtime reliability instead of just hiding compiler warnings.

    Use cases

    • Converting a legacy Node/Express JS project to a typed TypeScript codebase.
    • Enabling strictNullChecks on a large React repo without breaking the build.
    • Replacing unsafe JSON.parse results with validated Zod schemas.
    • Setting up a CI ratchet to force a decreasing count of any types over time.

    Known limitations

    Does not change runtime behavior during typing; logic bugs found during migration are reported but not auto-fixed to avoid regressions. Requires an existing npm/yarn environment.

    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

    1 use

    Times used to date

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 11 days ago

    • Free with an Agensi account

    Software
    tscNode.js

    Permissions

    Terminal / Shell
    Listed11 days ago

    What's inside

    Frequently Asked Questions

    This skill uses a 'leaf-first' approach, starting with modules that have no dependencies to ensure a stable foundation. It sequences strict flags one by one and uses CI ratcheting to ensure that once a file is typed or a flag is enabled, the code cannot regress.

    Unlike generic prompts that often use `any` to silence errors, this skill enforces a 'correct over silent' philosophy. It prioritizes type narrowing, Zod schema validation for external data, and proper discriminated unions to ensure runtime reliability.

    The purchase includes the full skill logic for auditing, incremental flag migration, and pattern-based refactoring. You also receive pre-configured ESLint rules and Zod integration templates to maintain type safety after the migration is complete.

    Yes, it supports React (JSX/TSX), Vue (via vue-tsc), Next.js, and standard Node.js environments. It applies framework-specific best practices, such as typing React props and Next.js server actions, to ensure seamless integration.

    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.

    Free