typescript-dev_skill

This skill helps you write type-safe TypeScript by enforcing strict config, Zod validation, and modern TS features for reliable runtime behavior.
  • TypeScript

25

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill outfitter-dev/agents --skill typescript-dev

  • SKILL.md11.2 KB

Overview

This skill focuses on production-grade TypeScript development with strict type safety, modern TS 5.2+ features, and runtime validation using Zod. It provides patterns for eliminating any, building Result types, discriminated unions, branded types, and leveraging new language features like using, satisfies, const type parameters, and inferred predicates. Use it to enforce compile-time guarantees and safe runtime boundaries across APIs, services, and libraries.

How this skill works

The skill inspects code and offers concrete replacements for unsafe patterns (any, non-exhaustive unions, non-validated inputs) and recommends strict tsconfig settings. It suggests Zod schemas and safeParse usage at boundaries, Result-based error handling, branded types for domain safety, and modern TypeScript idioms to preserve literal types and enable automatic cleanup. It also enforces documentation practices via TSDoc for all exports to improve maintainability and AI consumption.

When to use it

  • Writing new TypeScript code or migrating existing code toward strict safety
  • Eliminating any and replacing it with unknown + guards or validated types
  • Validating API inputs/outputs, environment variables, and forms with Zod
  • Implementing explicit error handling with Result/Either types
  • Modeling finite states with discriminated unions to prevent illegal combinations

Best practices

  • Enable strict tsconfig options including noUncheckedIndexedAccess and exactOptionalPropertyTypes
  • Prefer unknown + type guards over any; use safeParse instead of parse for Zod
  • Use discriminated unions for state, branded types for domain primitives, and Result for errors
  • Use satisfies, const type parameters, and inferred predicates (TS 5.5+) to retain literal types and safer generics
  • Use using for resource cleanup and add TSDoc for every exported function/type

Example use cases

  • Validate HTTP JSON payloads server-side with Zod schemas and safeParse before mapping to domain types
  • Replace thrown-only APIs with Result-returning functions and handle errors explicitly in callers
  • Model UI request state with discriminated unions to avoid impossible states and simplify rendering logic
  • Create branded types (UserId, SanitizedHtml) to prevent accidental mixing of primitives
  • Use using for database connections and file handles to guarantee deterministic disposal

FAQ

No. Use Zod at boundaries where runtime validation is required (API inputs, env, form data). Inside your domain prefer TypeScript types and constructors validated at creation.

Why prefer Result over exceptions?

Result makes errors explicit in types so callers must handle failure cases; this reduces hidden runtime errors and improves control flow for recoverable failures.

Can I adopt these rules incrementally?

Yes. Start by enabling strict compiler options, replace any with unknown in hotspots, add Zod validation at external boundaries, and convert a few error-prone functions to Result to gain incremental benefits.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational