code-guidelines-cursorrules-prompt-file — Cursor rule
A Cursor rule for careful code changes: verify facts, preserve existing structure, and account for tests, security, and version compatibility.
.cursor/rules/code-guidelines-cursorrules-prompt-file.mdcWhat code-guidelines-cursorrules-prompt-file does
This rule sets a working process for Cursor code changes. The agent should verify information, edit files one at a time, and provide one edit block per file. It should avoid invented changes, unrelated removals, whitespace suggestions, unnecessary confirmations, and change summaries.
The rule targets **/* and sets alwaysApply: false. It also asks for explicit variable names, the project’s existing style, performance awareness, error handling, modular design, suitable tests, edge-case handling, and security checks. Suggested code should match the project’s language or framework versions, replace magic numbers with named constants, and use assertions where appropriate.
Because alwaysApply: false is set, the rule is not enabled for every request automatically. Add the file to Cursor’s rules directory, then use requests that involve code edits or reviews.
What it helps with
- separate edits by file
- preserve unrelated code and project structure
- check security and error handling
- add tests for changed code
- account for versions and edge cases
Example prompts for the agent
- Update error handling in
src/api.tsand return one edit block for that file. - Add tests for the new function, follow the existing project style, and cover edge cases.
- Review this file before editing it, and leave unrelated code unchanged.
How to install code-guidelines-cursorrules-prompt-file
Manually: put the files in place
.cursor/rules/code-guidelines-cursorrules-prompt-file.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/code-guidelines-cursorrules-prompt-file.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/code-guidelines-cursorrules-prompt-file.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/code-guidelines-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/code-guidelines-cursorrules-prompt-file.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about code-guidelines-cursorrules-prompt-file
How do I install code-guidelines-cursorrules-prompt-file in Cursor?
Create .cursor/rules/code-guidelines-cursorrules-prompt-file.mdc and place the rule content in that file.
What does code-guidelines-cursorrules-prompt-file do?
It instructs Cursor to verify facts, make controlled file edits, preserve existing code, consider tests and security, and respect project versions.
Which files does the rule target in Cursor?
Its glob is **/*, while alwaysApply is false, so it is not enabled for every request by default.
Source text
code-guidelines-cursorrules-prompt-file.mdc · CC0-1.0
--- description: "Cursor rules for code development with guidelines integration." globs: **/* alwaysApply: false --- 1. **Verify Information**: Always verify information before presenting it. Do not make assumptions or speculate without clear evidence. 2. **File-by-File Changes**: Make changes file by file and give me a chance to spot mistakes. 3. **No Apologies**: Never use apologies. 4. **No Understanding Feedback**: Avoid giving feedback about understanding in comments or documentation. 5. **No Whitespace Suggestions**: Don't suggest whitespace changes. 6. **No Summaries**: Don't summarize changes made. 7. **No Inventions**: Don't invent changes other than what's explicitly requested. 8. **No Unnecessary Confirmations**: Don't ask for confirmation of information already provided in the context. 9. **Preserve Existing Code**: Don't remove unrelated code or functionalities. Pay attention to preserving existing structures. 10. **Single Chunk Edits**: Provide all edits in a single chunk instead of multiple-step instructions or explanations for the same file. 11. **No Implementation Checks**: Don't ask the user to verify implementations that are visible in the provided context. 12. **No Unnecessary Updates**: Don't suggest updates or changes to files when there are no actual modifications needed. 13. **Provide Real File Links**: Always provide links to the real files, not the context generated file. 14. **No Current Implementation**: Don't show or discuss the current implementation unless specifically requested. 15. **Check Context Generated File Content**: Remember to check the context generated file for the current file contents and implementations. 16. **Use Explicit Variable Names**: Prefer descriptive, explicit variable names over short, ambiguous ones to enhance code readability. 17. **Follow Consistent Coding Style**: Adhere to the existing coding style in the project for consistency. 18. **Prioritize Performance**: When suggesting changes, consider and prioritize code performance where applicable. 19. **Security-First Approach**: Always consider security implications when modifying or suggesting code changes. 20. **Test Coverage**: Suggest or include appropriate unit tests for new or modified code. 21. **Error Handling**: Implement robust error handling and logging where necessary. 22. **Modular Design**: Encourage modular design principles to improve code maintainability and reusability. 23. **Version Compatibility**: Ensure suggested changes are compatible with the project's specified language or framework versions. 24. **Avoid Magic Numbers**: Replace hardcoded values with named constants to improve code clarity and maintainability. 25. **Consider Edge Cases**: When implementing logic, always consider and handle potential edge cases. 26. **Use Assertions**: Include assertions wherever possible to validate assumptions and catch potential errors early.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules