| name | visual-oracle-ratchet |
| description | Run the framework-agnostic visual oracle ratchet algorithm for screenshot, golden image, and other image regression tests. Use when deciding whether a visual oracle can ratchet forward, reviewing visual diffs, handling image baseline failures, or designing adapter skills for Vitest, Playwright, or similar tools. Enforces human approval before any baseline overwrite. |
Visual Oracle Ratchet
Purpose: ratchet visual oracle artifacts only. This skill never proves code complete.
Core Rule
Do not run update mode, snapshot update, or baseline overwrite until human explicitly approves that update.
Green in this loop means one thing: focused visual oracle matches current render. It does not mean implementation is done, other tests passed, or code is safe to commit.
Workflow
- Identify focused visual test command and exact oracle files.
- Run focused visual test without update mode.
- If green, end this subroutine and return:
artifact_ratchet: false
update_needed: false
verification_scope: focused visual oracle only
code_complete: unknown
- If red, locate generated artifacts:
- current/blessed oracle
- fresh actual render
- diff image
- Open/review oracle, actual, and diff before editing code or asking approval.
- If failure cause is clearly a general code bug and user already asked to iterate, fix code and loop from step 2.
- If visual result is acceptable or needs taste judgment, write review md next to failure images.
- Stop before update mode and ask human approval.
- After explicit approval, run focused visual test with update mode.
- Re-run focused visual test without update mode.
- Verify failure artifacts and review md are ignored/untracked or removed.
- Return:
artifact_ratchet: true
approved_oracles: [...]
verification_scope: focused visual oracle only
code_complete: unknown
Review MD
Create one review md per failing fixture, beside failure images.
Name:
<fixture>.failure.review.md
Required format:
# what changed
1. ...
# why it is ok
1. ...
# remarks
1. ...
Rules:
- Use exactly these H1 headings:
# what changed, # why it is ok, optional # remarks.
- Use numbered list items only under each heading.
- Use caveman language: terse fragments, no filler, no hedging.
- Mention actual/diff/oracle paths in numbered items when helpful.
- No prose outside headings and numbered items.
- Do not include code fences unless user asks.
Example:
# what changed
1. Right shelf gone.
2. Bottom padding more even.
3. Glow noise only at edge.
# why it is ok
1. Shape still hugs target.
2. Padding rule stronger.
3. No center dot.
# remarks
1. Human call: corner taste.
Anti-Churn
- Do not treat oracle approval as code approval.
- Do not update all screenshots blindly.
- Do not review only final updated images; review diff before update.
- Do not use external diff tools when test framework already emitted actual/diff artifacts.
- Use external image diff only for recovery, e.g. baseline already overwritten.
- If artifact location/naming is unclear, inspect test framework config/source before guessing.
- If generated failure artifacts could be committed, add/verify ignore rules before approval flow completes.
Parent Workflow Contract
This skill returns evidence to caller. Caller decides next verification.
Never claim:
- Feature complete.
- No regressions.
- Broad test safety.
- Ready to merge.
Allowed claim:
- Focused visual oracle passed.
- Human approved oracle update.
- Oracle files ratcheted.
Adapter Skill Contract
Framework-specific skills should layer on this algorithm and define:
- How to run focused test without update mode.
- How to run focused test with update mode.
- Where oracle files live.
- Where actual/diff artifacts emit.
- How to name review md files.
- How to verify failure artifacts cannot be committed.
- What "green" means for that framework.