Skip to content
Skill

Principle type system discipline

Guides agents to encode invariants in types so invalid states fail at compile time

Principle type system discipline is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
5.1K
Last commit
License
MIT
Listing updated

Similar skills

About Principle type system discipline

This skill steers an agent toward type-level design when it writes or reviews code in statically typed languages. It covers modeling domain states so impossible combinations cannot be expressed, giving distinct types to values that share a primitive representation, parsing untrusted input once at the edge of a system, handling every variant of a union, and generating types from an existing schema rather than duplicating them by hand.

The guidance is short and principle-based. It is meant to shape design decisions during type design, function signature review, and general coding in typed languages, rather than to run checks or tools. The skill includes no scripts; it points to a separate typescript-best-practices skill for TypeScript-specific syntax.

It works as ordinary instructions loaded by the agent and expects no particular tools. Its examples and principles are language-neutral, though the closing reference is TypeScript-oriented, so it suits projects using TypeScript or similar typed languages.

When your agent uses it

Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, exhaust variants, derive from authoritative schemas.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 2 files (1 KB) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the pstack plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claude

Or copy only this skill to ~/.claude/skills/principle-type-system-discipline:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/principle-type-system-discipline &&
cp -R "$tmp/plugins/pstack/skills/principle-type-system-discipline" ~/.claude/skills/principle-type-system-discipline &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/principle-type-system-discipline inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/principle-type-system-discipline to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/principle-type-system-discipline &&
cp -R "$tmp/plugins/pstack/skills/principle-type-system-discipline" ~/.agents/skills/principle-type-system-discipline &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/principle-type-system-discipline inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/principle-type-system-discipline to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/principle-type-system-discipline &&
cp -R "$tmp/plugins/pstack/skills/principle-type-system-discipline" ~/.cursor/skills/principle-type-system-discipline &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/principle-type-system-discipline inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/principle-type-system-discipline

Or copy the folder to ~/.gemini/skills/principle-type-system-discipline yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/principle-type-system-discipline:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/principle-type-system-discipline &&
cp -R "$tmp/plugins/pstack/skills/principle-type-system-discipline" ~/.copilot/skills/principle-type-system-discipline &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/principle-type-system-discipline inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git

Then copy pstack-claude/plugins/pstack/skills/principle-type-system-discipline into your agent's skills folder as principle-type-system-discipline. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Impossible states excluded
Shows how to shape types so invalid combinations of data cannot be written at all.
Branded semantic primitives
Gives arguments with the same underlying type separate types so they cannot be mixed up.
Boundary parsing
Routes JSON, RPC payloads, config, environment variables and database rows through a parser that returns a typed model.
Exhaustive variant handling
Makes sure every case of a union or variant is handled so unhandled cases are caught by the compiler.
Schema-derived types
Derives types from the authoritative schema file instead of maintaining a parallel hand-written copy.

Good for

  • Review a function signature for ambiguous primitive parameters
  • Redesign a type so invalid state combinations are no longer possible
  • Add validation for API payloads or config at the input boundary
  • Refactor a switch over a union so every variant is covered
  • Replace a hand-written type with one generated from an existing schema

Principle type system discipline FAQ

When does Principle type system discipline apply?

It applies when designing types, reviewing a function signature, or writing code in any statically typed language.

Does Principle type system discipline run any scripts or tools?

No. The skill includes no scripts and does not set allowed tools; it provides guidance the agent follows while working.

Does Principle type system discipline cover TypeScript specifically?

It refers TypeScript syntax questions to a separate typescript-best-practices skill rather than covering them itself.

How do I install Principle type system discipline in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/principle-type-system-discipline to use it in all your projects, or to .claude/skills/principle-type-system-discipline in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.

Does Principle type system discipline run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Principle type system discipline?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Principle type system discipline?

The closest alternatives to Principle type system discipline are TypeScript best practices, Principle model the domain, Principle boundary discipline, Domain modeling and Principle foundational thinking.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from michael-denyer/pstack-claude

  1. Makes the agent read pstack's poteto-mode skill first and follow its routing

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  2. Has the agent restate your goals and the problem you're solving in its own words

    • Open source
    • 5.1K GitHub stars
    • Productivity
  3. Sketches types, signatures and module layout before the agent writes code

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  4. Runs parallel candidate attempts at a task, then merges the best parts into one artifact

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  5. Drafts a personal working-style skill from your past agent conversations

    • Open source
    • 5.1K GitHub stars
    • Developer tools