type-contracts

Official

Enforce consistent type contracts across stack

AuthorNorfolk-Group
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Ensures consistent data shape and type contracts across the four-layer pipeline (schema → API → financial engine → UI) to prevent mismatches, runtime errors, and silent data loss when adding or modifying fields in the hospitality financial model.

Core Features & Use Cases

  • Four-layer mapping: Documents the authoritative flow from Drizzle ORM schema JSONB columns through flattened API responses to engine Input types and UI YearlyDetail props.
  • JSONB flattening & naming: Specifies snake_case-to-camelCase conversion rules and the preservation of nested JSONB structures in the API while flattening top-level fields.
  • Naming conventions & suffixes: Enforces Response suffix for API types and Input suffix for engine inputs, and requires insert schemas to .omit() autogenerated fields.
  • Nullability and defaults: Defines optional field handling using ? or | null and the engine's fallback behavior using shared constants rather than sentinel zeros.
  • Use cases: Use when adding new data fields, tracing data flow for bug fixes, performing type migrations, or reviewing type safety across the stack.

Quick Start

Add a new property field by updating the Drizzle schema JSONB column, adding the corresponding API Response type, extending the financial engine Input type, and then including the field in the UI YearlyDetail props.

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: type-contracts
Download link: https://github.com/Norfolk-Group/H-Analytics/archive/main.zip#type-contracts

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.