standard-typescript-best-practices

standard-typescript-best-practices is a cursor rule for Cursor from Im-Hal-9K/capacities-mcp. It costs 0 tokens per session (356 once invoked), scanned A, original, from a forked repository, MIT.

A set of TypeScript rules for handling errors, asynchronous work, configuration, resources, retries, concurrency, and tests. TypeScript is JavaScript with features for checking types before code runs.

In plain words
What is it for?
Reviewing TypeScript code involving network calls, cancellation, retries, cleanup, environment configuration, immutable state, async callbacks, and isolated tests.
Why use it?
It helps prevent hanging operations, unsafe retries, leaked resources, invalid configuration, shared-state bugs, and unreliable tests.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Reviewing TypeScript code involving network calls, cancellation, retries, cleanup, environment configuration, immutable state, async callbacks, and isolated tests.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/im-hal-9k/capacities-mcp/standard-typescript-best-practices
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/Im-Hal-9K/capacities-mcp

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 standard-typescript-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/rules/im-hal-9k/capacities-mcp/standard-typescript-best-practices.svg)](https://agentmods.dev/rules/im-hal-9k/capacities-mcp/standard-typescript-best-practices)
Your own site
<a href="https://agentmods.dev/rules/im-hal-9k/capacities-mcp/standard-typescript-best-practices"><img src="https://agentmods.dev/badge/rules/im-hal-9k/capacities-mcp/standard-typescript-best-practices.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 356 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin fork From a forked repository.
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.00000 $0.00356
Opus 5 $0.00000 $0.00178
Sonnet 5 $0.00000 $0.00071
Haiku 4.5 $0.00000 $0.00036

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

Security

Grade A, and why

standard-typescript-best-practices 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 8d 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.

.cursor/rules/packmind/standard-typescript-best-practices.mdc · 19 lines

What it actually says

Standard: TypeScript Best Practices

This standard covers high-impact TypeScript patterns for runtime boundaries, error and async handling, resource lifecycle, configuration access, logging, retries/timeouts, concurrency safety, and test... :

  • Implement retries only for idempotent operations with bounded attempts and backoff; avoid unbounded loops or retrying non-idempotent side effects.
  • Keep tests isolated by controlling time, randomness, and global state; avoid tests that depend on real timeouts, Math.random, or shared module singletons.
  • Manage resources with deterministic cleanup using try/finally or using; avoid leaving timers, event listeners, streams, or file handles open.
  • Model config access with a typed loader that validates required keys and parses types; avoid reading process.env directly across the codebase.
  • Prefer immutable data with readonly and avoid exporting mutable singletons; isolate shared state behind functions or classes with explicit update methods.
  • Set explicit timeouts and cancellation for all network or long-running async operations using AbortSignal; avoid Promises that can hang indefinitely.
  • Type async callbacks as returning Promise and handle rejections at the boundary; avoid floating Promises inside event handlers and timers.
  • Use structured logging with stable keys and include error stack and correlation context; avoid concatenated strings and logging only error.message.
  • Use typed errors or discriminated Result types for expected failures; avoid throwing raw strings or relying on message matching.
  • Validate all untrusted inputs at module boundaries using runtime schemas and return typed values; avoid casting unknown data to domain types.

Full standard is available here for further request: TypeScript Best Practices

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. 8d ago First seen · 19 lines · 356 tokens per session scan A b1b83c43273c

Subscribe to this mod's changes

standard-typescript-best-practices is a cursor rule published in the GitHub repository Im-Hal-9K/capacities-mcp (2 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 356 tokens. A static security scan graded it A with 0 findings. It comes from a forked repository.