typescript-pro

Configure strict tsconfig.json and Zod validation for TypeScript projects.

Updated Oct 31, 2024
One-click install
npx skills add https://github.com/thesammykins/dotfiles --skill typescript-pro-thesammykins
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-pro
Source: https://github.com/thesammykins/dotfiles/tree/main/.agents/skills/typescript-pro
Command: npx skills add https://github.com/thesammykins/dotfiles --skill typescript-pro-thesammykins

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Type-safe TypeScript setup and runtime validation guidelines to prevent common bugs caused by weak typing and unchecked inputs.

Core Features & Use Cases

  • Generate a strictly typed tsconfig.json with options such as strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitOverride, forceConsistentCasingInFileNames, and skipLibCheck.
  • Implement runtime validation using Zod for all IO boundaries (API responses, form inputs) to prevent invalid data from propagating.
  • Replace loosely typed variables with branded types to prevent mixing IDs and primitive values, and provide safe patterns for migrating legacy code.
  • Offer a repeatable setup for new projects and a dependable path to upgrade existing codebases to stricter typing standards.

Quick Start

Apply these guidelines to enable strict TypeScript configuration and Zod-based runtime validation in your project.

Frequently Asked Questions about typescript-pro

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

FAQPage Schema
How do I configure a strict TypeScript tsconfig.json to prevent runtime bugs?

To configure strict TypeScript, generate a tsconfig.json enabling options like strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, and noImplicitOverride. This setup enforces rigorous type checking across your project to catch potential bugs during compilation.

Why do I need runtime validation with Zod at my API boundaries in TypeScript?

Runtime validation with Zod is needed at API boundaries to prevent invalid data from propagating through your application. It validates API responses and form inputs against strict schemas, ensuring data integrity beyond static type checking.

What are branded types in TypeScript and when should I use them?

Branded types in TypeScript are specialized primitive types used to prevent type confusion, such as mixing different IDs. You should introduce branded types to replace loosely typed variables and ensure domain-specific values remain distinct.

Can I upgrade an existing TypeScript project to use strict typing standards?

Yes, you can upgrade existing TypeScript projects to strict typing standards. The process provides a dependable migration path to apply strict tsconfig.json rules, integrate Zod validation, and refactor legacy code using safe patterns.

What is the best way to prevent type confusion when migrating legacy TypeScript code?

The best way to prevent type confusion in legacy TypeScript code is replacing loosely typed variables with branded primitives. This approach provides safe migration patterns that distinctly separate IDs and primitive values without breaking existing logic.