typescript

Enforces strict TypeScript conventions for writing and editing .ts and .tsx files.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/envoydev/claude-stack --skill typescript-envoydev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/envoydev/claude-stack/tree/main/stack/skills/typescript
Command: npx skills add https://github.com/envoydev/claude-stack --skill typescript-envoydev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? TypeScript codebases drift into unsafe patterns like any casts, non-null assertions, and loose tsconfig settings that silently defeat the type checker. This Skill provides a consistent set of strict typing conventions so the compiler actually catches bugs instead of being worked around. ## Core Features & Use Cases - Strict compiler configuration: Enforces strict: true plus high-value flags like noUncheckedIndexedAccess and exactOptionalPropertyTypes, with a shared base tsconfig that projects extend. - Type-driven data modeling: Guides use of discriminated unions, branded primitives, utility types, satisfies, and readonly-by-default patterns to make illegal states unrepresentable. - Boundary validation: Requires schema parsing (Zod or Valibot) at external boundaries instead of casts, and unknown narrowing instead of any. - Use Case: When writing a new API response handler, the Skill directs you to validate the payload with a Zod schema, take the inferred type, and model the result as a discriminated union rather than casting to an interface. ## Quick Start Load the typescript skill before writing or editing any .ts or .tsx file, together with the javascript baseline skill.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I configure strict TypeScript compiler options?▼

Start with strict: true and add noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride, noFallthroughCasesInSwitch, and noImplicitReturns. The @tsconfig/strictest base packages these flags; keep them in one shared tsconfig that each project extends.

Should I use interface or type in TypeScript?▼

Use interface for object shapes that are implemented or extended, and type for unions, intersections, tuples, and mapped or conditional types. The tooling default favors interface, but consistency within a codebase matters more than the choice.

How do I validate API responses in TypeScript without casting?▼

Validate external data with a schema library like Zod, or Valibot when bundle size matters, and take the inferred type from the schema. Casting an untyped network response to an interface defeats the type checker.

What is the difference between any and unknown in TypeScript?▼

Use unknown for values whose shape you genuinely do not know, then narrow with a type guard before use. The any type disables checking entirely and should be confined to a single typed wrapper module when a dependency ships no types.

Can TypeScript check plain JavaScript files?▼

Yes, add // @ts-check at the top of a file or enable checkJs with allowJs in tsconfig for a whole tree. Describe types with JSDoc annotations like @param and @returns, and the language server produces real diagnostics without a build step.

Why does array.filter not narrow types in TypeScript?▼

A boolean predicate does not teach the compiler anything, so list.filter((x) => x != null) still returns (T | null)[]. Write the predicate as a type guard, list.filter((x): x is T => x != null), to get T[].