agentleFS
synaptiaisynaptiai/prompt-decorators/.cursor/rules/050-careful-code-modification.mdc

prompt-decorators / rules

Cursor rule44 starsChanged 20 months agoApache-2.0View on GitHub

ENSURE careful modifications WHEN changing code TO prevent breakage

The file

We split this 050-careful-code-modification.mdc into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    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
  1. Distinctive:

    When modifying existing code in this codebase

    line 11
  2. Distinctive:

    When fixing bugs or implementing new features

    line 12
  3. Distinctive:

    When the codebase is fragile or has complex dependencies

    line 13
  4. Distinctive:

    Consider the scope and potential side effects of all changes

    line 18
  5. Distinctive:

    Ensure changes are appropriate for the sensitivity level of the codebase

    line 19
  6. Distinctive:

    Add thorough tests for any modifications made

    line 20
  7. Distinctive:

    Document changes clearly with comments explaining the rationale

    line 21

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 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
050-careful-code-modification.mdc
---
description: ENSURE careful modifications WHEN changing code TO prevent breakage
globs: **/*.py
---

# Careful Code Modification

<version>1.0.0</version>

## Context
- When modifying existing code in this codebase
- When fixing bugs or implementing new features
- When the codebase is fragile or has complex dependencies

## Requirements
- Make surgical, precise modifications targeting only the specific issue
- Implement proper validation procedures before and after changes
- Consider the scope and potential side effects of all changes
- Ensure changes are appropriate for the sensitivity level of the codebase
- Add thorough tests for any modifications made
- Document changes clearly with comments explaining the rationale

## Examples

<example>
# Good: Targeted fix with validation
def fix_calculation_error(data):
    # Validate input before processing
    if not isinstance(data, dict) or 'value' not in data:
        raise ValueError("Invalid data format")

    # Fix specific calculation issue only
    corrected_value = data['value'] * 1.05  # Apply 5% correction

    # Return with minimal changes to data structure
    result = data.copy()
    result['value'] = corrected_value
    return result
</example>

<example type="invalid">
# Bad: Overly broad changes without validation
def fix_calculation_error(data):
    # Completely restructuring data format unnecessarily
    new_data = {}
    for key, value in data.items():
        if key == 'value':
            new_data[key] = value * 1.05
        else:
            new_data[f"modified_{key}"] = process_data(value)

    return new_data  # Returns completely different structure
</example>

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.