typescript

A set of standards for writing and reviewing TypeScript 5.x code, with emphasis on explicit types, safe handling of missing values, and reusable generics.

In plain words
What is it for?
Use it when implementing or reviewing TypeScript, especially for strict typing, modules, generics, type narrowing, and asynchronous code.
Why use it?
It helps catch type-related mistakes early and keeps public code interfaces easier to understand and maintain. It also guides gradual improvements to existing projects.

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

Made for: Claude Code, Codex.

Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,592 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00046 $0.01592
Opus 5 $0.00023 $0.00796
Sonnet 5 $0.00009 $0.00318
Haiku 4.5 $0.00005 $0.00159

Measured yesterday against content hash 41e60de7d7b0, 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 1 finding 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 yesterday.

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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- Shell string interpolation with untrusted input (`execSync(\`cmd ${userInput}\`)`)
standards/typescript/SKILL.md · 176 lines

How it starts

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

TypeScript Standards

Default load: this file only. Pull refs/tooling.md, refs/testing.md, or refs/security.md only when the task explicitly needs that depth.

Priority: P0 — Type Correctness

Type Annotations

  • Explicit params and return types on all public declarations. Infer locals.
  • Avoid any. Prefer unknown, generics, or a narrowly-scoped escape hatch with a comment when interop forces it.
  • Never use the Function type. Use a typed signature: () => void.

Interfaces vs Types

  • interface for object shapes that describe APIs — supports declaration merging.
  • type for unions, intersections, mapped types, and conditional types.

Strict Mode

  • strict: true in tsconfig. On existing repos, migrate incrementally: strictNullChecksnoImplicitAnystrictFunctionTypes. Never flip strict: true in one step.
  • Avoid non-null assertion (!). Use narrowing (typeof, instanceof, if-checks) instead.
  • ?. and ?? for null safety — use narrowing, not !.

Enums

  • Literal unions or as const objects. No runtime enum.

Generics

  • Use generics for reusable, type-safe code. Constrain with extends where appropriate.

Type Guards

  • Use typeof, instanceof, and predicate functions (x is T) to narrow types.

Utility Types

  • Prefer built-ins: Partial, Required, Pick, Omit, Record, Readonly, NonNullable.
  • Prefer satisfies for object literals that must conform to a contract without widening the inferred type.

Immutability

  • readonly on arrays and object properties. Use as const and satisfies for const assertions.

Discriminated Unions

  • Use a stable discriminant such as kind or type to narrow safely. Switch on the discriminant.
type Result<T> = { kind: 'ok'; data: T } | { kind: 'err'; error: Error };

Branded Types

  • Use brands only when structurally identical values such as IDs or units are easy to mix up across boundaries.
type UserId = string & { readonly __brand: 'UserId' };
function createUserId(id: string): UserId { return id as UserId; }

Read the full file on GitHub · 176 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. yesterday First seen · 176 lines · 46 tokens per session scan A 41e60de7d7b0

Subscribe to this mod's changes

typescript is a skill published in the GitHub repository ndisisnd/cook (2 stars, last pushed 22d ago), licensed MIT. It adds 46 tokens to every session and 1,592 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). 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

pre-landing-review

Pre-landing PR review. Analyzes diff against the base branch for SQL safety, LLM trust boundary violations, conditional side effects, and other structural issues. Use when explicitly asked for the specialized pre-landing workflow. Product /review requests are handled by BitFun's unified Review mechanism instead.…

GCWing/BitFun · 74 tokens

wechat-article-writer

公众号/自媒体全流程。根据用户表述自动匹配:撰写文章、封面图、正文插图、风格提取。支持多种写作风格。当用户提到写公众号、技术博客、公众号封面、正文插图、步骤图、演示图、流程示意、分析写作风格、克隆文风、模仿爆款、提取风格时使用。详见 reference 目录。.

xstongxue/best-skills · 105 tokens

miniapp-dev

Develops, maintains, and generates BitFun MiniApps (Zero-Dialect Runtime). Use when (1) working on miniapp framework code under src/crates/assembly/core/src/miniapp/ or src/web-ui/src/app/scenes/miniapps/; or (2) generating / creating / designing a NEW MiniApp for the user — including any request like "做一个小应用 / 生成…

GCWing/BitFun · 143 tokens

vibe-research

Deep research and market validation for app ideas. Use when starting a new project, validating an idea, or when the user says "research my idea", "validate my app", or "help me start a new project".

KhazP/vibe-coding-prompt-template · 49 tokens

commit-push-pr

Commit selected local changes, push the branch, and create or update a GitHub pull request with BitFun attribution. Use when the user asks to 提交 PR、提代码、commit and push、开 PR、create a pull request, or wants a Claude Code-like one-command PR publishing flow from BitFun.

GCWing/BitFun · 68 tokens

investigate

Systematic debugging with root cause investigation. Four phases: investigate, analyze, hypothesize, implement. Iron Law: no fixes without root cause. Use when asked to "debug this", "fix this bug", "why is this broken", "investigate this error", or "root cause analysis". Proactively invoke this skill (do NOT debug…

GCWing/BitFun · 112 tokens