typescript-patterns

Enforce strict TypeScript typing with generics, utility types, and discriminated unions.

3|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/mauriciodelrio/delriodev-skills --skill typescript-patterns-mauriciodelrio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-patterns
Source: https://github.com/mauriciodelrio/delriodev-skills/tree/main/es-skills/software/typescript-patterns
Command: npx skills add https://github.com/mauriciodelrio/delriodev-skills --skill typescript-patterns-mauriciodelrio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often struggle to write consistent, strict TypeScript typings, manage generics, utility types, discriminated unions, and keep frontend and backend types synchronized, leading to runtime errors and duplicated code.

Core Features & Use Cases

  • Provides a ready‑to‑use strict TypeScript configuration template.
  • Shows common patterns for generics, utility types, discriminated unions, type narrowing, the satisfies operator, branded types, and module augmentation.
  • Demonstrates how to share type definitions between frontend and backend and how to infer types from Zod schemas for runtime validation.

Quick Start

Request the skill to generate a TypeScript interface for a paginated API response using the provided generic patterns.

Frequently Asked Questions about typescript-patterns

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

FAQPage Schema
How do I enforce strict TypeScript typing to eliminate type-related bugs?

Strict TypeScript typing eliminates type-related bugs by applying a tsconfig.json template with strict mode and noUncheckedIndexedAccess enabled, utilizing utility types, discriminated unions, and branded types for safer code.

How do I infer TypeScript types from Zod schemas for runtime validation?

Inferring TypeScript types from Zod schemas for runtime validation is achieved by applying schema inference patterns, allowing you to derive static type definitions directly from runtime validation rules to keep frontend and backend synchronized.

What's the best way to share TypeScript type definitions between frontend and backend?

Sharing TypeScript type definitions between frontend and backend is best done by applying generic patterns and utility types, ensuring robust type synchronization across web applications to prevent duplicated code and runtime errors.

How do I use the satisfies operator and branded types for type narrowing in TypeScript?

Using the satisfies operator and branded types for type narrowing involves applying specific TypeScript patterns that enforce strict type definitions, allowing safe contextual usage without altering the underlying inferred type structure.

Do I need strict mode enabled to use discriminated unions and utility types in TypeScript?

Yes, discriminated unions and utility types require a tsconfig.json with strict mode and noUncheckedIndexedAccess enabled to function properly, ensuring robust type definitions and eliminating type-related bugs in web applications.

How do I generate a TypeScript interface for a paginated API response using generics?

Generating a TypeScript interface for a paginated API response using generics involves applying ready-to-use generic patterns and utility types to define robust, reusable type structures for web application data handling.