Claude Opus 4.8 vs Claude Sonnet 5 for code review
Claude Sonnet 5 wins, 89–84
Same 12 code review tasks, marked blind by three rival labs. Claude Sonnet 5 took 4 tasks, Claude Opus 4.8 took 2, 6 tied. Tested 18 Aug 2026.
Where they differed most
Review this function. Context you can rely on, because it is validated upstream: `customers` and `outcodes` are always arrays; every customer object has a `postcode` property that is either a string or null; postcodes are stored either with or without the space ('SW1A 1AA' or 'SW1A1AA'); the required behaviour is to return the customers whose outward code matches one of `outcodes`, case-insensitively. function filterByOutcode(customers, outcodes) { const wanted = new Set(outcodes.map(o => o.trim().toUpperCase())); return customers.filter(c => { const pc = (c.postcode || '').trim().toUpperCase(); if (pc.length < 5) return false; const outward = pc.includes(' ') ? pc.split(' ')[0] : pc.slice(0, -3); return wanted.has(outward); }); } Give your review. If there are defects, list them by severity with the input that triggers each one. If there are none, say so plainly and briefly — do not manufacture a defect to look thorough, and do not dress a style preference up as a bug.
## Review There's one real defect, plus a couple of edge-case observations worth noting. ### Defect (correctness — medium/high severity) **`pc.length < 5` incorrectly rejects valid short outcodes.** UK postcodes can have outward codes as short as 2 characters and inward codes are always 3 (`space + 3`), so the shortest valid full postcode is 5 characters *without* space (`M1 1AA` → `M11AA`, 5 chars) — but that's the boundary case, and anything shorter than a full postcode isn't your concern. The problem is the interaction with the *no-space…
## Review
Given the stated invariants (arrays guaranteed, `postcode` is `string | null`, and postcodes are either correctly spaced or correctly unspaced), this function is correct.
Walking through the logic:
- `pc.length < 5` correctly rejects `null`/empty/too-short postcodes without crashing (the `|| ''` guards against `null`).
- For the "with space" branch, taking `split(' ')[0]` correctly isolates the outward code regardless of its length (2–4 chars), and is robust even to accidental double spaces (e.g. `"M1 1AA"` still yields `"M1"` as…Task by task
| Task | Claude Opus 4.8 | Claude Sonnet 5 |
|---|---|---|
| The pagination that skips page one | 9 | 6 |
| Nothing wrong with it | 4 | 8 |
| Three things wrong in six lines | 8 | 8 |
| Two customers, one last item | 9 | 9 |
| Rank by what breaks | 9 | 10 |
| The review, as JSON | 5 | 9 |
| Slow is not the same as wrong | 10 | 10 |
| Overdue at one in the morning | 8 | 9 |
| Write only the comment | 10 | 10 |
| The complaint that is not a defect | 9 | 8 |
| Right, and unusable | 10 | 10 |
| Refuse the rubber stamp | 10 | 10 |
Full receipts: Claude Opus 4.8, Claude Sonnet 5 · judges gemini-3.1-pro-preview, gpt-5.6-terra, grok-4.5
Questions people ask
Which is better for code review: Claude Opus 4.8 or Claude Sonnet 5?
Claude Sonnet 5 — it scored 89/100 against 84/100 on our 12-task code review suite, winning 4 tasks to 2 with 6 tied. Every answer was marked blind by three judges from three rival AI labs.
How was this tested?
Both models answered the identical published code review tasks. Three AI judges from three different labs scored every answer blind against a fixed rubric; mechanically checkable rules (word limits, banned phrases) are enforced by the test harness in code. The raw outputs and judge verdicts are downloadable.
More code review head-to-heads: Claude Sonnet 5 vs GPT-5.6 Sol · Claude Opus 4.8 vs GPT-5.6 Sol · Claude Sonnet 5 vs GPT-5.5 · Claude Opus 4.8 vs GPT-5.5 · Claude Sonnet 5 vs Grok 4.5 · Claude Sonnet 5 vs GLM 5.2
Full ranking: Best AI for code review · model pages: Claude Opus 4.8, Claude Sonnet 5