dry-types

Derives TypeScript types from single sources using utility types and mapped types.

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/pohlai88/afenda-xforge-v5 --skill dry-types-pohlai88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dry-types
Source: https://github.com/pohlai88/afenda-xforge-v5/tree/main/.agents/skills/dry-types
Command: npx skills add https://github.com/pohlai88/afenda-xforge-v5 --skill dry-types-pohlai88

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Duplicated TypeScript type definitions drift out of sync, causing inconsistency, maintenance burden, and bugs when shared fields are updated in one place but forgotten in another. ## Core Features & Use Cases - Type Derivation Guidance: Shows how to use extends, Pick, Omit, Partial, Required, keyof, and typeof to derive types from a single source of truth instead of copy-pasting fields. - Advanced Type Patterns: Covers mapped types, key remapping with as, ReturnType, Parameters, and indexing into union types for discriminated unions. - Boundary Detection: Explains when NOT to apply DRY, distinguishing semantically related types from coincidentally similar ones to avoid premature abstraction. - Use Case: When you have a User interface and need CreateUserInput and UpdateUserInput variants, derive them with Pick and Partial so they stay in sync automatically. ## Quick Start Ask the AI to review your TypeScript interfaces for duplicated fields and refactor them using Pick, Omit, Partial, or extends.

Frequently Asked Questions about dry-types

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

FAQPage Schema
How do I avoid duplicating TypeScript interface fields?

Use extends to add fields to a base interface, or derive subsets with Pick and Omit. This keeps all derived types synchronized with the single source of truth when the base type changes.

How to create an optional version of a TypeScript type?

Use Partial<T> to make all fields of a type optional, which is ideal for update functions. Combine it with Omit, like Partial<Omit<User, 'id'>>, to exclude immutable fields from updates.

What is the difference between Pick and Omit in TypeScript?

Pick<T, K> creates a type with only the specified keys, while Omit<T, K> creates a type with all keys except the specified ones. Both derive new types from an existing type without duplication.

When should I not apply DRY to TypeScript types?

Avoid factoring out types that are only coincidentally similar, such as Product and Customer both having id and name. If the shared fields are semantically different and may evolve independently, the abstraction is premature.

How do I get a function's return type in TypeScript?

Use ReturnType<typeof myFunction> to derive a type from a function's return value. This keeps the type in sync automatically when the function implementation changes.