codel
← Back to the index

DBG-02 · SEC. 02 Debugging & Evaluation

Rubric Grading Loop for AI Output

Score AI-generated code against a checklist and keep iterating until every item passes.

FORMAT
workflow
DIFFICULTY
advanced
TIME
20 min
TOOLS
claude-code
MODELS
any
COPIES
0 so far

When to use this

You've finished a feature or PR built with AI help and want a consistent, repeatable quality gate before review, not a vague "looks good to me."

The pattern

Pastes as plain text
Grade the current changes against this rubric. Use the diff, not memory of
what you intended to write.

Rubric:
1. [CRITERION 1, e.g. "All new functions have error handling for invalid input"]
2. [CRITERION 2, e.g. "No console.log or debug prints left in"]
3. [CRITERION 3, e.g. "Tests exist and pass for every new code path"]
4. [CRITERION 4, e.g. "No hardcoded values that should be config"]

For each item:
- Mark PASS or FAIL.
- If FAIL, quote the exact file and line that violates it and explain why.
- Do not mark PASS unless you can point to the specific code that satisfies it.

After grading, output a scorecard like:
1. PASS/FAIL
2. PASS/FAIL
3. PASS/FAIL
4. PASS/FAIL

If any item is FAIL, fix only that item, then re-run this entire rubric
from item 1 on the updated diff. Repeat until every item is PASS. Do not
skip re-grading items that already passed, a fix can break something else.

Real example output

Scorecard, round 1:
1. FAIL, no error handling in `src/api/upload.ts:22` for missing file param.
2. PASS
3. FAIL, `parseUpload` has no test coverage.
4. PASS

Fixed item 1 and 3. Scorecard, round 2:
1. PASS, added 400 response for missing file param, upload.ts:22-27.
2. PASS
3. PASS, added `parseUpload.test.ts`, 3 cases, all passing.
4. PASS
All items pass. Ready for review.

Why it works

A named rubric turns "does this look done" into a checklist the AI has to justify line by line, which surfaces the gaps it would otherwise gloss over. Re-grading everything after each fix catches regressions a partial check would miss.

Entry DBG-02 · by codel · 2026-07-08 · CC-BY-4.0