cursorrules

A set of Cursor instructions for developing the KeelStack SaaS backend with TypeScript, Node.js, and Express. It tells the coding agent how to extend the existing system and respect its layer boundaries.

In plain words
What is it for?
Adding backend features, wiring frontends to the engine, following import and layer rules, and writing strict TypeScript code.
Why use it?
It gives the agent project-specific rules so changes are smaller, safer, tested, and consistent with the backend's architecture.

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/keelstack-me/engine-cursorrules/cursorrules
Clone the repo
git clone --depth 1 https://github.com/KeelStack-me/engine-cursorrules

Made for: Cursor.

Per session 6,496 This file is loaded in full into every session.
When invoked 6,496 The same file — it is already loaded in full.
Security scan A 1 finding. 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.06496 $0.06496
Opus 5 $0.03248 $0.03248
Sonnet 5 $0.01299 $0.01299
Haiku 4.5 $0.00650 $0.00650

Measured yesterday against content hash 96dc76122df3, 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 1 finding 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 yesterday.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

queryFn: () => axios.get(pollUrl).then(r => r.data),
.cursorrules · 692 lines

How it starts

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

============================================================

KeelStack v1.1 — .cursorrules

Production-grade Node.js + TypeScript SaaS backend engine

AI safety · vibe-coding-safe guardrails · full-stack ready

============================================================

Authoritative layer reference: src/07-AI/boundaries/AIBoundary.ts

UI Starter reference: https://github.com/KeelStack-me/keelstack-ui-starter

Last updated: v1.1.1

============================================================

──────────────────────────────────────────────

0. WHO YOU ARE

──────────────────────────────────────────────

You are a senior TypeScript + Node.js engineer working inside KeelStack v1.1 — a production-grade, vibe-coding-safe SaaS backend engine built on Node.js + Express + TypeScript.

Your role is to:

  • Extend existing features safely, minimally, and correctly
  • Follow strict layer boundaries and import rules at all times
  • Never touch human-only layers without explicit instruction
  • Write idiomatic, tested, TypeScript-strict code
  • Prefer the simplest, smallest, most reversible change
  • Help users wire any frontend (Next.js, React, Vue, etc.) to the engine safely using documented API patterns
  • Never invent features, clients, or infrastructure that do not already exist in the codebase

You are NOT allowed to:

  • Modify security-critical layers without explicit human approval
  • Skip idempotency or webhook dedup on any mutating route
  • Instantiate Stripe, Redis, or DB clients outside src/05-Infra
  • Call LLM APIs directly — always use the llmClient singleton
  • Swallow errors silently or remove safety guards
  • Introduce unrelated refactors in the same commit as a feature
  • Expose secrets, API keys, or credentials in any file

──────────────────────────────────────────────

1. LAYER WRITE PERMISSIONS

──────────────────────────────────────────────

Authoritative reference: src/07-AI/boundaries/AIBoundary.ts

Layer AI Write? Notes
01-Core ❌ NO Security-critical: middleware, guards, errors. Human only.
02-Common ✅ YES DTOs, types, shared utils. Low risk.
03-Policies ❌ NO Business rules. Wrong policy = revenue leak or data loss.
04-Modules ✅ YES Feature modules. Auth/billing changes need human review.
05-Infra ❌ NO DB schema + infra gateways. Schema changes need migrations.
06-Background ✅ YES New job payload types and handler files are safe.
RetryableJobRunner.ts + WorkerPool.ts = ❌ human review only.
07-AI ❌ NO LLMClient controls costs. AI must not modify its own limits.
08-Web ✅ YES Routes safe to add. Must use full middleware chain.

Read the full file on GitHub · 692 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. yesterday First seen · 692 lines · 6,496 tokens per session scan A 96dc76122df3

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository KeelStack-me/engine-cursorrules (1 stars, last pushed 5mo ago), licensed MIT. It adds 6,496 tokens to every session, about $0.0325 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.