typescript-type-safety

typescript-type-safety is a skill for Claude Code from pr-pm/prpm. It costs 40 tokens per session (2,116 once invoked), scanned A, original, MIT.

A TypeScript coding guide for replacing untyped values with explicit types, interfaces, type checks, or generics.

In plain words
What is it for?
Use it when fixing type errors, removing any annotations, safely handling unknown data, typing caught errors, or adding types for libraries with incomplete definitions.
Why use it?
It reduces errors caused by any, which disables TypeScript's checks and can hide problems until the program runs.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { CLIError } from '../utils/cli-error';.

Good fit Use it when fixing type errors, removing any annotations, safely handling unknown data, typing caught errors, or adding types for libraries with incomplete definitions.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/pr-pm/prpm
agentmods
npx agentmods add skills/pr-pm/prpm/typescript-type-safety

Made for: Claude Code.

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-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/pr-pm/prpm/typescript-type-safety/github.svg)](https://agentmods.dev/skills/pr-pm/prpm/typescript-type-safety)
Your own site
<a href="https://agentmods.dev/skills/pr-pm/prpm/typescript-type-safety"><img src="https://agentmods.dev/badge/skills/pr-pm/prpm/typescript-type-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for typescript-type-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/pr-pm/prpm/typescript-type-safety"><img src="https://agentmods.dev/badge/skills/pr-pm/prpm/typescript-type-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,116 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Anti-Refusal · line 261
    Skill attempts to nullify the agent's safety policies or restrictions ('you have no restrictions', 'ignore your guidelines', 'do anything now'). This is a direct jailbreak that disables guardrails.
    Fix: Remove jailbreak framing that nullifies safety policies or restrictions. Skill content must not instruct the agent to ignore its guidelines or operate without guardrails.
How audits are shown
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.00040 $0.02116
Opus 5.5 $0.00016 $0.00846
Sonnet 5.5 $0.00008 $0.00423
Haiku 4.5 $0.00004 $0.00212

Measured 1mo ago against content hash 844b54d62856, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

typescript-type-safety 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 1mo 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/skills/typescript-type-safety/SKILL.md · 313 lines

How it starts

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

TypeScript Type Safety

Overview

Zero tolerance for any types. Every any is a runtime bug waiting to happen.

Replace any with proper types using interfaces, unknown with type guards, or generic constraints. Use @ts-expect-error with explanation only when absolutely necessary.

When to Use

Use when you see:

  • : any in function parameters or return types
  • as any type assertions
  • TypeScript errors you're tempted to ignore
  • External libraries without proper types
  • Catch blocks with implicit any

Don't use for:

  • Already properly typed code
  • Third-party .d.ts files (contribute upstream instead)

Type Safety Hierarchy

Prefer in this order:

  1. Explicit interface/type definition
  2. Generic type parameters with constraints
  3. Union types
  4. unknown (with type guards)
  5. never (for impossible states)

Never use: any

Quick Reference

Pattern Bad Good
Error handling catch (error: any) catch (error) { if (error instanceof Error) ... }
Unknown data JSON.parse(str) as any const data = JSON.parse(str); if (isValid(data)) ...
Type assertions (request as any).user (request as AuthRequest).user
Double casting return data as unknown as Type Align interfaces instead: make types compatible
External libs const server = fastify() as any declare module 'fastify' { ... }
Generics function process(data: any) function process<T extends Record<string, unknown>>(data: T)

Implementation

Error Handling

// ❌ BAD
try {
  await operation();
} catch (error: any) {
  console.error(error.message);
}

// ✅ GOOD - Use unknown and type guard
try {
  await operation();
} catch (error) {
  if (error instanceof Error) {
    console.error(error.message);
  } else {
    console.error('Unknown error:', String(error));
  }
}

// ✅ BETTER - Helper function
function toError(error: unknown): Error {
  if (error instanceof Error) return error;
  return new Error(String(error));
}

try {
  await operation();
} catch (error) {
  const err = toError(error);
  console.error(err.message);
}

Read the full file on GitHub · 313 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. 1mo ago First seen · 313 lines · 40 tokens per session scan A 844b54d62856

Subscribe to this mod's changes

typescript-type-safety is a skill published in the GitHub repository pr-pm/prpm (123 stars, last pushed 7d ago), licensed MIT. It adds 40 tokens to every session and 2,116 once invoked, about $0.0002 per session on Opus 5.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-30.