fix-types

Audit multi-language codebases to enforce strong typing with newtypes and enums.

16|3|Updated May 5, 2026
One-click install
npx skills add https://github.com/Kevin-Liu-01/Agent-Machines --skill fix-types-kevin-liu-01
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fix-types
Source: https://github.com/Kevin-Liu-01/Agent-Machines/tree/main/knowledge/skills/fix-types
Command: npx skills add https://github.com/Kevin-Liu-01/Agent-Machines --skill fix-types-kevin-liu-01

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Audit code to enforce explicit types and prevent semantically invalid values from compiling. All possible types and states should be defined upfront ahead of time. Every bare primitive that carries domain meaning is a bug waiting for a call site to swap two arguments of the same type. The compiler/type-checker is free; runtime debugging is not!

Core Features & Use Cases

  • Newtypes / branded types over bare primitives: wrap each semantic meaning in distinct types to prevent swapped arguments.
  • Checked casts at trust boundaries: enforce explicit bounds when converting untrusted data to your domain types.
  • Enums / union types over booleans: replace multiple bool flags with descriptive enums to encode intent.
  • Discriminants and wire values are part of the contract: document stable numeric/string tags for migrations.

Quick Start

Add newtypes around primitive domain values and replace ambiguous booleans with enums in your codebase.

Frequently Asked Questions about fix-types

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

FAQPage Schema
How do I prevent swapped function arguments when using bare primitive types?

Prevent swapped arguments by wrapping bare primitives in newtypes or branded types, giving each semantic domain value a distinct type so the compiler rejects mismatched calls before runtime debugging is needed.

What is the best way to replace ambiguous boolean flags with enums for stronger typing?

Replace ambiguous booleans with descriptive enums or union types to encode explicit intent, ensuring semantically invalid states become unrepresentable and preventing multiple bool flags from compounding into unclear function signatures.

How do I enforce checked casts at trust boundaries for untrusted wire data?

Enforce checked casts at trust boundaries by applying explicit bounds when converting untrusted wire data into domain types, ensuring discriminants and wire values are documented as part of a stable contract for migrations.

Does this static analysis approach work across multi-language codebases like Rust and TypeScript?

Yes, this static analysis approach audits struct definitions and function interfaces across multi-language codebases including Rust, TypeScript, Python, and Go, implementing newtypes and enums wherever bare primitives carry domain meaning.

Why do I need branded types if my runtime tests already cover invalid states?

Branded types catch semantically invalid values at compile time for free, whereas runtime tests only find bugs after execution when debugging is expensive; defining all possible states upfront prevents invalid data from ever compiling.

When should I not use newtypes to wrap my primitive values?

Avoid wrapping primitives in newtypes when the value carries no domain meaning or acts as a generic pass-through, as adding distinct types there introduces migration overhead without preventing argument swaps or invalid semantic states.