typescript

A coding style guide for TypeScript, a programming language that adds type checking to JavaScript.

In plain words
What is it for?
It helps write, review, and maintain TypeScript functions, classes, interfaces, files, and error-handling code.
Why use it?
It reduces inconsistent code and common errors by defining rules for types, naming, file layout, errors, and asynchronous operations.

Skill for Claude CodeCodex

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

Made for: Claude Code, Codex.

Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 534 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 $0.00020 $0.00534
Opus 5 $0.00010 $0.00267
Sonnet 5 $0.00004 $0.00107
Haiku 4.5 $0.00002 $0.00053

Measured 2d ago against content hash fef4f53ee3dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

typescript 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 2d 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.

js/testapps/agents/skills/typescript/SKILL.md · 79 lines

How it starts

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

TypeScript Coding Conventions

General Principles

  • Use TypeScript strict mode ("strict": true in tsconfig.json).
  • Prefer const over let; never use var.
  • Use explicit return types on exported functions.
  • Prefer interfaces over type aliases for object shapes.
  • Use unknown instead of any where possible.

Naming Conventions

  • Variables & functions: camelCase
  • Classes & interfaces: PascalCase
  • Constants: UPPER_SNAKE_CASE for true constants, camelCase for derived values
  • Files: kebab-case.ts
  • Type parameters: Single uppercase letter (T, K, V) or descriptive (TResult)

File Structure

src/
  index.ts          # Entry point, exports
  types.ts          # Shared type definitions
  utils/            # Utility functions
  services/         # Business logic
  middleware/       # Express/framework middleware

Error Handling

  • Use typed errors (extend Error class).
  • Always handle promise rejections.
  • Prefer try/catch with specific error types over generic catches.
class AppError extends Error {
  constructor(
    message: string,
    public readonly code: string,
    public readonly statusCode: number = 500
  ) {
    super(message);
    this.name = 'AppError';
  }
}

Async Patterns

  • Use async/await over raw promises.
  • Use Promise.all() for concurrent independent operations.
  • Avoid mixing callbacks and promises.

Imports

  • Use named imports: import { thing } from './module'
  • Group imports: external packages first, then internal modules.
  • Use .js extensions in import paths for ESM compatibility.

Code Style

  • Maximum line length: 100 characters.
  • Use template literals for string interpolation.
  • Prefer Array.map/filter/reduce over for loops for transformations.
  • Use optional chaining (?.) and nullish coalescing (??).
  • Destructure objects and arrays when accessing multiple properties.

Testing

  • Co-locate test files: thing.tsthing.test.ts
  • Use descriptive test names: it('should return empty array when no items match')
  • Test edge cases: empty inputs, null values, error conditions.

Read the full file on GitHub · 79 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. 2d ago First seen · 79 lines · 20 tokens per session scan A fef4f53ee3dc

Subscribe to this mod's changes

typescript is a skill published in the GitHub repository genkit-ai/genkit (6,389 stars, last pushed yesterday), licensed Apache-2.0. It adds 20 tokens to every session and 534 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

llamaindex

Data framework for building LLM applications with RAG. Specializes in document ingestion (300+ connectors), indexing, and querying. Features vector indices, query engines, agents, and multi-modal support. Use for document Q&A, chatbots, knowledge retrieval, or building RAG pipelines. Best for data-centric LLM…

davila7/claude-code-templates · 70 tokens

chat-sdk

Build multi-platform chat bots with Chat SDK (chat npm package). Use when developers want to (1) Build a Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, or WhatsApp bot, (2) Use Chat SDK to handle mentions, direct messages, subscribed threads, reactions, slash commands, cards, modals, files, or AI…

vercel-labs/open-agents · 191 tokens

cross-sdk-parity

Keep TypeScript and Python SDK behavior, generated client usage, public API naming, and docs examples aligned. Use when a change affects both SDKs, when generated client pins move, when comparing TS/Python behavior, or when a backend API contract changed. Do not use for single-language internal-only changes.

ComposioHQ/composio · 66 tokens

typescript-providers

Implement, modify, test, or document TypeScript provider packages under ts/packages/providers, including framework adapters for OpenAI, Anthropic, Google, LangChain, Mastra, Vercel, LlamaIndex, Cloudflare, and Claude Agent SDK. Use for provider-specific TS work; do not use for core-only changes.

ComposioHQ/composio · 70 tokens

typescript-sdk

Implement or modify TypeScript SDK behavior in @composio/core or shared TypeScript packages, including tools, toolkits, sessions, auth configs, connected accounts, modifiers, and generated SDK surfaces. Use for TS runtime/API work; pair with typescript-testing for verification and cross-sdk-parity when Python must…

ComposioHQ/composio · 67 tokens

typescript-testing

Select and run TypeScript SDK verification for packages, examples, type checks, linting, builds, Vitest suites, and runtime E2E tests. Use when adding tests, diagnosing TypeScript CI, choosing a focused test command, or validating TypeScript package changes. Do not use for Python-only checks.

ComposioHQ/composio · 65 tokens