types-and-interfaces

Community

Single-source Zod types for safe immutable state

AuthorTechyMT
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Many TypeScript projects split type declarations and runtime validators, causing drift between compile-time types and runtime behavior that leads to crashes and unhandled cases. This Skill codifies a discipline to derive runtime validation and TypeScript types from the same Zod schema, use discriminated unions for multi-variant outputs, and enforce DeepImmutable AppState to prevent accidental mutation.

Core Features & Use Cases

  • Schema-as-source-of-truth: define inputSchema with Zod and derive TypeScript types with z.infer to avoid duplicate, diverging definitions.
  • Discriminated union outputs: use z.discriminatedUnion for tool outputs so TypeScript exhaustiveness and narrowing eliminate missing-case bugs.
  • Immutable AppState: wrap AppState in DeepImmutable to force immutable updates via setAppState and make state transitions explicit.
  • Use Case: migrating a codebase where manual validators and interfaces disagree, or adding a new tool that must validate LLM JSON output and provide multiple result shapes.

Quick Start

Convert this tool's manual validation and interfaces into a Zod inputSchema, derive the TypeScript type with z.infer, add an outputSchema as a discriminated union if the tool can return multiple result kinds, and make AppState DeepImmutable.

Dependency Matrix

Required Modules

None required

Components

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: types-and-interfaces
Download link: https://github.com/TechyMT/claude-code-superpowers/archive/main.zip#types-and-interfaces

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.