typescript-type-definitions

Map API snake_case fields to TypeScript types for domain models.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/wonkpentink/agent-skills-fe --skill typescript-type-definitions-wonkpentink
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-type-definitions
Source: https://github.com/wonkpentink/agent-skills-fe/tree/main/skills/typescript-type-definitions
Command: npx skills add https://github.com/wonkpentink/agent-skills-fe --skill typescript-type-definitions-wonkpentink

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide provides a structured blueprint for building TypeScript type definitions that map API shapes to strongly typed models, enabling safer, more maintainable code across src/types.

  • It ensures API snake_case fields align with TypeScript types, supports form-oriented shapes, and defines union types for statuses and enums, all to reduce duplication and errors when modeling domain data such as Contact, Address, Lead, Column, and User.
  • It also demonstrates patterns for generic component props and nested/complex types to improve reusability and scalability in large codebases.

Core Features & Use Cases

  • API Data Models: snake_case API fields mapped to TypeScript types with optional fields clearly marked.
  • Form Oriented Types: separate Form types derived from API models to optimize for validation and submission.
  • Union & Generic Patterns: literal unions for statuses and generic Column<T> definitions for reusable UI components.
  • Domain Patterns: reusable templates for ContactType, AddressType, LeadType, ColumnType, UserType, TabsType, with examples in discussions of API mapping, forms, and components.
  • Export Strategy: guidance on barrel exports and module boundaries to keep types discoverable.

Quick Start

Start by defining an API model in src/types, then create a corresponding form type and a status union to enable end-to-end type safety.

Frequently Asked Questions about typescript-type-definitions

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

FAQPage Schema
How do I map API snake_case fields to TypeScript types?

To map API snake_case fields to TypeScript types, define strongly typed domain models in src/types that directly align with the API response shapes, clearly marking optional fields to ensure type safety across your codebase.

What is the best way to structure TypeScript types for form inputs and validation?

The best way to structure TypeScript types for forms is to create separate, form-oriented types derived from your API models, optimizing the data shapes specifically for form validation and submission logic.

How do I create reusable TypeScript types for generic component props?

To create reusable TypeScript types for generic component props, define patterns like generic Column<T> definitions and establish clear prop interfaces to improve reusability and scalability across your UI components.

How do you define union types for statuses and enums in TypeScript domain models?

Defining union types for statuses and enums in TypeScript domain models involves using literal unions to constrain values, ensuring type safety for status fields like Lead or User states throughout the application.

How should I organize and export TypeScript types in a large codebase?

Organize and export TypeScript types in a large codebase by applying a clear export strategy using barrel exports and defined module boundaries, keeping domain types like Contact, Address, and Lead discoverable and maintainable.

Do I need separate TypeScript types for API data models and form inputs?

Yes, you need separate TypeScript types for API data models and form inputs to reduce duplication and errors, mapping snake_case API fields to base models and deriving form-optimized shapes for validation.