markdown-site / rules
Cursor rule628 starsChanged 7 months agoMITView on GitHub
Convex doctor code quality standards maintained at 100/100 score
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,183 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- public/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/convex2.mdcCursor rule
- .cursor/rules/convex-write-conflicts.mdcCursor rule
- .cursor/rules/dev2.mdcCursor rule
- .cursor/rules/gitruels.mdcCursor rule
- .cursor/rules/help.mdcCursor rule
- .cursor/rules/rulesforconvex.mdcCursor rule
- .cursor/rules/sec-check.mdcCursor rule
- .cursor/rules/task.mdcCursor rule
- .cursor/rules/workflow.mdcCursor rule
- .cursor/rules/write.mdcCursor rule
- public/llms.txtllms.txt
- convex-create-componentSkill
- convex-migration-helperSkill
- convex-performance-auditSkill
- convex-quickstartSkill
- convex-setup-authSkill
- convexSkill
- impeccableSkill
- convex-quickstartSkill
- convex-setup-authSkill
- devSkill
- function-creatorSkill
- gitrulesSkill
- helpSkill
- migration-helperSkill
- react-effect-decisionSkill
- real-time-backendSkill
- schema-builderSkill
- sec-checkSkill
- workflowSkill
- writeSkill
- convex-doctorSkill
- convex-return-validatorsSkill
- convex-self-hostingSkill
- create-prdSkill
- robel-authSkill
- update-project-docsSkill
The file
Show its rules and text
We split this convex-doctor.mdc into the rules it gives an agent
15 rules. About 0 are common, 9 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Never use api.* for server-to-server calls.
- Distinctive: line 14
All HTTP actions and public endpoints must check authentication unless they are intentionally public (RSS, sitemap, CORS preflight).
- Distinctive: line 15
Never expose Node actions directly to the browser.
- Very specific: line 20
Never use Date.now() inside a query function.
- Very specific: line 21
Use .unique() for lookups on indexes that enforce uniqueness by design.
- Very specific: line 22
Never use .collect().filter().
- Distinctive: line 28
Use indexes for all query patterns.
- Distinctive: line 29
Avoid N+1 query patterns. Batch document fetches into internal queries that accept arrays of IDs.
- Distinctive: line 34
Add indexes for foreign key fields that have query patterns against them.
- Distinctive: line 35
Do not add indexes for foreign keys inside nested arrays (Convex cannot index into arrays).
- Distinctive: line 36
Remove redundant indexes that are prefixes of existing compound indexes.
- Distinctive: line 40
Keep handlers focused. Extract helper functions for email templates, data transformation, and multi-step logic.
- Very specific: line 43
Use ConvexError instead of throw new Error(...) in user-facing handlers when the error message should reach the client.
- Very specific: line 49
Create a job table in convex/schema.ts with status, result, error fields
- Distinctive: line 66
Run after any changes to Convex functions, schema, or HTTP routes.
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: Convex doctor code quality standards maintained at 100/100 score globs: alwaysApply: true --- # Convex doctor code quality This codebase maintains a 100/100 convex-doctor score. All new Convex code must follow these patterns to avoid regressions. ## Security - Never use `api.*` for server-to-server calls. Always use `internal.*` references. - All HTTP actions and public endpoints must check authentication unless they are intentionally public (RSS, sitemap, CORS preflight). - Never expose Node actions directly to the browser. Use mutation-scheduled internal actions with a job table for status tracking. - Public functions use `query`, `mutation`, `action`. Internal functions use `internalQuery`, `internalMutation`, `internalAction`. ## Correctness - Never use `Date.now()` inside a query function. It breaks caching and reactivity. Accept a `now` argument or compute timestamps in mutations/actions. - Use `.unique()` for lookups on indexes that enforce uniqueness by design. Use `.first()` only for intentional ordered picks where multiple rows are expected. - Never use `.collect().filter()`. Use `.withIndex()` and iterate directly, or use `.take(n)` for bounded results. ## Performance - Bound all public `.collect()` calls with `.take(n)` or pagination. - Batch sequential `ctx.runQuery` and `ctx.runMutation` calls in actions. Create a single internal query that returns all needed data instead of making multiple separate calls. - Use indexes for all query patterns. Never scan full tables. - Avoid N+1 query patterns. Batch document fetches into internal queries that accept arrays of IDs. ## Schema - Name indexes with `by_` prefix and snake_case: `by_slug`, `by_published`, `by_session_and_context`. - Add indexes for foreign key fields that have query patterns against them. - Do not add indexes for foreign keys inside nested arrays (Convex cannot index into arrays). - Remove redundant indexes that are prefixes of existing compound indexes. ## Architecture - Keep handlers focused. Extract helper functions for email templates, data transformation, and multi-step logic. - Per-handler auth checks are intentional in this codebase. Do not extract auth into middleware or shared wrappers. - Organize files by domain (posts, pages, newsletter, stats). Do not split purely for file size. - Use `ConvexError` instead of `throw new Error(...)` in user-facing handlers when the error message should reach the client. ## Queued job pattern For any background work triggered from the browser: 1. Create a job table in `convex/schema.ts` with `status`, `result`, `error` fields 2. Public mutation inserts a pending job and calls `ctx.scheduler.runAfter(0, internal...)` 3. Public query returns job status for the UI 4. Internal action processes the job and updates status on success or failure Examples: `aiImageJobs.ts`, `importJobs.ts`, `semanticSearchJobs.ts` ## Suppression config Intentional suppressions live in `convex-doctor.toml` at the repo root. Each suppression includes rationale. Do not add new suppressions without documenting why. ## Running convex-doctor ```bash npx convex-doctor@latest ``` Run after any changes to Convex functions, schema, or HTTP routes. The score must stay at 100/100 with 0 errors and 0 warnings.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

