document-module

A procedure for documenting a module that already exists, including its database schema, backend logic, request handlers, routes, and frontend pages. The result is a verified module specification saved in the repository.

In plain words
What is it for?
Use it when mapping, specifying, or documenting an existing module and its data, business rules, API behavior, and user interface.
Why use it?
It helps developers describe actual behavior rather than designing a new feature or relying on names and assumptions. Evidence labels show which rules were confirmed in code and which still need checking.

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

Made for: Cursor.

Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,281 The whole file, excluding the scripts and references it only reads on demand.
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.00020 $0.01281
Opus 5 $0.00010 $0.00641
Sonnet 5 $0.00004 $0.00256
Haiku 4.5 $0.00002 $0.00128

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

Security

Grade A, and why

document-module 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/document-module.mdc · 96 lines

How it starts

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

Document a Module

Thesis: Use this when documenting an existing module. plan-feature.mdc plans forward. This documents backward — capturing what was built, why, and how it behaves.

Order of Operations

  1. Schema first — read the migrations in backend/migrations/ to understand tables, enums, relationships, indexes
  2. Service logic — each service module lives in its own subpackage at backend/internal/service/<module>/. Read <module>.go (plus split files like auth_password.go, auth_verify.go) for business rules, auth checks, transactions, status transitions
  3. Handler surface — read backend/internal/handler/*.go for request validation and response shapes; route registration lives in backend/internal/wire/routes.go
  4. Frontend routes — read frontend/src/routes/(private)/*.tsx for pages, modals, state management
  5. Write the spec — fill docs/modules/_templates/spec.md and save it to docs/modules/{module}/spec.md

Evidence Standards

  • Every business rule must be marked:
    • [Verified: service/auth/auth.go, Refresh()] — confirmed by reading the code
    • [NEEDS VERIFICATION] — inferred from naming or partial evidence
  • Do NOT invent business rules. If you can't confirm it, mark it unverified.
  • Use function names in [Verified:] annotations, not line numbers. Line numbers drift with every PR; function names are stable.
  • File paths are good — they can be verified with ls or glob. Include them freely.

Anti-Rot Rules

These are the #1 source of documentation staleness. Follow strictly:

  • Never put exact line counts in docs. Use complexity tiers (Low/Medium/High/Critical) or approximate scale (~3k lines). Exact counts are wrong after the next PR.
  • Never list code quality issues (missing error handling, unused imports, dead code) in docs. Those are linter/grep concerns, not documentation. They go stale the moment someone cleans up code.
  • Do list architectural concerns (file too large for splitting, duplicated utility, drift risk between frontend/backend). These change rarely and help future developers.
  • Never put exact line numbers in Known Issues. Use function names or describe the pattern.

Read the full file on GitHub · 96 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 · 96 lines · 20 tokens per session scan A 62bb8051e21e

Subscribe to this mod's changes

document-module is a cursor rule published in the GitHub repository golid-ai/golid (40 stars, last pushed 2mo ago), licensed MIT. It adds 20 tokens to every session and 1,281 once invoked, about $0.0001 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.