typescript-conventions

typescript-conventions is a skill for Claude Code, Codex from pau-vega/Devkit-AI. It costs 66 tokens per session (1,807 once invoked), scanned A, original, MIT.

A set of rules for writing and reviewing TypeScript, a programming language that adds type checks to JavaScript. It covers data types, functions, errors, imports, and naming.

In plain words
What is it for?
Use it when creating or reviewing TypeScript files and deciding how to define data, handle errors, structure imports, and name code.
Why use it?
It keeps TypeScript code consistent and catches unclear or unsafe patterns, such as impossible data states, missing return types, and unrestricted values.

Skill for Claude CodeCodex

Part of the typescript-rules plugin — 1 skill, 1 command, 1 agent shipped together

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 skills/pau-vega/devkit-ai/typescript-conventions
Any agent
npx skills add pau-vega/Devkit-AI --skill typescript-conventions
Clone the repo
git clone --depth 1 https://github.com/pau-vega/Devkit-AI

Made for: Claude Code, Codex.

Or install typescript-rules, the plugin that ships this one along with the rest of its 1 skill, 1 command, 1 agent.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/pau-vega/devkit-ai/typescript-conventions.svg)](https://agentmods.dev/skills/pau-vega/devkit-ai/typescript-conventions)
Your own site
<a href="https://agentmods.dev/skills/pau-vega/devkit-ai/typescript-conventions"><img src="https://agentmods.dev/badge/skills/pau-vega/devkit-ai/typescript-conventions.svg" alt="Measured on agentmods" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,807 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.1 $0.00066 $0.01807
Opus 5 $0.00033 $0.00903
Sonnet 5 $0.00013 $0.00361
Haiku 4.5 $0.00007 $0.00181

Measured 5d ago against content hash 2dead86d9f20, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

typescript-conventions 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 5d 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.

plugins/typescript-rules/skills/typescript-conventions/SKILL.md · 258 lines

How it starts

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

TypeScript Conventions

Types & Interfaces

Prefer interface extends over &

The & (intersection) operator has poor performance in the TypeScript compiler. Use interface extends for inheritance — it's faster and produces clearer error messages.

// Avoid
type C = A & B;

// Prefer
interface C extends A, B {}

Only use & where interface extends is not possible (e.g., combining mapped types).

Use discriminated unions for variant data

Model data that can be in different shapes with a shared discriminant field. This prevents the "bag of optionals" problem where impossible states are representable.

// Avoid — allows { status: "idle", data: someValue }
type FetchingState<TData> = {
  status: "idle" | "loading" | "success" | "error";
  data?: TData;
  error?: Error;
};

// Prefer — each status carries exactly the right fields
type FetchingState<TData> =
  | { status: "idle" }
  | { status: "loading" }
  | { status: "success"; data: TData }
  | { status: "error"; error: Error };

Handle discriminated unions with switch statements:

const handleEvent = (event: Event) => {
  switch (event.type) {
    case "user.created":
      console.log(event.data.email);
      break;
    case "user.deleted":
      console.log(event.data.id);
      break;
  }
};

Avoid readonly unless strictly needed

Do not add readonly to properties by default. Only use it when immutability is a critical invariant that must be enforced at compile time (e.g., a shared config object that must never be mutated).

// Default — no readonly
type User = {
  id: string;
  name: string;
};

Prefer optional properties over T | undefined

Use prop?: T for optional properties — it's more concise and idiomatic.

// Avoid
type AuthOptions = {
  userId: string | undefined;
};

// Prefer
type AuthOptions = {
  userId?: string;
};

noUncheckedIndexedAccess awareness

When this tsconfig option is enabled, indexing into arrays and records returns T | undefined instead of T. Handle the undefined case — don't assume the value exists.

Read the full file on GitHub · 258 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. 5d ago First seen · 258 lines · 66 tokens per session scan A 2dead86d9f20

Subscribe to this mod's changes

typescript-conventions is a skill published in the GitHub repository pau-vega/Devkit-AI (2 stars, last pushed 20d ago), licensed MIT. It adds 66 tokens to every session and 1,807 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.

Related

Other skills, from other repositories

frontend-ai-guide

Applies React/TypeScript-specific technical decision criteria, anti-pattern detection, debugging, and frontend quality gates. Use when reviewing components, hooks, browser behavior, or frontend implementation completeness.

shinpr/claude-code-workflows · 41 tokens

better-auth

Skill for integrating Better Auth - comprehensive TypeScript authentication framework for Cloudflare D1, Next.js, Nuxt, and 15+ frameworks. Use when adding auth, encountering D1 adapter errors, or implementing OAuth/2FA/RBAC features.

secondsky/claude-skills · 53 tokens

typescript-rules

React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Use when implementing React components, TypeScript code, or frontend features.

shinpr/claude-code-workflows · 39 tokens

bun-bundler

This skill should be used when the user asks about "bun build", "Bun.build", "bundling with Bun", "code splitting", "tree shaking", "minification", "sourcemaps", "bundle optimization", "esbuild alternative", "building for production", "bundling TypeScript", "bundling for browser", "bundling for Node", or…

secondsky/claude-skills · 90 tokens

bun-file-io

Use for Bun file I/O: Bun.file, Bun.write, streams, directories, glob patterns, metadata.

secondsky/claude-skills · 27 tokens

bun-hot-reloading

Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Covers watch mode, hot mode, and HTTP server reload.

secondsky/claude-skills · 42 tokens