Skip to content
Flows
Rule-File Code Review Gates
Harness Engineering60-90 minutes
0/4 steps0%

Step 1 of 4

Write the initial rule set

Codify the review comments you keep repeating.

Prompt capsule

Author the first rules. Mine sources: recurring review comments on agent output, incident history, and the project's conventions doc. Rule types to implement: PATTERN rules (regex over diff text: no hardcoded credentials/URLs, no TODO-without-issue, no console.log in production paths), AST rules (structural: no bare except, no mutable default args, exported functions need types - use the language's parser), and DIFF-SHAPE rules (churn thresholds per file type, test files must change when src changes beyond a threshold, lockfile changes require dependency-change declarations). Each rule: id, severity (block/warn/info), rationale, matcher, fix guidance, and 2+ test cases (one firing, one passing). Start with 8-12 rules that would have caught real past issues.

Paste into Claude · Complete implementation prompt with explicit requirements

Expected after this step

8-12 tested rules across pattern, AST, and diff-shape types.

Should not happen

  • Prose guidelines nobody enforces mechanically
  • Regex-only rules missing structural violations an AST check catches
  • Verdicts without locations or guidance, teaching the model nothing
  • Rules accumulating without tests, rotting into false-positive noise

Verify before continuing

Do not move on until every check is true. The complete button stays locked until then.

Do not continue if…

  • !Prose guidelines nobody enforces mechanically
  • !Regex-only rules missing structural violations an AST check catches
  • !Verdicts without locations or guidance, teaching the model nothing
  • !Rules accumulating without tests, rotting into false-positive noise

If the AI messes this up

Use this when the AI fakes progress or breaks the feature. It forces a real fix.

The rules are generic lint. Replace half with rules mined from MY incidents and review history - the gate's value is encoding this project's hard-won specifics, not restating eslint.

Your notes for this step