mcpField
P
principle-type-system-discipline

principle-type-system-discipline

github.com/mariusflorescuDevelopment18120 installsUpdated 2w ago
Repository

About principle-type-system-discipline

A coding skill that guides developers and coding agents to use types to rule out invalid states, distinguish semantic values, and validate data at boundaries. It also recommends deriving types from authoritative schemas instead of maintaining parallel definitions.

Key features

  1. 01Brand semantically distinct primitives
  2. 02Parse untyped data at boundaries
  3. 03Derive types from authoritative schemas
  4. 04Prefer types over extra handlers

Use cases

  1. 01Prevent accidental interchange of IDs
  2. 02Validate RPC, JSON, or CLI input
  3. 03Keep types aligned with API or database schemas

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mariusflorescu/pstack-t3 --skill principle-type-system-discipline

After installing, type/principle-type-system-disciplinein Claude Code to confirm it loaded.

Bundled filesagents/openai.yaml

Details

From the project README

Type System Discipline

Make the compiler reject impossible states, mismatched primitives, and unhandled variants. Prefer defining errors and special cases out of existence over proliferating handlers. For TypeScript syntax, see the typescript-best-practices skill.

  • Brand semantic primitives. UserId and OrderId are strings underneath but should not be interchangeable. Give each its own type, such as a branded intersection in TypeScript or a newtype elsewhere. Validate once at creation, trust the type downstream. If two arguments share a primitive type but mean different things, brand them.
  • External data is untyped until parsed. RPC payloads, JSON, IPC messages, CLI args, config files, environment variables, database rows. Have a parse function at every boundary that turns unstructured input into the typed model. The boundary-discipline principle skill says where to put validation.
  • Derive types from authoritative schemas. When a protocol buffer, OpenAPI spec, GraphQL schema, database migration, design-token file, or another file owns a shape, derive from it instead of hand-rolling a parallel type. See the encode-lessons-in-structure principle skill.

Comments

Markdown supported