TypeScript Type Extraction
CommunityRefactor inline types into reusable, clear definitions.
Software Engineering#code quality#typescript#interfaces#maintainability#generics#type aliases#type extraction#type refactoring
Authordjankies
Version1.0.0
Installs0
System Documentation
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.tsinto a newsrc/types/user.tsfile, creating interfaces forUserInputandUser, 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.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: TypeScript Type Extraction Download link: https://github.com/djankies/claude-configs/archive/main.zip#typescript-type-extraction Please download this .zip file, extract it, and install it in the .claude/skills/ directory.