cursorrules

A set of Cursor rules for a TypeScript project. Cursor is an AI coding editor, and the rules define coding, documentation, test-driven development (TDD), commit, and quality-check requirements.

In plain words
What is it for?
Use it when modifying the cdt-smart-snapshot project. It requires writing tests before implementation, documents public functions, enforces TypeScript restrictions, uses Conventional Commits, and runs formatting, type checks, and tests.
Why use it?
It gives the editor clear project standards and prevents common issues such as unsafe types, undocumented public functions, and untested production code.

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/sinnhirl/cdt-smart-snapshot/cursorrules
Clone the repo
git clone --depth 1 https://github.com/sinnhirl/cdt-smart-snapshot

Made for: Cursor.

Per session 401 This file is loaded in full into every session.
When invoked 401 The same file — it is already loaded in full.
Security scan A 0 findings. 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.00401 $0.00401
Opus 5 $0.00200 $0.00200
Sonnet 5 $0.00080 $0.00080
Haiku 4.5 $0.00040 $0.00040

Measured 2d ago against content hash 98d77e14da1b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursorrules 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 2d 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.

.cursorrules · 34 lines

What it actually says

cdt-smart-snapshot project rules (AI must comply)

TypeScript hard rules (violation = rewrite)

  • No any type; no as type assertions; no ! non-null assertions
  • No // @ts-ignore, // @ts-nocheck, // @ts-expect-error comments
  • Prefer for..of over forEach
  • Use import type for type-only imports; prefer interface over type for shapes
  • Use simple Array<T> form (array-simple rule)

Comments (mandatory — user requirement)

  • Every public function/method needs JSDoc: @param, @returns, @throws
  • Core algorithms (visibility/diff/dedupe) need a "why" comment at the top of each function
  • Inline comments explain intent on complex logic; never translate code line by line

TDD (iron law)

  • Write the test first, watch it fail (RED), then minimal implementation (GREEN), then refactor (REFACTOR)
  • No production code without a failing test
  • Test naming: shouldXxxWhenYyy format

Commit conventions

  • Conventional Commits: feat:/fix:/docs:/chore:/refactor:/test:
  • Title line ≤ 72 chars

Quality gates

  • npm run check-format must be zero-error
  • npm run typecheck must be zero-error
  • npm run test must be all green

Project background (read before writing code)

  • Positioning: token-efficient perception layer for chrome-devtools-mcp, 3 tools: smart_snapshot (semantic snapshot) / snapshot_diff (incremental) / screenshot_to_disk (file path)
  • Stack: Node 22 + TypeScript ESM + @modelcontextprotocol/sdk v1 + puppeteer-core + vitest
  • Full spec is in SPEC.md — implement per that spec
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. 2d ago First seen · 34 lines · 401 tokens per session scan A 98d77e14da1b

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository sinnhirl/cdt-smart-snapshot (0 stars, last pushed 28d ago), licensed Apache-2.0. It adds 401 tokens to every session, about $0.0020 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.