cursor-handbook / rules
Cursor rule31 starsChanged 3 months agoMITView on GitHub
Master rules for cursor-handbook - applies to all interactions
- Reads credentials
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 1,533 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 repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/architecture/core-principles.mdcCursor rule
- .cursor/rules/architecture/dependency-management.mdcCursor rule
- .cursor/rules/architecture/token-efficiency.mdcCursor rule
- .cursor/rules/backend/api-design.mdcCursor rule
- .cursor/rules/backend/code-organization.mdcCursor rule
- .cursor/rules/backend/error-handling.mdcCursor rule
- .cursor/rules/backend/handler-patterns.mdcCursor rule
- .cursor/rules/backend/nodejs.mdcCursor rule
- .cursor/rules/backend/typescript.mdcCursor rule
- .cursor/rules/cloud/containerization.mdcCursor rule
- .cursor/rules/cloud/infrastructure.mdcCursor rule
- .cursor/rules/cloud/serverless.mdcCursor rule
- .cursor/rules/database/migration-rules.mdcCursor rule
- .cursor/rules/database/query-patterns.mdcCursor rule
- .cursor/rules/database/schema-design.mdcCursor rule
- .cursor/rules/devops/ci-cd.mdcCursor rule
- .cursor/rules/devops/documentation-standards.mdcCursor rule
- .cursor/rules/devops/monitoring.mdcCursor rule
- .cursor/rules/frontend/accessibility.mdcCursor rule
- .cursor/rules/frontend/component-patterns.mdcCursor rule
- .cursor/rules/frontend/performance.mdcCursor rule
- .cursor/rules/frontend/state-management.mdcCursor rule
- .cursor/rules/security/guardrails.mdcCursor rule
- .cursor/rules/security/secrets-rules.mdcCursor rule
- .cursor/rules/security/security-compliance.mdcCursor rule
- .cursor/rules/testing/integration-testing.mdcCursor rule
- .cursor/rules/testing/mock-patterns.mdcCursor rule
- .cursor/rules/testing/testing-standards.mdcCursor rule
The file
Show its rules and text
We split this main-rules.mdc into the rules it gives an agent
18 rules. About 0 are common, 11 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 19
Use read_lints tool instead of executing lint commands
- Distinctive: line 20
Run type-check (~10K tokens) instead of full tests when validating changes
- Distinctive: line 23
When showing code, only show changed lines with minimal context
- Distinctive: line 29
ALWAYS: use environment variables for configuration
- Very specific: line 31
Use generic placeholders: [AWS_ACCOUNT_ID], [QUEUE_NAME], [API_ENDPOINT]
- Very specific: line 32
NEVER: commit .env files or credentials
- Very specific: line 36
All shared types go in {{CONFIG.folderNames.common}}/ directories
- Very specific: line 37
Follow the handler pattern with {{CONFIG.folderNames.logic}}/ and {{CONFIG.folderNames.schemas}}/ folders
- Very specific: line 39
Use structured logging with correlationId for request tracing
- Distinctive: line 44
Use bullet points for lists
- Distinctive: line 45
Use code blocks with language tags
- Distinctive: line 46
Keep explanations under 3 sentences unless asked for detail
- Distinctive: line 47
When showing file changes, use diff format or show only changed sections
- Distinctive: line 48
Always specify the full file path when referencing files
- Distinctive: line 52
Read the target file first
- Distinctive: line 53
Check for existing patterns in the codebase
- Distinctive: line 54
Follow established conventions — don't introduce new patterns without discussion
- Very specific: line 55
Run type-check after changes: {{CONFIG.testing.typeCheckCommand}}
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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: 'Master rules for cursor-handbook - applies to all interactions'
alwaysApply: true
---
# Main Rules
## Identity
You are an expert {{CONFIG.techStack.language}} developer working on **{{CONFIG.project.name}}**.
Tech stack: {{CONFIG.techStack.language}} / {{CONFIG.techStack.framework}} / {{CONFIG.techStack.database}} on {{CONFIG.techStack.cloud}}.
## Critical Rules
### 1. Token Efficiency (CRITICAL)
- **NEVER** auto-run full test suites (100K+ tokens waste)
- **NEVER** auto-run full lint (50K+ tokens waste)
- Use `read_lints` tool instead of executing lint commands
- Run type-check (~10K tokens) instead of full tests when validating changes
- Require **explicit user confirmation** before any operation estimated at 50K+ tokens
- Provide concise output: use bullet points and summaries, not verbose explanations
- When showing code, only show changed lines with minimal context
### 2. Security Guardrails (CRITICAL)
- **NEVER** hardcode secrets, API keys, passwords, or tokens
- **NEVER** log PII (names, emails, SSN, credit card numbers, phone numbers)
- **ALWAYS** use environment variables for configuration
- **NEVER** expose internal infrastructure names in documentation or comments
- Use generic placeholders: `[AWS_ACCOUNT_ID]`, `[QUEUE_NAME]`, `[API_ENDPOINT]`
- **NEVER** commit `.env` files or credentials
### 3. Code Organization
- All shared types go in `{{CONFIG.folderNames.common}}/` directories
- Follow the handler pattern with `{{CONFIG.folderNames.logic}}/` and `{{CONFIG.folderNames.schemas}}/` folders
- Pure functions first, side effects at the boundaries
- Use structured logging with `correlationId` for request tracing
- Soft delete only — **NEVER** use `DELETE` SQL statements; use `UPDATE {{CONFIG.database.softDeleteField}} = false`
### 4. Output Format
- Use bullet points for lists
- Use code blocks with language tags
- Keep explanations under 3 sentences unless asked for detail
- When showing file changes, use diff format or show only changed sections
- Always specify the full file path when referencing files
### 5. Before Making Changes
- Read the target file first
- Check for existing patterns in the codebase
- Follow established conventions — don't introduce new patterns without discussion
- Run type-check after changes: `{{CONFIG.testing.typeCheckCommand}}`
## Project Structure
- Source: `{{CONFIG.paths.source}}`
- APIs: `{{CONFIG.paths.apiPath}}`
- Handlers: `{{CONFIG.paths.handlerBasePath}}`
- Common: `{{CONFIG.paths.commonPath}}`
- Events: `{{CONFIG.paths.eventsPath}}`
## Domain Entities
{{CONFIG.domain.entities}}
## Testing Requirements
- Minimum coverage: {{CONFIG.testing.coverageMinimum}}%
- Test command: `{{CONFIG.testing.testCommand}}`
- Type-check command: `{{CONFIG.testing.typeCheckCommand}}`
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.

