# TypeScript Strict Migration: Remove any, Stay Green

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

TypeScript Strict Migration: Remove any, Stay Green is a free AI agent skill on Agensi by Ignasi, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Ignasi](https://www.agensi.io/creators/ignasi)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Uses: 1
- Version: 1.0
- Last updated: 2026-11-23
- Security: scan passed (2026-11-23); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/typescript-strict-migration-remove-any-stay-green
- Tags: api, typescript, react, zod, code-review

## 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.

## Requires

- tsc
- Node.js

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the TypeScript Strict Migration: Remove any, Stay Green skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill migrate a large codebase without breaking the build?

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.

### How does this differ from just asking a standard LLM to 'fix my TypeScript errors'?

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.

### What is included in the skill package?

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.

### Can this skill handle framework-specific code like React hooks or Vue SFCs?

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.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
