Skip to content
refactoring

Type Strict

Eliminate `any` and `as unknown` casts in a TypeScript file by inferring proper types.

/type-strict

Install this skill

  1. 1. Copy the SKILL.md content (button above)
  2. 2. Create a folder for the skill:
    # Mac/Linux
    mkdir -p ~/.claude/skills/type-strict
    
    # Windows (PowerShell)
    mkdir $env:USERPROFILE\.claude\skills\type-strict
  3. 3. Save the content as ~/.claude/skills/type-strict/SKILL.md
  4. 4. Restart Claude Code (or open a new session)
  5. 5. Type /type-strict to invoke it
typescripttypessafety

/type-strict

Hace TypeScript estricto archivo por archivo.

Usage

/type-strict <file> /type-strict src/ # carpeta entera /type-strict --check # solo reporta, no edita

Qué busca

1. any explícito

Loading code…

2. as any o as unknown as

Loading code…

3. Tipos implícitos

Loading code…

4. @ts-ignore / @ts-expect-error

Sin justificación documentada.

Estrategia de fix

Para parámetros

  1. Mira los call sites
  2. Infiere tipo común
  3. Agrega tipo explícito

Para casts

  1. Mira de dónde viene el dato
  2. Define el tipo real (interface o type)
  3. Agrega validación si viene de I/O

Para library types

  • Si vienen de paquete sin types: agregar @types/<pkg>
  • Si no existe: declarar localmente en types/<pkg>.d.ts

Verificación

Después de cada fix, corre tsc --noEmit para confirmar.

Honestidad

Si no puedes determinar el tipo correcto sin más contexto, marca con // TODO: type y reporta — NO hagas un guess que rompa cosas.