typescript-patterns

typescript-patterns is a skill for Claude Code, Codex from chandrudp29/skillhub. It costs 30 tokens per session (763 once invoked), scanned A, original, MIT.

A set of modern TypeScript coding guidelines. TypeScript is JavaScript with optional compile-time checks for values and object shapes.

In plain words
What is it for?
Writing, reviewing, and refactoring Node.js, React, and full-stack TypeScript with strict settings, safer types, generics, unions, and build tools.
Why use it?
It encourages the compiler to catch mistakes and discourages unsafe shortcuts such as any, unchecked casts, and non-null assertions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Good fit Writing, reviewing, and refactoring Node.js, React, and full-stack TypeScript with strict settings, safer types, generics, unions, and build tools.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chandrudp29/skillhub/typescript-patterns
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.

Any agent
npx skills add chandrudp29/skillhub --skill typescript-patterns
Clone the repo
git clone --depth 1 https://github.com/chandrudp29/skillhub

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/chandrudp29/skillhub/typescript-patterns/github.svg)](https://agentmods.dev/skills/chandrudp29/skillhub/typescript-patterns)
Your own site
<a href="https://agentmods.dev/skills/chandrudp29/skillhub/typescript-patterns"><img src="https://agentmods.dev/badge/skills/chandrudp29/skillhub/typescript-patterns/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-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/chandrudp29/skillhub/typescript-patterns"><img src="https://agentmods.dev/badge/skills/chandrudp29/skillhub/typescript-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 763 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.00030 $0.00763
Opus 5.5 $0.00012 $0.00305
Sonnet 5.5 $0.00006 $0.00153
Haiku 4.5 $0.00003 $0.00076

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

Security

Grade A, and why

typescript-patterns 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.

skills/typescript-patterns/SKILL.md · 102 lines

How it starts

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

When to Use

Apply when writing, reviewing, or refactoring any TypeScript code. Works for Node.js backends, React frontends, and full-stack projects.

Core Rules

  • Always use strict: true in tsconfig — never disable it to fix an error
  • Prefer type for unions and intersections, interface for object shapes that extend
  • Use unknown over any at boundaries; narrow with type guards before use
  • Never use as casts to silence errors — fix the type instead
  • Avoid ! non-null assertions unless you've verified the value exists

Type Design

// Discriminated unions over boolean flags
type Result<T> =
  | { success: true; data: T }
  | { success: false; error: string };

// Utility types — use them, don't reinvent
type UserPreview = Pick<User, 'id' | 'name' | 'email'>;
type PartialConfig = Partial<Config>;
type ReadonlyUser = Readonly<User>;

// Branded types for semantic safety
type UserId = string & { readonly __brand: 'UserId' };
type EmailAddress = string & { readonly __brand: 'EmailAddress' };

// Const assertions for literal inference
const ROLES = ['admin', 'editor', 'viewer'] as const;
type Role = typeof ROLES[number]; // 'admin' | 'editor' | 'viewer'

Generics

// Constrain generics — never leave them open if you can help it
function first<T>(arr: readonly T[]): T | undefined {
  return arr[0];
}

// Conditional types for inference
type Awaited<T> = T extends Promise<infer U> ? U : T;

// Template literal types for string APIs
type EventName = `on${Capitalize<string>}`;

Runtime Safety

// Type guards at system boundaries
function isUser(value: unknown): value is User {
  return (
    typeof value === 'object' &&
    value !== null &&
    'id' in value &&
    typeof (value as User).id === 'string'
  );
}

// Zod for schema validation at API boundaries
import { z } from 'zod';
const UserSchema = z.object({ id: z.string(), email: z.string().email() });
type User = z.infer<typeof UserSchema>;

Read the full file on GitHub · 102 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 · 102 lines · 30 tokens per session scan A 104b2e86698e

Subscribe to this mod's changes

typescript-patterns is a skill published in the GitHub repository chandrudp29/skillhub (14 stars, last pushed 3mo ago), licensed MIT. It adds 30 tokens to every session and 763 once invoked, about $0.0001 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.

Related

Other skills, from other repositories

typescript-expert

Expert-level TypeScript development with modern tooling, advanced types, and best practices. Use this skill for TypeScript projects requiring type-safe code, modern bundling, and comprehensive testing.

personamanagmentlayer/pcl · 40 tokens

adding-a-command

Creates a new CLI command following the Commander.js pattern in src/commands/. Handles command registration in src/cli.ts, telemetry tracking via tracked() wrapper, and option parsing. Use when user says add command, new CLI command, create subcommand, or adds files to src/commands/. Do NOT use for modifying existing…

caliber-ai-org/ai-setup · 76 tokens

jest-expert

Expert in Jest unit testing framework, mocks, snapshots, coverage reports, watch mode, and custom matchers. Use when the user mentions testing, unit testing, JavaScript, QA, mocking, or snapshots, or when the task involves Jest Framework, Test Structure, Advanced Features, or Basic Unit Tests.

personamanagmentlayer/pcl · 65 tokens

implement-parse-list

Implement the parseList string utility.

zernie/vigiles · 11 tokens

code-review-typescript

Deep TypeScript-specific code review covering type safety, ESM/CJS, async correctness, money precision, and domain modeling. Applied in addition to the generic code-review skill when TypeScript/JavaScript code is detected. Invoked when reviewing TS/JS PRs, TypeScript changes, or performing TypeScript-specific quality…

soulcodex/agentic · 71 tokens

typescript-docs

Comprehensive TypeScript reference covering all language features, type system, generics, narrowing, classes, modules, utility types, TSConfig, and advanced patterns. Use whenever the user mentions TypeScript, types, interfaces, generics, type inference, TSConfig, type guards, decorators, or needs help with any…

pledgeandgrow/pledge-skills · 79 tokens