cursorrules / rules
Cursor rule88 starsChanged 13 months agoMITView on GitHub
Standards for code generation and implementation
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 repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/accessibility-standards.mdcCursor rule
- .cursor/rules/api-standards.mdcCursor rule
- .cursor/rules/behat-ai-guide.mdcCursor rule
- .cursor/rules/behat-steps.mdcCursor rule
- .cursor/rules/build-optimization.mdcCursor rule
- .cursor/rules/confluence-editing-standards.mdcCursor rule
- .cursor/rules/cursor-rules.mdcCursor rule
- .cursor/rules/debugging-standards.mdcCursor rule
- .cursor/rules/docker-compose-standards.mdcCursor rule
- .cursor/rules/drupal-authentication-failures.mdcCursor rule
- .cursor/rules/drupal-broken-access-control.mdcCursor rule
- .cursor/rules/drupal-cryptographic-failures.mdcCursor rule
- .cursor/rules/drupal-database-standards.mdcCursor rule
- .cursor/rules/drupal-file-permissions.mdcCursor rule
- .cursor/rules/drupal-injection.mdcCursor rule
- .cursor/rules/drupal-insecure-design.mdcCursor rule
- .cursor/rules/drupal-integrity-failures.mdcCursor rule
- .cursor/rules/drupal-logging-failures.mdcCursor rule
- .cursor/rules/drupal-security-misconfiguration.mdcCursor rule
- .cursor/rules/drupal-ssrf.mdcCursor rule
- .cursor/rules/drupal-vulnerable-components.mdcCursor rule
- .cursor/rules/generic_bash_style.mdcCursor rule
- .cursor/rules/git-commit-standards.mdcCursor rule
- .cursor/rules/github-actions-standards.mdcCursor rule
- .cursor/rules/improve-cursorrules-efficiency.mdcCursor rule
- .cursor/rules/javascript-broken-access-control.mdcCursor rule
- .cursor/rules/javascript-cryptographic-failures.mdcCursor rule
- .cursor/rules/javascript-identification-authentication-failures.mdcCursor rule
- .cursor/rules/javascript-injection.mdcCursor rule
- .cursor/rules/javascript-insecure-design.mdcCursor rule
- .cursor/rules/javascript-performance.mdcCursor rule
- .cursor/rules/javascript-security-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/javascript-security-misconfiguration.mdcCursor rule
- .cursor/rules/javascript-server-side-request-forgery.mdcCursor rule
- .cursor/rules/javascript-software-data-integrity-failures.mdcCursor rule
- .cursor/rules/javascript-standards.mdcCursor rule
- .cursor/rules/javascript-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/lagoon-docker-compose-standards.mdcCursor rule
- .cursor/rules/lagoon-yml-standards.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/new-pull-request.mdcCursor rule
- .cursor/rules/node-dependencies.mdcCursor rule
- .cursor/rules/php-drupal-best-practices.mdcCursor rule
- .cursor/rules/php-drupal-development-standards.mdcCursor rule
- .cursor/rules/php-memory-optimisation.mdcCursor rule
- .cursor/rules/project-definition-template.mdcCursor rule
- .cursor/rules/pull-request-changelist-instructions.mdcCursor rule
- .cursor/rules/python-authentication-failures.mdcCursor rule
- .cursor/rules/python-broken-access-control.mdcCursor rule
- .cursor/rules/python-cryptographic-failures.mdcCursor rule
- .cursor/rules/python-injection.mdcCursor rule
- .cursor/rules/python-insecure-design.mdcCursor rule
- .cursor/rules/python-integrity-failures.mdcCursor rule
- .cursor/rules/python-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/python-security-misconfiguration.mdcCursor rule
- .cursor/rules/python-ssrf.mdcCursor rule
- .cursor/rules/python-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/react-patterns.mdcCursor rule
- The first 60 shown.
The file
We split this code-generation-standards.mdc into the rules it gives an agent
8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Use whitespace effectively to enhance code clarity.
- Distinctive: line 35
Consider edge cases and provide meaningful error messages.
- Distinctive: line 41
Ensure compatibility with existing patterns or libraries used in the project.
- Distinctive: line 44
Use linters and formatters to maintain consistent code style.
- Distinctive: line 50
Write docstrings or JSDoc for functions, classes, and modules to describe usage, parameters, and return values.
- Distinctive: line 51
Consider generating external documentation if the project uses tools like Swagger for APIs or Sphinx for Python.
- Distinctive: line 53
Avoid hardcoded credentials or sensitive information.
- Distinctive: line 54
Follow security best practices for the language (e.g., SQL injection prevention in PHP, XSS in JavaScript).
≈ “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: Standards for code generation and implementation
globs: *.php, *.js, *.ts, *.vue, *.jsx, *.tsx, *.py
---
# Enhanced Code Generation Standards
Ensures high-quality, executable code generation adhering to best practices across multiple programming languages.
## Rule Details
- **Name:** enhanced_code_generation_standards
- **Description:** Enforce standards for code generation ensuring high quality and integration readiness
## Filters
- file extension pattern: `"\\.(php|js|ts|vue|jsx|tsx|py|rb|java)$" # Expanded to include Ruby and Java`
## Enforcement Checks
- Conditions:
- pattern `// TODO:|#\\s*TODO:` – Replace TODOs with actual implementation - no placeholders allowed.
- pattern `function\\s+\\w+\\s*\\([^)]*\\)\\s*\\{\\s*(?:return\\s+null|throw\\s+new\\s+Error|console\\.log)\\s*\\}` – Implement full functionality - no stub methods.
- pattern `\\bif\\b\\s*\\(\\s*false\\s*\\)` – Remove or replace conditional statements that are always false.
- pattern `\\bconsole\\.[^(]+|print\\s*\\(` – negated `DEBUG|LOGGING` – Remove debug logging unless it's conditional on a debug flag.
- pattern `^\\s*#\\s*\\w+:\\s*\\w+\\s*$` – In Python, prefer type hints over comments for type annotations.
## Suggestions
- Guidance:
**Code Generation Best Practices:**
- **Executable Solutions:** Generate fully functional code, not just skeletons or stubs.
- **Readability:**
- Prioritize code readability, with clear naming conventions and logical structure.
- Use whitespace effectively to enhance code clarity.
- **Error Handling:**
- Implement comprehensive error handling with appropriate exceptions or error codes.
- Consider edge cases and provide meaningful error messages.
- **Imports/Dependencies:**
- Include all necessary imports or require statements at the beginning of the file.
- Manage dependencies to ensure the code is self-contained or clearly documented for setup.
- **Integration:**
- Code should be immediately usable within the project's existing framework or technology stack.
- Ensure compatibility with existing patterns or libraries used in the project.
- **Formatting:**
- Adhere to the project's coding style guide (e.g., Prettier, Black for Python, etc.).
- Use linters and formatters to maintain consistent code style.
- **Testing:**
- Include unit or integration tests where applicable to validate generated code.
- Encourage test-driven development if part of the project's culture.
- **Documentation:**
- Provide inline comments for complex logic or algorithms.
- Write docstrings or JSDoc for functions, classes, and modules to describe usage, parameters, and return values.
- Consider generating external documentation if the project uses tools like Swagger for APIs or Sphinx for Python.
- **Security:**
- Avoid hardcoded credentials or sensitive information.
- Follow security best practices for the language (e.g., SQL injection prevention in PHP, XSS in JavaScript).
- **Performance:** While readability takes precedence, be mindful of performance implications of the generated code.
## Metadata
- Priority: critical
- Version: 1.2
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.

