typescript-conventions

typescript-conventions is a cursor rule for Cursor from Kevin-Liu-01/Sigil-UI. It costs 556 tokens per session, scanned A, original, MIT.

Rules for writing and reviewing TypeScript code, including preferred syntax, type choices, imports, functional error handling, and labeled console messages. TypeScript is JavaScript with checks that help catch mistakes before running the code.

In plain words
What is it for?
Use them when creating or reviewing TypeScript functions, types, imports, error results, validation, and console.warn or console.error calls.
Why use it?
They make code more consistent and help prevent unclear types, unsafe values, hidden naming issues, and poorly handled expected errors.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them when creating or reviewing TypeScript functions, types, imports, error results…

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/kevin-liu-01/sigil-ui/typescript-conventions
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/Kevin-Liu-01/Sigil-UI

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-conventions

README.md
[![agentmods](https://agentmods.dev/badge/rules/kevin-liu-01/sigil-ui/typescript-conventions.svg)](https://agentmods.dev/rules/kevin-liu-01/sigil-ui/typescript-conventions)
Your own site
<a href="https://agentmods.dev/rules/kevin-liu-01/sigil-ui/typescript-conventions"><img src="https://agentmods.dev/badge/rules/kevin-liu-01/sigil-ui/typescript-conventions.svg" alt="Measured on agentmods" height="20"></a>
Per session 556 This file is loaded in full into every session.
When invoked 556 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.00556 $0.00556
Opus 5 $0.00278 $0.00278
Sonnet 5 $0.00111 $0.00111
Haiku 4.5 $0.00056 $0.00056

Measured 7d ago against content hash 3475057d00d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

typescript-conventions 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 7d 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/typescript-conventions.mdc · 56 lines

How it starts

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

TypeScript Conventions

Imported from Kevin's wiki (wiki/style/typescript.md). Cross-reference: sigil-design-system.mdc (TypeScript Rules section).

General Principles

  • Prefer functional style. Classes only when the domain demands it (SDK clients).
  • const over let; never var.
  • === over ==.
  • Template literals over string concatenation.
  • Named exports over default exports.
  • If a function name contains "and", split it.

Types

  • type over interface unless declaration merging is needed. Interfaces can accidentally merge across files; type aliases are closed.
  • unknown over any. If any is unavoidable, add // eslint-disable-next-line with justification.
  • satisfies to validate object shapes without widening.
  • import type for type-only imports (enforced by typescript/consistent-type-imports).
  • Derive types from values with as const, not the other way around.
  • Discriminated unions with exhaustive switch for domain variants.
  • Branded types (string & { readonly __brand: "X" }) for nominal safety.

Error Handling

  • Result<T, E> from @/lib/utils/functional for domain logic with expected failures.
  • Zod for validating external input at API boundaries.
  • catch (error: unknown), narrow with error instanceof Error.
  • Early returns over deeply nested conditionals.
  • No ternaries for control flow. Ternaries are for value selection only.

Console Warnings

Label console.warn and console.error calls with their origin:

console.warn("[FileName::functionName::L42] description");

Linting

Use Ultracite (bun x ultracite@latest init) for oxlint configuration. Zero-config presets with framework-specific rules. Custom ESLint rules layer on top for repo-specific architectural policy only (see react-conventions.mdc).

Type Checking

Use tsgo (TS 7, native Go implementation) for type checking. Do not use tsc. ~10x faster, identical type errors. Combined with oxlint, full-repo validation runs in ~250-500ms.

Read the full file on GitHub · 56 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. 7d ago First seen · 56 lines · 556 tokens per session scan A 3475057d00d8

Subscribe to this mod's changes

typescript-conventions is a cursor rule published in the GitHub repository Kevin-Liu-01/Sigil-UI (9 stars, last pushed 1mo ago), licensed MIT. It adds 556 tokens to every session, about $0.0028 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-31.