Skip to main content
rule

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.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/code-guidelines-cursorrules-prompt-file.mdc
Open on GitHub

What 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.ts and 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.mdc

Frontmatter: description, globs, alwaysApply

Step 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

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set210

cpp-programming-guidelines-cursorrules-prompt-file Strict C++ guidelines for Cursor coding. It sets size caps on functions and classes, enforces RAII, smart pointers, and a modular CMake project layout. ★ 41,024repo stars convex-cursorrules-prompt-file A Cursor rule for Convex code, covering function syntax, HTTP routes, and validators. Use it when building or reviewing a Convex project. ★ 41,024repo stars code-style-consistency-cursorrules-prompt-file A Cursor rule that makes the agent study your codebase conventions first and write new code to match them. Useful in repos with an established style. ★ 41,024repo stars code-pair-interviews Sets up Cursor for live coding interviews by enforcing plan outlines, simple initial solutions, clean naming, and edge-case handling. ★ 41,024repo stars cloudflare-workers-hono-angular-saas-cursorrules-prompt-file A Cursor rule that pins the stack and conventions for SaaS on Cloudflare Workers: Hono API, Angular, Drizzle, Clerk, Stripe. ★ 41,024repo stars cloudflare-email-telegram-cursorrules-prompt-file Guides Cursor through setting up domain email forwarding to Telegram via Cloudflare Email Routing, Workers, and the mail2tg CLI. ★ 41,024repo stars clean-code This rule sets practical standards for readable, maintainable code. Use it when an agent writes, reviews, or refactors files. ★ 41,024repo stars chrome-extension-dev-js-typescript-cursorrules-pro A Cursor rule that points the agent at one set of conventions for building Chrome extensions in JavaScript and TypeScript. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor