Turning code-review comments into useful Cursor rules
I asked my agent to build pr-rulebook from an idea that came up in conversation. When I wrote about the result, I included the candidate rule that failed review. That failure explains something important: a repeated comment is a lead, not an automatic team policy. Here is how I approach turning code-review feedback into useful context for Cursor. Collect evidence, not just wording Start with…
In the course of discussing a new idea, a suggestion arose to build a pr-rulebook automatically. The author included a candidate rule that faced reviewer objections, revealing an important insight: a frequently mentioned comment serves as a clue, not as an established team policy. The approach to transforming code-review feedback into useful context involves gathering evidence rather than merely reusing the wording.
Starting with human comments on merged pull requests, the author examined what changes occurred after each comment. Similar feedback across different pull requests constitutes stronger evidence than two replies within the same conversation. It's crucial to distinguish a convention from a personal preference, as a suggestion that works for one file may be incorrect elsewhere.
Links to examples and the original discussion should be retained beside each proposed rule. Before implementing a rule, it should be reviewed by a team member to ensure its applicability. Writing a rule that someone can act upon, coupled with an illustrative example, is more valuable than simply restating an illustrative code example.
For instance, the guideline "in new API routes, validate input before accessing the database, using the project's reference implementation" is an example of wording, not a rule derived from a client project. A useful rule should specify what to check, when it applies, and where a correct example can be found. The rule should be stored in a location where the Cursor tool can access it, such as version-controlled .mdc files under .cursor/rules.
Cursor suggests creating focused, actionable rules that are under 500 lines in length, divided by topic. These guidelines provide a ceiling for guidance, not a target to reach. The author emphasizes the importance of referencing canonical examples instead of copying information already present in the code. The pr-rulebook experiment scanned 15 merged PRs and 45 human inline review comments in Ruff, generating two candidate rules.
While one of the rules was deemed suitable after scrutiny, the other was too ambiguous to enforce. Even the stronger candidate had examples from a single PR, which weakens the claim that it was a team-wide convention. The current tool demands evidence across distinct PRs. The experiment is still a small-scale example, not definitive proof that the method enhances productivity for every team.
The author advises testing a limited set of reviewed rules on actual code and assessing whether they prevent recurring mistakes. It's important to remember that rules offer context, but tests and human review remain essential components of the development process.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.