Skip to content

TypeScript Strict Mode

Caution

Enforce TypeScript strict mode with automated type fixes, any elimination, and comprehensive type safety improvements.

By agent-skills 6,780 v1.6.0 Updated 2026-03-10

Install

Claude Code

claude install typescript-strict

About This Skill

Overview

TypeScript Strict Mode helps teams adopt and maintain the highest level of type safety. It identifies type weaknesses in your codebase and systematically replaces them with precise, strict types that catch bugs at compile time.

Key Features

  • Any Elimination: Scans your codebase for `any` types and replaces them with proper types inferred from usage patterns. Handles both explicit `any` annotations and implicit `any` from missing types.
  • Strict Null Checks: Identifies all potential null/undefined access patterns and adds proper null checks, optional chaining, or non-null assertions where appropriate.
  • Generic Improvements: Detects functions and classes that would benefit from generics and adds type parameters that preserve type information through call chains.
  • Incremental Migration: For large codebases, enables strict mode file-by-file with `// @ts-strict` comments, allowing gradual adoption without blocking the entire team.

Configuration

The skill can configure `tsconfig.json` with all strict flags: `strict`, `strictNullChecks`, `strictFunctionTypes`, `strictBindCallApply`, `noImplicitAny`, `noImplicitReturns`, and `noUncheckedIndexedAccess`.

Best Practices

Start with `noImplicitAny` and `strictNullChecks` as they catch the most bugs. Add `noUncheckedIndexedAccess` for array and object safety. Use the incremental migration mode for existing projects.

Use Cases

  • Migrate a JavaScript project to strict TypeScript incrementally
  • Eliminate all 'any' types with proper type definitions
  • Add proper generics to functions and classes
  • Configure and enforce strictNullChecks across a codebase
  • Create type guards and discriminated unions for runtime safety

Pros & Cons

Pros

  • + Catches entire categories of bugs at compile time rather than runtime
  • + Incremental migration allows adoption without stopping development
  • + Improves IDE autocompletion and refactoring confidence
  • + Generated types are precise, avoiding overly broad type unions

Cons

  • - Initial migration can generate many type errors that need batch resolution
  • - Some third-party libraries have incomplete type definitions

Related AI Tools

Related Skills

Stay Updated on Agent Skills

Get weekly curated skills + safety alerts

每周精选 Skills + 安全预警