Rule
This skill turns a correction into a written rule. It writes the rule once in the right file, then fixes the code that already breaks it.
Twice is a rule
When the user says "make it a rule", "always", "never" or "remember this", write it down. When they correct the same thing twice, propose a rule. A rule is a pair, short enough to read before every edit.
Following the rules while editing belongs to
. Reviewing a codebase against all of them runs in
.
1. Read what exists
Read
,
and the editor rule folders before acting. Acting against a written rule is
.
2. Write the pair
State the rule in one sentence, then the broken line and the line that replaces it. A rule with no example is
.
3. Keep it short
One rule is one to three sentences plus its pair. A paragraph of reasoning is
.
4. Give it one home
Put the rule in the file that owns its topic. Copying it into a second file is
. When a new rule contradicts an old one, replace the old one and say so. Two contradicting rules left side by side is
.
5. Sweep the code
Search for code that breaks the new rule, fix it and list the files. A rule written with old violations left in place is
.
The pair
Every check is a pair. The broken line sits beside the line that replaces it.
| Rule | Broken | Replacement |
|---|
| A pill button added in a repo whose rules forbid pills | Rules read first, rounded button |
| "Use good casing" | "Labels take Title Case. becomes " |
| A paragraph of reasoning | One sentence and a pair |
| One rule in three files | One file, the others point at it |
| "Use borders" beside "never use borders" | The old rule replaced, the change noted |
| The rule added, twelve violations left | The violations fixed and listed |
Reporting
Severity. is an edit that breaks a written rule, or two rules that contradict.
is a rule with no pair, or old violations left after a new rule.
is a rule longer than it needs.
Format. One finding per root cause:
file:line - [rule-id] what is wrong
Then a
summary.
when any
remains,
otherwise. Mark every rule file you could not read as
.