typescript

Review TypeScript code for type safety and strict configuration issues.

1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/hschne/pi-stuff --skill typescript-hschne
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/hschne/pi-stuff/tree/main/skills/typescript
Command: npx skills add https://github.com/hschne/pi-stuff --skill typescript-hschne

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

TypeScript codebases often suffer from inconsistent type patterns, misconfigured tsconfig settings, and unsafe type assertions that lead to avoidable compile errors and runtime bugs, slowing down development and increasing technical debt.

Core Features & Use Cases

  • Standardized Type Patterns: Enforces consistent use of interfaces vs type aliases, proper null handling, and branded types for domain-specific safety.
  • Strict Configuration Guidance: Provides validated tsconfig setups for strict mode, module resolution, and library project structure.
  • Type Safety Best Practices: Covers generics, type narrowing, discriminated unions, and avoids common anti-patterns like overusing any or non-null assertions.
  • Use Case: When refactoring a legacy JavaScript codebase to TypeScript, this skill ensures you follow type-safe patterns instead of introducing unsafe any types or incorrect project configuration.

Quick Start

Use the typescript skill to review the attached .tsx component file and suggest type safety improvements aligned with strict mode best practices.

Frequently Asked Questions about typescript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix unsafe type assertions and strict null checks in my TypeScript codebase?

Fix unsafe TypeScript type assertions by replacing `any` types and non-null assertions with proper type narrowing and discriminated unions. This enforces strict null checks and resolves avoidable compile errors and runtime bugs.

What is the best way to refactor legacy JavaScript to TypeScript without losing type safety?

Refactor legacy JavaScript to TypeScript by applying standardized type patterns like interfaces and branded types instead of unsafe `any` types. This ensures strict, domain-specific type safety during the migration process.

How do I configure tsconfig for strict mode and proper module resolution in TypeScript?

Configure tsconfig for strict mode by applying validated setups for strict null checks, module resolution, and library project structures. This standardizes module import and export conventions with modern TypeScript best practices.

When do I need to use generics and discriminated union narrowing in TypeScript?

Use TypeScript generics and discriminated union narrowing when writing .ts/.tsx files that handle dynamic data structures. These mechanisms prevent compile errors by enforcing domain-specific safety without relying on `any` types.

Why does my TypeScript code review keep failing due to inconsistent type patterns?

TypeScript code reviews fail due to inconsistent type patterns when developers mix type aliases and interfaces or overuse unsafe assertions. Standardizing type patterns and applying strict tsconfig rules eliminates these compile errors.