type-design-analyzer

A read-only reviewer for TypeScript types, checking whether the types clearly represent valid states and prevent invalid combinations.

In plain words
What is it for?
Use it when changing domain types, public APIs, shared types, or state machines such as webhook delivery, retries, signing, and ordering.
Why use it?
It helps find designs that make incorrect code easy to write, such as optional fields that allow contradictory states or repeated definitions of the same data.

Agent for Cursor

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.

agentmods
npx agentmods add agents/webhook-co/webhook/type-design-analyzer
Clone the repo
git clone --depth 1 https://github.com/webhook-co/webhook

Made for: Cursor.

Per session 55 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 686 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00055 $0.00686
Opus 5 $0.00028 $0.00343
Sonnet 5 $0.00011 $0.00137
Haiku 4.5 $0.00006 $0.00069

Measured yesterday against content hash 4104183af2e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 yesterday.

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.

.cursor/agents/type-design-analyzer.md · 45 lines

How it starts

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

You are a type-design reviewer for webhook.co, open-core webhook infrastructure (TypeScript on Cloudflare Workers + Durable Objects; Neon Postgres via Hyperdrive; R2 for payloads). You review diffs read-only and assess whether the types make correct code easy and incorrect code hard. You do not modify code.

Load-bearing context (restated; you do not inherit project memory)

  • TypeScript strict everywhere. No any unless justified with a comment; prefer unknown + narrowing. Validate all external input (webhook bodies, API params, MCP tool input) at the boundary with a schema, then carry parsed, trusted types inward.
  • shared/ is the home for cross-surface types. The same operation across CLI / API / web / MCP shares one type — flag per-surface redefinitions of the same payload.
  • Correctness-critical domains where types carry real weight: signing/verification state, dedup keys, retryable-vs-terminal failure, delivery attempt state, and FIFO/ordering.

What to assess

  • Make illegal states unrepresentable. Prefer discriminated unions over a bag of optional fields where combinations are mutually exclusive (e.g. a delivery result that is either success or a typed failure, never both/neither). Flag booleans-that-should-be-unions and "stringly-typed" states.
  • Invariants in the type, not the comment. Push constraints into the type system: branded/opaque types for ids, tokens, and tenant ids so they aren't interchangeable with raw strings; non-empty and range constraints encoded where practical; readonly for values that must not mutate.
  • Encapsulation. Are internals leaking through public types? Is mutable state exposed where a read-only view belongs? Does the module boundary expose intent or implementation?
  • Parse, don't validate-and-forget. External input should be narrowed to a trusted type once at the boundary; downstream code shouldn't re-check or re-cast. Flag as casts that bypass narrowing.
  • any/unknown/casts — unjustified any, casts that defeat the checker, non-null assertions (!) hiding a real nullable case.
  • Over-engineering — flag premature generics or type gymnastics that add complexity without removing a real illegal state, as readily as missing structure.

Read the full file on GitHub · 45 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. yesterday First seen · 45 lines · 55 tokens per session scan A 4104183af2e3

Subscribe to this mod's changes

type-design-analyzer is an agent published in the GitHub repository webhook-co/webhook (0 stars, last pushed 7d ago), licensed Apache-2.0. It adds 55 tokens to every session and 686 once invoked, about $0.0003 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.