TypeScript Type Extraction

Extract inline TypeScript types into named definitions in new type modules.

Updated Nov 21, 2025
One-click install
npx skills add https://github.com/djankies/claude-configs --skill typescript-type-extraction
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TypeScript Type Extraction
Source: https://github.com/djankies/claude-configs/tree/main/typescript/skills/TYPES-extract
Command: npx skills add https://github.com/djankies/claude-configs --skill typescript-type-extraction

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inline and duplicated type definitions lead to code bloat, reduced readability, and maintenance headaches in TypeScript projects. This Skill guides you in refactoring these into reusable, well-organized type definitions.

Core Features & Use Cases

  • Identify Inline Types: Automatically detects object type literals, unnamed unions/intersections, and complex type expressions that need extraction.
  • Design Type Structure: Guides on using interfaces for object shapes, type aliases for unions/primitives/functions, and generics for reusable patterns.
  • Extract & Refactor: Moves inline types to named definitions, creating new type modules (types.ts) and giving descriptive names.
  • Optimize & Simplify: Replaces duplicate types, simplifies complex inline types, and applies utility types (Omit, Partial) for conciseness.
  • Use Case: Extract inline object types from src/services/userService.ts into a new src/types/user.ts file, creating interfaces for UserInput and User, and updating all references for improved readability and maintainability.

Quick Start

Identify inline type definitions in src/components/ProductCard.tsx and extract them into a new src/types/product.ts file.