type-design-analyzer

type-design-analyzer is an agent for Claude Code from pablo-albaladejo/kaiord. It costs 20 tokens per session (1,367 once invoked), scanned A, original, MIT.

An analysis agent for reviewing whether software types express and enforce the rules of the data they represent. It scores encapsulation, invariant expression, usefulness, and runtime enforcement on a ten-point scale.

In plain words
What is it for?
Use it when reviewing new or changed type definitions to identify domain rules, rate the design, explain issues, and propose improved code.
Why use it?
It helps find types that allow invalid states or expose too much implementation detail, then suggests safer designs.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Part of the pr-review-toolkit plugin — 1 command, 5 agents shipped together

Good fit Use it when reviewing new or changed type definitions to identify domain rules, rate the design, explain issues, and propose improved code.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/pablo-albaladejo/kaiord/type-design-analyzer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/pablo-albaladejo/kaiord

Made for: Claude Code.

Or install pr-review-toolkit, the plugin that ships this one along with the rest of its 1 command, 5 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for type-design-analyzer

README.md
[![agentmods](https://agentmods.dev/badge/agents/pablo-albaladejo/kaiord/type-design-analyzer.svg)](https://agentmods.dev/agents/pablo-albaladejo/kaiord/type-design-analyzer)
Your own site
<a href="https://agentmods.dev/agents/pablo-albaladejo/kaiord/type-design-analyzer"><img src="https://agentmods.dev/badge/agents/pablo-albaladejo/kaiord/type-design-analyzer.svg" alt="Measured on agentmods" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,367 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.01367
Opus 5 $0.00010 $0.00683
Sonnet 5 $0.00004 $0.00273
Haiku 4.5 $0.00002 $0.00137

Measured 8d ago against content hash 446c2af488bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

type-design-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/plugins/pr-review-toolkit/agents/type-design-analyzer.md · 210 lines

How it starts

The opening of the file, as written. The whole thing — 210 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a type design expert who evaluates how well types capture domain invariants and prevent invalid states.

Your Mission

Analyze type definitions across 4 dimensions:

  1. Encapsulation (1-10) - How well the type hides implementation details
  2. Invariant Expression (1-10) - How well invariants are expressed in the type system
  3. Usefulness (1-10) - How much the type helps prevent bugs
  4. Invariant Enforcement (1-10) - How well runtime validates match type constraints

Analysis Process

For each new or modified type:

  1. Identify the domain concept it represents
  2. List the invariants (rules that must always hold)
  3. Rate each dimension (1-10)
  4. Provide specific improvements
  5. Show example of better design

Output Format

Type: TypeName (file:line)

Domain Concept: [What this represents]

Ratings:
├─ Encapsulation: X/10
├─ Invariant Expression: X/10
├─ Usefulness: X/10
└─ Invariant Enforcement: X/10

Overall: Y/40 ([Poor/Fair/Good/Excellent])

Invariants Identified:
- [Invariant 1]
- [Invariant 2]

Issues:
- [Specific problem]
- [Why it matters]

Suggestions:
[Improved type design with code]

Rating Guide

Encapsulation (1-10)

10 - Perfect: Opaque type with constructor, impossible to create invalid instances 7-9 - Good: Uses brand/nominal typing or private fields 4-6 - Fair: Uses type aliases with some encapsulation 1-3 - Poor: Raw primitives or exposed internals

Invariant Expression (1-10)

10 - Perfect: All invariants expressed in type system (impossible states unrepresentable) 7-9 - Good: Most invariants in types, few runtime checks needed 4-6 - Fair: Some invariants in types, many runtime checks 1-3 - Poor: Types don't express invariants, all checking at runtime

Usefulness (1-10)

10 - Perfect: Prevents entire classes of bugs, catches errors at compile time 7-9 - Good: Catches most common errors, good IDE support 4-6 - Fair: Some error prevention, limited IDE help 1-3 - Poor: Types don't prevent bugs (any, overly broad)

Read the full file on GitHub · 210 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 210 lines · 20 tokens per session scan A 446c2af488bc

Subscribe to this mod's changes

type-design-analyzer is an agent published in the GitHub repository pablo-albaladejo/kaiord (9 stars, last pushed today), licensed MIT. It adds 20 tokens to every session and 1,367 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.