typescript

typescript is a cursor rule for Cursor from transloadit/node-sdk. It costs 1,297 tokens per session, scanned A, original, MIT.

A set of coding rules for TypeScript, a version of JavaScript that adds types and other checks. It covers naming, file extensions, type inference, imports, and running TypeScript with Node.

In plain words
What is it for?
Use it when writing or reviewing TypeScript and TSX files, especially code that runs in Node or uses JavaScript modules.
Why use it?
It helps keep TypeScript code consistent and avoids unnecessary annotations, unsafe type casts, and outdated ways of running files.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when writing or reviewing TypeScript and TSX files, especially code that runs in Node or uses JavaScript modules.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/transloadit/node-sdk/typescript
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.

Clone the repo
git clone --depth 1 https://github.com/transloadit/node-sdk

Made for: Cursor.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/transloadit/node-sdk/typescript"><img src="https://agentmods.dev/badge/rules/transloadit/node-sdk/typescript.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,297 This file is loaded in full into every session.
When invoked 1,297 The same file — it is already loaded in full.
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.01297 $0.01297
Opus 5.5 $0.00519 $0.00519
Sonnet 5.5 $0.00259 $0.00259
Haiku 4.5 $0.00130 $0.00130

Measured 20d ago against content hash b1b1cacb7fe2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 20d 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.

.ai/rules/typescript.mdc · 81 lines

How it starts

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

For Typescript:

  • Favor contentGapItemSchema = z.object() over ContentGapItemSchema = z.object()
  • Favor from './PosterboyCommand.ts' over from './PosterboyCommand'
  • Favor return ideas.filter(isPresent) over ideas.filter((idea): idea is Idea => idea !== null)
  • Favor using .tsx over .jsx file extensions.
  • Use the repository's declared Node version and native TypeScript stripping instead of tsx or ts-node. Tooling versions do not raise a published package's supported runtime floor; check its own manifest before introducing newer platform APIs.
  • In ESM TypeScript, use import.meta.dirname / import.meta.filename or URL objects instead of rebuilding __dirname with fileURLToPath(import.meta.url) unless compatibility requires it.
  • Use satisfies when you need literal preservation or structural conformance while keeping the expression's inferred type. If the variable should simply have a declared type, use a type annotation instead.
  • Avoid redundant type annotations inside expressions when TypeScript already infers the exact type, especially callback parameters. Keep explicit return types and public boundary annotations.
  • Avoid as, consider it a sin. If a cast is unavoidable, keep it as narrow as possible and explain the upstream type mismatch or runtime invariant.
  • For DOM queries and browser APIs, prefer runtime narrowing such as element instanceof HTMLAnchorElement over type casts. Decide explicitly whether a missing element should throw, return early, or no-op.
  • Browser/client code must not use Node-only globals or APIs such as Buffer. Use browser platform APIs such as btoa, TextEncoder, Blob, or URL, or isolate the logic in server-only code.
  • When browser APIs are missing TypeScript declarations, augment the global interface in _types/global.ts (or the relevant shared global types file) and narrow with checks such as typeof navigator.setAppBadge === 'function' instead of casting navigator locally.
  • Prefer typed DOM properties such as element.inert = true and element.tabIndex = -1 when the platform exposes them. Use setAttribute() only when you intentionally need raw attribute semantics.
  • Favor unknown over any, consider any a sin
  • Avoid as unknown as ... and biome-ignore lint/suspicious/noExplicitAny. If an upstream library type forces either, isolate it in a tiny adapter/helper with a comment naming the bad upstream type.
  • Every @ts-expect-error must be narrow and include a short explanation of the upstream type gap or invariant that makes it safe.
  • Favor validating data with Zod over using any or custom type guards
  • Extract duplicated Zod object shapes, regexes, and descriptions into reusable schema fragments when they describe the same domain concept. Keep property-level concerns such as .optional() and .default() at the property site unless absence is intrinsic to the reusable fragment.
  • Boolean Zod properties should usually use explicit defaults instead of .optional() when omission has normal default behavior. Only leave a boolean optional when undefined is semantically different from false.
  • Prefer z.union([...]) over chained .or() for multi-branch unions, and prefer z.enum() or literal unions over clever regexes when the accepted values are finite and autocomplete matters.
  • Do not duplicate supported values in user-facing schema descriptions when schema metadata such as enums or suggested values can carry that information.
  • In TypeScript files, use TypeScript syntax instead of JSDoc type annotations. In JavaScript files, put JSDoc @import declarations in the top-of-file JSDoc block with the other type imports. Do not use inline import('...') annotations in @param, @returns, or @type. Make sure @type annotates the expression it is meant to type.
  • Avoid hand-written .d.ts files when the declaration can come from TypeScript source or generation. If a declaration file is unavoidable, do not rely on skipLibCheck to hide duplicate or invalid exports.
  • Avoid Reflect.get for normal object property reads. After narrowing to a record, use record[key] or a small typed reader helper. Only keep Reflect.get for exotic receivers such as proxies or framework objects where its semantics are intentionally required, and document why.
  • Prefer Number.isFinite() / Number.isNaN() over global isFinite() / isNaN() so numeric checks do not silently coerce non-numbers.
  • isRecord style guards must reject arrays: typeof value === 'object' && value !== null && !Array.isArray(value). Prefer importing a shared guard when one already exists in the relevant shared layer.
  • Type-only refactors must preserve runtime behavior. If the behavior intentionally changes, call it out in the PR and cover the changed behavior with tests.
  • Use ECMAScript #private fields for private state. Do not rely on underscore names or TypeScript private to imply runtime privacy.
  • Prefer Zod defaults/preprocessing for schema-backed default values instead of duplicating default objects in runtime code.
  • For local TypeScript files, import with the .ts / .tsx extension (not .js, not extensionless). Note: we do not currently enable the TS 5.7 rewriteRelativeImportExtensions compiler option, because it errors on non-relative imports that include .ts/.tsx (for example via paths aliases like @/…). If/when we enable it, we will need to adjust those imports first.
  • Favor defining props as an interface over inline
  • Favor explicit return types over inferring them as it makes typescript a lot faster in the editor on our scale

Read the full file on GitHub · 81 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. 20d ago Changed · +2 lines · +30 tokens per session b1b1cacb7fe2
  2. 1mo ago First seen · 79 lines · 1,267 tokens per session scan A 23387551d699

Subscribe to this mod's changes

typescript is a cursor rule published in the GitHub repository transloadit/node-sdk (73 stars, last pushed yesterday), licensed MIT. It adds 1,297 tokens to every session, about $0.0052 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.