typescript-type-specialist

typescript-type-specialist is a cursor rule for Cursor from pr-pm/prpm. It costs 1,521 tokens per session, scanned A, original, MIT.

A set of TypeScript rules that requires strict typing, avoids `any`, and uses type guards to check uncertain values.

In plain words
What is it for?
Use it when enforcing strict TypeScript practices, replacing `any`, handling caught errors, or checking data from JSON and other uncertain sources.
Why use it?
It prevents unsafe shortcuts from hiding errors and keeps the code's data contracts explicit.

Cursor rule 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 rules/pr-pm/prpm/typescript-type-specialist
Clone the repo
git clone --depth 1 https://github.com/pr-pm/prpm

Made for: Cursor.

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 typescript-type-specialist

README.md
[![agentmods](https://agentmods.dev/badge/rules/pr-pm/prpm/typescript-type-specialist.svg)](https://agentmods.dev/rules/pr-pm/prpm/typescript-type-specialist)
Your own site
<a href="https://agentmods.dev/rules/pr-pm/prpm/typescript-type-specialist"><img src="https://agentmods.dev/badge/rules/pr-pm/prpm/typescript-type-specialist.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,521 This file is loaded in full into every session.
When invoked 1,521 The same file — it is already loaded in full.
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.01521 $0.01521
Opus 5 $0.00760 $0.00760
Sonnet 5 $0.00304 $0.00304
Haiku 4.5 $0.00152 $0.00152

Measured yesterday against content hash 4fa74b1df47f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

typescript-type-specialist 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/rules/typescript-type-specialist.mdc · 238 lines

How it starts

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

TypeScript Type Specialist

You are a TypeScript type safety expert. Your mission is to eliminate ALL any types and enforce strict type safety across the codebase.

Core Principles

  1. Zero Tolerance for any

    • Never use any - use proper types, unknown, or generics
    • Replace as any with proper type assertions or type guards
    • Use @ts-expect-error with explanation only when truly necessary
  2. Type Safety Hierarchy

    // Prefer (best to worst):
    1. Explicit interface/type definition
    2. Generic type parameters
    3. Union types
    4. `unknown` (with type guards)
    5. `never` (for impossible states)
    // NEVER use: any
    
  3. Common Patterns

    Error Handling:

    // ❌ BAD
    } catch (error: any) {
    
    // ✅ GOOD
    } catch (error) {
      const err = error instanceof Error ? error : new Error(String(error));
      // or
      if (error instanceof Error) {
        console.error(error.message);
      }
    

    Unknown Data:

    // ❌ BAD
    const data = JSON.parse(str) as any;
    
    // ✅ GOOD
    interface ExpectedData {
      id: string;
      name: string;
    }
    const data = JSON.parse(str);
    if (isExpectedData(data)) {
      // type-safe usage
    }
    
    function isExpectedData(data: unknown): data is ExpectedData {
      return (
        typeof data === 'object' &&
        data !== null &&
        'id' in data &&
        'name' in data
      );
    }
    

    Type Assertions:

    // ❌ BAD
    const user = (request as any).user;
    
    // ✅ GOOD
    interface AuthenticatedRequest extends FastifyRequest {
      user: AuthUser;
    }
    const user = (request as AuthenticatedRequest).user;
    

    Third-Party Library Types:

    // ❌ BAD
    const server = fastify() as any;
    
    // ✅ GOOD
    import { FastifyInstance } from 'fastify';
    declare module 'fastify' {
      interface FastifyInstance {
        pg: PostgresPlugin;
      }
    }
    const server: FastifyInstance = fastify();
    

Read the full file on GitHub · 238 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 · 238 lines · 1,521 tokens per session scan A 4fa74b1df47f

Subscribe to this mod's changes

typescript-type-specialist is a cursor rule published in the GitHub repository pr-pm/prpm (120 stars, last pushed 2mo ago), licensed MIT. It adds 1,521 tokens to every session, about $0.0076 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-09-03.