TypeScript Strict Mode
CautionEnforce TypeScript strict mode with automated type fixes, any elimination, and comprehensive type safety improvements.
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
Cursor
Freemium
AI-native code editor with deep multi-model integration and agentic coding
- AI-native Cmd+K inline editing and generation
- Composer Agent for autonomous multi-file changes
- Full codebase indexing and context awareness
Claude
Freemium
Anthropic's AI assistant built for thoughtful analysis and safe, nuanced conversations
- 200K token context window for massive document processing
- Artifacts — interactive side-panel for code, docs, and visualizations
- Projects with persistent context and custom instructions
GitHub Copilot
Freemium
AI pair programmer that suggests code in real time across your IDE
- Real-time code completions across 30+ languages
- Copilot Chat for natural language code Q&A
- Pull request description and summary generation
Related Skills
Refactoring Agent
CautionIntelligent code refactoring with pattern detection, code smell identification, and safe multi-file transformations.
React Component Generator
CautionGenerate React components following best practices with proper typing, accessibility, testing, and Storybook stories.
Error Handling Patterns
VerifiedImplement comprehensive error handling with typed errors, recovery strategies, logging integration, and user-friendly messages.
Stay Updated on Agent Skills
Get weekly curated skills + safety alerts
每周精选 Skills + 安全预警