ts-coding-rules

The current codebase enforces strict type safety, accessibility standards, and consistent code quality for JavaScript/TypeScript projects using Biome's lightning-fast formatter and linter.

Cursor rule for Cursor

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 rules/reliverse/experiments/ts-coding-rules
Clone the repo
git clone --depth 1 https://github.com/reliverse/experiments

Made for: Cursor.

Per session 2,735 This file is loaded in full into every session.
When invoked 2,735 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin unknown 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.02735 $0.02735
Opus 5 $0.01367 $0.01367
Sonnet 5 $0.00547 $0.00547
Haiku 4.5 $0.00274 $0.00274

Measured today against content hash 332c5c6cb374, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ts-coding-rules 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 today.

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.

.cursor/deprecated/ts-coding-rules.mdc · 272 lines

How it starts

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

Project Context

The current codebase enforces strict type safety, accessibility standards, and consistent code quality for JavaScript/TypeScript projects using Biome's lightning-fast formatter and linter.

Key Principles

  • Strictly speak in English
  • Never produce in code non-English text
  • Zero configuration required
  • Subsecond performance
  • Maximum type safety
  • AI-friendly code generation

Before Writing Code

  1. Analyze existing patterns in the codebase
  2. Consider edge cases and error scenarios
  3. Follow the rules below strictly
  4. Validate accessibility requirements

Rules

Terminal & Package Manager

  • Always use Bun as the package manager.
  • Always use cd <absolute/path/to/directory> to change the current working directory.
  • Never use cd without an absolute path.
  • When working on CLI commands, you can check their performance by running Measure-Command { bun dler tsc --verbose }.

Code Complexity and Quality

  • Don't add _ prefix to disable unused variable, when this variable is really unused (just use e.g. } catch { instead of } catch (_error) {)
  • Don't use consecutive spaces in regular expression literals.
  • Don't use the arguments object.
  • Don't use primitive type aliases or misleading types.
  • Don't use the comma operator.
  • Don't use empty type parameters in type aliases and interfaces.
  • Don't write functions that exceed a given Cognitive Complexity score.
  • Don't nest describe() blocks too deeply in test files.
  • Don't use unnecessary boolean casts.
  • Don't use unnecessary callbacks with flatMap.
  • Use for...of statements instead of Array.forEach.
  • Don't create classes that only have static members (like a static namespace).
  • Don't use this and super in static contexts.
  • Don't use unnecessary catch clauses.
  • Don't use unnecessary constructors.
  • Don't use unnecessary continue statements.
  • Don't export empty modules that don't change anything.
  • Don't use unnecessary escape sequences in regular expression literals.
  • Don't use unnecessary labels.
  • Don't use unnecessary nested block statements.
  • Don't rename imports, exports, and destructured assignments to the same name.
  • Don't use unnecessary string or template literal concatenation.
  • Don't use String.raw in template literals when there are no escape sequences.
  • Don't use useless case statements in switch statements.
  • Don't use ternary operators when simpler alternatives exist.
  • Don't use useless this aliasing.
  • Don't use any or unknown as type constraints.
  • Don't initialize variables to undefined.
  • Don't use the void operators (they're not familiar).
  • Use arrow functions instead of function expressions.
  • Use Date.now() to get milliseconds since the Unix Epoch.
  • Use .flatMap() instead of map().flat() when possible.
  • Use literal property access instead of computed property access.
  • Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.
  • Use concise optional chaining instead of chained logical expressions.
  • Use regular expression literals instead of the RegExp constructor when possible.
  • Don't use number literal object member names that aren't base 10 or use underscore separators.
  • Remove redundant terms from logical expressions.
  • Use while loops instead of for loops when you don't need initializer and update expressions.
  • Don't reassign const variables.
  • Don't use constant expressions in conditions.
  • Don't use Math.min and Math.max to clamp values when the result is constant.
  • Don't return a value from a constructor.
  • Don't use empty character classes in regular expression literals.
  • Don't use empty destructuring patterns.
  • Don't call global object properties as functions.
  • Don't declare functions and vars that are accessible outside their block.
  • Make sure builtins are correctly instantiated.
  • Don't use super() incorrectly inside classes. Also check that super() is called in classes that extend other constructors.
  • Don't use variables and function parameters before they're declared.
  • Don't use 8 and 9 escape sequences in string literals.
  • Don't use literal numbers that lose precision.

Read the full file on GitHub · 272 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. today First seen · 272 lines · 2,735 tokens per session scan A 332c5c6cb374

Subscribe to this mod's changes

ts-coding-rules is a cursor rule published in the GitHub repository reliverse/experiments (118 stars, last pushed 5mo ago), licensed MIT. It adds 2,735 tokens to every session, about $0.0137 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-09-01.