Skip to content

Add Cursor refactoring guardrails rule - #12

Merged
crew102 merged 1 commit into
masterfrom
cursor/refactoring-guardrails-rule-e9ab
May 23, 2026
Merged

Add Cursor refactoring guardrails rule#12
crew102 merged 1 commit into
masterfrom
cursor/refactoring-guardrails-rule-e9ab

Conversation

@crew102

@crew102 crew102 commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a project-level Cursor rule (.cursor/rules/refactoring-guardrails.mdc) with alwaysApply: true so agents treat refactor/cleanup requests as behavior-preserving work unless told otherwise.

What it enforces

  • Definition of done for refactors (behavior preserved, smaller diff, checks pass, summary required)
  • No decorative changes (extra abstractions, renames, formatting-only diffs, etc.)
  • Prioritized refactor tactics (dedupe, control flow, names, extract, move, delete dead code)
  • Required before/during/after workflow
  • Comment/doc guidance (non-obvious intent only)

Note

The pasted rule ended mid-example in the "Comments" section; a minimal Good counterpart was added to close the pattern.

How to use

Merge this PR (or copy .cursor/rules/refactoring-guardrails.mdc locally). Cursor loads rules from .cursor/rules/ automatically for this repo.

Open in Web Open in Cursor 

Introduce a project-level rule that constrains refactors to be
behavior-preserving, minimal, and non-decorative, with an explicit
workflow and definition of done.

Co-authored-by: Chris Baker <crew102@users.noreply.github.com>
@crew102
crew102 marked this pull request as ready for review May 23, 2026 06:33
@crew102
crew102 merged commit 30bb7c0 into master May 23, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants