codebase-standards

A set of codebase rules that apply to every conversation and guide how code is changed. They cover module specifications, database queries, error handling, user-interface states, and asynchronous updates.

In plain words
What is it for?
Checking module specifications before edits, using parameterized SQL, applying the project's error types, batching interface updates, and handling loading, error, empty, and data states.
Why use it?
It keeps changes consistent with the project's existing design and prevents recurring mistakes such as unsafe SQL construction or incomplete error handling.

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/golid-ai/golid/codebase-standards
Clone the repo
git clone --depth 1 https://github.com/golid-ai/golid

Made for: Cursor.

Per session 2,001 This file is loaded in full into every session.
When invoked 2,001 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.02001 $0.02001
Opus 5 $0.01001 $0.01001
Sonnet 5 $0.00400 $0.00400
Haiku 4.5 $0.00200 $0.00200

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

Security

Grade A, and why

codebase-standards 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.

.cursor/rules/codebase-standards.mdc · 117 lines

How it starts

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

Codebase Standards

Thesis: Universal guardrails that apply regardless of which file you're editing — the principles that every other rule assumes you follow.

Core Guardrails

One-line reminders of the highest-consequence rules. Domain-specific rules (go-service, solidjs-pages, etc.) have full explanations and examples.

  • Module spec mapping — before modifying a module, read its spec at docs/modules/{module}/spec.md. Folders: auth, users, feature. Multi-file auth: auth_password, auth_verifyauth spec.
  • Parameterized queries only — never fmt.Sprintf with values into SQL. Use $N placeholders for values; write literal SQL per call site for identifiers.
  • apperror for all errors — never echo.NewHTTPError. Use apperror.BadRequest, .Forbidden, .NotFound, .Validation, .Internal.
  • batch() signal updates after every await — put user-visible state like setLoading(false) inside both try and catch, wrapped in batch(). finally is only okay for independent re-entry locks that do not need to batch with success/error UI.
  • Switch/Match for content states — never nested <Show> for loading/error/empty/data states.
  • onMount + signals for data fetching — never createResource. Use alive guard and loadRequestID for param refetches. See solidjs-data-fetching.
  • Never early-return route components before reactive setup — move auth/access guards into JSX with <Show when={...} fallback={...}>.
  • Never discard errors — no _ = fn(). Log with logger.Error at minimum.
  • Resource membership, not just role — verify the specific user belongs to the specific resource, not just userType.
  • Config over hardcoded values — if you'd change it per environment, it belongs in Config or named constants.
  • Request body size limitmiddleware.BodyLimit("1M") is configured in stack.go.
  • SSE uses one-time ticket auth (not JWT in URL) — see handler/sse.go and service/sse/sse.go.
  • Command lookup before shell work — before running nontrivial local, test, deploy, GCP, Git, or contract-validation commands, read common-commands / docs/cli-reference.md, use known-good repo commands, and diagnose the first concrete failure instead of probing equivalent tools.

Read the full file on GitHub · 117 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. 2d ago First seen · 117 lines · 2,001 tokens per session scan A 2092844776a5

Subscribe to this mod's changes

codebase-standards is a cursor rule published in the GitHub repository golid-ai/golid (40 stars, last pushed 2mo ago), licensed MIT. It adds 2,001 tokens to every session, about $0.0100 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-30.