typescript-patterns

typescript-patterns is a skill for Claude Code, Codex from Jignesh-Ponamwar/skills-mcp. It costs 86 tokens per session (2,498 once invoked), scanned A, original, Apache-2.0.

A guide to writing TypeScript code with precise rules for data shapes, values, and function results. It covers strict compiler settings and advanced type features such as generics and utility types.

In plain words
What is it for?
Use it when writing or reviewing TypeScript, configuring tsconfig, designing type-safe APIs, replacing any or unknown, and modeling different possible states of data.
Why use it?
It helps catch mistakes while writing code instead of discovering them later at runtime. It also provides patterns for keeping APIs and shared data definitions consistent.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or reviewing TypeScript, configuring tsconfig, designing type-safe APIs, replacing any or unknown, and modeling different possible states of data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jignesh-ponamwar/skills-mcp/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 Jignesh-Ponamwar/skills-mcp --skill typescript-patterns
Clone the repo
git clone --depth 1 https://github.com/Jignesh-Ponamwar/skills-mcp

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/jignesh-ponamwar/skills-mcp/typescript-patterns.svg)](https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/typescript-patterns)
Your own site
<a href="https://agentmods.dev/skills/jignesh-ponamwar/skills-mcp/typescript-patterns"><img src="https://agentmods.dev/badge/skills/jignesh-ponamwar/skills-mcp/typescript-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,498 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.00086 $0.02498
Opus 5 $0.00043 $0.01249
Sonnet 5 $0.00017 $0.00500
Haiku 4.5 $0.00009 $0.00250

Measured 8d ago against content hash 4d4fb2550080, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-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 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.

skill_mcp/skills_data/typescript-patterns/SKILL.md · 358 lines

How it starts

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

TypeScript Patterns Skill

1. Strict tsconfig (Always Start Here)

{
  "compilerOptions": {
    "strict": true,               // enables all strict checks
    "noUncheckedIndexedAccess": true,  // arr[0] returns T | undefined
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "exactOptionalPropertyTypes": true,
    "useUnknownInCatchVariables": true,
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "lib": ["ES2022"],
    "outDir": "./dist",
    "rootDir": "./src",
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true
  }
}

2. Utility Types - Essential Reference

interface User {
  id: number
  name: string
  email: string
  age?: number
}

// Partial - all properties optional
type UpdateUser = Partial<User>

// Required - all properties required
type StrictUser = Required<User>

// Pick - select specific properties
type UserSummary = Pick<User, 'id' | 'name'>

// Omit - exclude specific properties
type PublicUser = Omit<User, 'email'>

// Readonly - prevent mutation
type ImmutableUser = Readonly<User>

// Record - typed object with known key shape
type UserById = Record<number, User>
type RolePermissions = Record<'admin' | 'editor' | 'viewer', string[]>

// Extract / Exclude
type StringOrNumber = string | number | boolean
type OnlyStrNum = Extract<StringOrNumber, string | number>   // string | number
type NoString = Exclude<StringOrNumber, string>               // number | boolean

// ReturnType / Parameters
function getUser(id: number): Promise<User> { ... }
type GetUserReturn = Awaited<ReturnType<typeof getUser>>      // User
type GetUserParams = Parameters<typeof getUser>               // [id: number]

// NonNullable
type MaybeUser = User | null | undefined
type DefiniteUser = NonNullable<MaybeUser>                   // User

3. Generics - Patterns

// Generic function
function first<T>(arr: readonly T[]): T | undefined {
  return arr[0]
}

// Generic with constraint
function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
  return obj[key]
}

// Generic interface with default
interface ApiResponse<T = unknown> {
  data: T
  status: number
  message: string
}

// Multiple type parameters
function merge<A, B>(a: A, b: B): A & B {
  return { ...a, ...b }
}

// Generic class
class Repository<T extends { id: number }> {
  private items = new Map<number, T>()

  save(item: T): void {
    this.items.set(item.id, item)
  }

  findById(id: number): T | undefined {
    return this.items.get(id)
  }

  findAll(): T[] {
    return [...this.items.values()]
  }
}

Read the full file on GitHub · 358 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 · 358 lines · 86 tokens per session scan A 4d4fb2550080

Subscribe to this mod's changes

typescript-patterns is a skill published in the GitHub repository Jignesh-Ponamwar/skills-mcp (7 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 86 tokens to every session and 2,498 once invoked, about $0.0004 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.

Related

Other skills, from other repositories

aws-sst-development

SST v4 (Ion) expert for managing AWS resources as code with the Pulumi-backed framework.

sickn33/agentic-awesome-skills · 26 tokens

files-sdk

Use files-sdk to add file storage to a TypeScript/JavaScript app with a unified API across S3, R2, GCS, Azure, Vercel Blob, the local filesystem, and 40+ other providers. Triggers when the user wants to upload/download/list/move/delete/copy files, generate presigned URLs, do multipart or resumable uploads, range…

haydenbleasel/files-sdk · 194 tokens

javascript-typescript-typescript-scaffold

You are a TypeScript project architecture expert specializing in scaffolding production-ready Node.js and frontend applications. Generate complete project structures with modern tooling (pnpm, Vite, N.

rmyndharis/antigravity-skills · 43 tokens

nodejs-backend-patterns

Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.

rmyndharis/antigravity-skills · 58 tokens

database-orm-expert

Expert guide for database schema design, ORM tools (Prisma 6, Drizzle ORM, TypeORM), migrations, query optimization, and type-safe SQL patterns in TypeScript / Panduan ahli untuk desain skema database, ORM tools (Prisma 6, Drizzle ORM, TypeORM), migrasi, optimasi query, dan pola SQL type-safe di TypeScript.

roedyrustam/vibes-plug · 82 tokens

js-backend-expert

Expert-level skill for Node.js 24+ (LTS), Bun 1.2+, and Deno 2.x backend development. Covers Express 5, Fastify 5, Hono v4, NestJS, Prisma 6, Drizzle ORM, WebSockets, BullMQ, OpenTelemetry, and microservices in English and Indonesian.

roedyrustam/vibes-plug · 77 tokens