/code-review skill: silent fallback to main...HEAD reviews other people's commits, and JSON-only output is hard to read

Status Open
Maintainer reply None cached
Activity 3 comments · opened May 28, 2026

Summary

Two issues with the /code-review skill (used via the slash command in Claude Code):

1. Wrong diff scope on long-lived feature branches

The skill instructs the agent to run git diff @{upstream}...HEAD and fall back to main...HEAD only if there's no upstream. The fallback condition is too narrow: if @{upstream} is set but @{upstream}...HEAD is empty (branch is up-to-date with its remote), the agent has nothing to review and silently falls back to main...HEAD anyway. On a long-lived feature branch this pulls in commits authored by other people (merged-but-not-yet-on-main PRs) and reports "findings" in files the user never touched.

Repro:

  • Check out a feature branch that's been alive for a few days, up-to-date with its remote.
  • Have a few uncommitted edits in 2–3 files.
  • Run /code-review medium.
  • Observed: review covers ~24 files including others' merged PRs.
  • Expected: review covers the ~3 working-tree files only.

Suggested fix: When @{upstream} is set, treat @{upstream}...HEAD empty + uncommitted changes as scope = git diff HEAD only. Don't fall back to main.

2. Raw JSON output is not user-readable

The skill's contract returns a JSON array of {file, line, summary, failure_scenario} to the chat. When a human is reading it (no --comment flag), the JSON is dense and slow to parse. The agent has to remember to translate it into prose; today that's not in the skill instructions.

Suggested fix: Add a step at the end: if no downstream consumer (e.g. --comment) is requested, render the findings as a short prose summary grouped by severity, with JSON optional/collapsible.

Environment

  • Claude Code, Opus 4.7 (1M context)
  • macOS

View original on GitHub ↗

3 Comments

phpmac · 2 months ago

JSON output is completely unreadable in practice

Just ran /code-review high and the skill dumped 10 raw JSON objects directly into the chat. No severity grouping. No actionable summary. Just a wall of JSON.

The core problem: the skill spec mandates JSON output with no human-readable rendering step. The Output section says Return findings as a JSON array and nothing else. The model faithfully dumps the array into chat.

Expected behavior: the skill should produce a structured summary like:

  • Critical: 2 findings
  • file:line — one-line summary
  • High: 3 findings
  • ...
  • Cleanup: 5 findings
  • ...

JSON should be optional or collapsed, not the primary output format for human consumption.

This makes the /code-review skill borderline unusable without copy-pasting the JSON into another tool to parse.

rowanseymour · 2 months ago

Same for me. I installed the Anthropic /code-review plugin of the same name (why??) which I can then invoke with /code-review:code-review and it gives me nicer output.. but the built-in skill only ever dumps out JSON (latest CC, MacOS, Opus 4.8 Extra).

o-nix · 2 months ago

"stale"? Meaning not fixed?