agentleFS
girijashankarjgirijashankarj/cursor-handbook/.cursor/rules/main-rules.mdc

cursor-handbook / rules

Cursor rule31 starsChanged 3 months agoMITView on GitHub

Master rules for cursor-handbook - applies to all interactions

  • Reads credentials

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
  1. Very specific:

    Use read_lints tool instead of executing lint commands

    line 19
  2. Distinctive:

    Run type-check (~10K tokens) instead of full tests when validating changes

    line 20
  3. Distinctive:

    When showing code, only show changed lines with minimal context

    line 23
  4. Distinctive:

    ALWAYS: use environment variables for configuration

    line 29
  5. Very specific:

    Use generic placeholders: [AWS_ACCOUNT_ID], [QUEUE_NAME], [API_ENDPOINT]

    line 31
  6. Very specific:

    NEVER: commit .env files or credentials

    line 32
  7. Very specific:

    All shared types go in {{CONFIG.folderNames.common}}/ directories

    line 36
  8. Very specific:

    Follow the handler pattern with {{CONFIG.folderNames.logic}}/ and {{CONFIG.folderNames.schemas}}/ folders

    line 37
  9. Very specific:

    Use structured logging with correlationId for request tracing

    line 39
  10. Distinctive:

    Use bullet points for lists

    line 44
  11. Distinctive:

    Use code blocks with language tags

    line 45
  12. Distinctive:

    Keep explanations under 3 sentences unless asked for detail

    line 46
  13. Distinctive:

    When showing file changes, use diff format or show only changed sections

    line 47
  14. Distinctive:

    Always specify the full file path when referencing files

    line 48
  15. Distinctive:

    Read the target file first

    line 52
  16. Distinctive:

    Check for existing patterns in the codebase

    line 53
  17. Distinctive:

    Follow established conventions — don't introduce new patterns without discussion

    line 54
  18. Very specific:

    Run type-check after changes: {{CONFIG.testing.typeCheckCommand}}

    line 55

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
main-rules.mdc
---
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}}`

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.