type-design-analyzer

Analyze type definitions and data models for invalid states and weak invariants.

4|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/euxx/claude-skills-for-copilot --skill type-design-analyzer-euxx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-design-analyzer
Source: https://github.com/euxx/claude-skills-for-copilot/tree/main/skills/type-design-analyzer
Command: npx skills add https://github.com/euxx/claude-skills-for-copilot --skill type-design-analyzer-euxx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill reviews type definitions and data models to find places where invalid states, hidden assumptions, or weak constraints can slip through. It helps you redesign APIs so the type system carries more of the real business rules.

Core Features & Use Cases

  • Type Quality Review: Evaluates interfaces, type aliases, classes, enums, and discriminated unions for how well they express and enforce constraints.
  • Invariant Analysis: Identifies required relationships between fields, allowed value ranges, exclusivity rules, and structural requirements.
  • Design Improvements: Recommends stronger patterns such as discriminated unions, branded types, opaque types, readonly fields, and wrapper types.
  • Use Case: A domain model for orders, payments, or user profiles can be reviewed to reveal where impossible combinations are currently allowed and how to prevent them.

Quick Start

Ask the type-design-analyzer skill to review the attached file or folder and report the key invariants, risks, ratings, and concrete type improvements.

Frequently Asked Questions about type-design-analyzer

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

FAQPage Schema
How do I enforce invariants in TypeScript domain models?

To enforce invariants in TypeScript domain models, you can analyze type definitions using discriminated unions, branded types, and readonly modifiers to make invalid states unrepresentable and prevent impossible field combinations.

What makes invalid states unrepresentable in TypeScript?

Invalid states become unrepresentable in TypeScript by applying structural design patterns like discriminated unions, opaque types, and wrapper types to type aliases and interfaces, ensuring the type system strictly enforces business rules and constraints.

How do I review TypeScript interfaces for weak type constraints?

You can review TypeScript interfaces for weak type constraints by evaluating invariant expression, encapsulation, and enforcement on a 1–10 scale, then applying concrete recommendations like branded types or readonly modifiers to strengthen the data model.

Can I use static analysis to find hidden assumptions in API contracts?

Yes, you can use static analysis to find hidden assumptions in API contracts by reviewing type definitions, enums, and classes to identify exclusivity rules, allowed value ranges, and required field relationships that are weakly enforced.

When should I use discriminated unions over type aliases in TypeScript?

You should use discriminated unions over type aliases in TypeScript when you need to enforce structural requirements and exclusivity rules between fields, ensuring that only valid combinations of data can be represented in the domain model.

What are the limitations of static type analysis for complex domain modeling?

Static type analysis for complex domain modeling requires explicit identification of constraints and cannot automatically infer unwritten business rules, meaning developers must manually define invariants and structural requirements for the analysis to be effective.