type-design-review

Analyzes diffs for data model and function signature changes to identify and prevent illegal states.

62|2|Updated May 29, 2026
One-click install
npx skills add https://github.com/lucasfcosta/backpressured --skill type-design-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-design-review
Source: https://github.com/lucasfcosta/backpressured/tree/main/skills/type-design-review
Command: npx skills add https://github.com/lucasfcosta/backpressured --skill type-design-review

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Backpressured code-review requires evaluating whether diffs rely on the type system to prevent invalid or unreachable states. This guide helps reviewers focus on data models, function signatures, and domain types, ensuring illegal states cannot be constructed or represented.

Core Features & Use Cases

  • Type-safety lens for reviewing diffs that touch models or APIs, guiding reviewers to identify forbidden states.
  • Refactoring guidance toward discriminated unions, branded types, and parse-at-boundary approaches to enforce invariants.
  • Language mappings for TypeScript with references to Rust, Swift, Kotlin, and Haskell/OCaml to align cross-language design.

Quick Start

Begin by reviewing the diff for data-model, signature, or domain-type changes and propose type-safe alternatives that forbid illegal states.

Frequently Asked Questions about type-design-review

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

FAQPage Schema
How do I enforce type safety and prevent illegal states in a TypeScript code review?

To enforce type safety in code reviews, analyze diffs for data model and signature changes, then propose refactors like discriminated unions or branded types to make illegal states unrepresentable at compile time.

What is the parse-at-boundary pattern for static analysis and when should I use it?

The parse-at-boundary pattern validates untrusted data at the system edge, converting it into safe domain types so that invalid states cannot propagate into application logic, ensuring invariants hold throughout the codebase.

How do I refactor TypeScript function signatures to forbid invalid domain types?

Refactor TypeScript function signatures by applying discriminated unions to represent distinct states explicitly, or use branded types to tag primitives, ensuring the compiler rejects any invalid domain types at build time.

Do type-design refactoring principles apply to languages other than TypeScript?

Type-design refactoring principles apply across languages, with the guide providing specific mappings from TypeScript to Rust, Swift, Kotlin, and Haskell/OCaml to align cross-language domain type design and invariant enforcement.

When should I not use branded types or discriminated unions for refactoring?

Avoid branded types or discriminated unions when refactoring if the diff does not touch domain types or data models, as applying structural type changes to simple logic flows adds unnecessary complexity without improving compile-time invariants.