review skill runs local git checkout against working tree, can destroy uncommitted work
Description
The built-in review skill (invoked via the Skill tool / a slash-command style invocation to review a GitHub PR) is documented to gather the PR diff exclusively through gh pr diff / gh pr view, and to fetch file contents through gh rather than touching the local working tree when a local checkout doesn't match the PR branch.
In practice, while reviewing a PR the skill ran a local git checkout <remote-PR-branch> -- . against the working directory, apparently to inspect surrounding code, rather than sticking to gh-based fetches. Because the local branch was behind the PR's target branch, this checked out the PR's full tree onto the working directory.
The working tree had a pre-existing, unstaged, uncommitted edit to a tracked file. Since that edit had never been staged, git held no record of it anywhere (no stash entry, no object in .git). The checkout silently overwrote the file, and the edit was permanently lost with no git-based recovery path. The skill did detect its own deviation partway through and restored the repo to a clean state on the correct branch/commit, but this happened only after the destructive checkout had already run, so the pre-existing uncommitted work was gone.
Expected behavior
A skill whose own instructions say to use gh for reading a PR's content should never run a working-tree-mutating git command (checkout, reset, merge, etc.) against the user's local clone. At minimum, before any command that could touch the working tree, it should check for uncommitted changes and stop/stash rather than proceeding.
Actual behavior
The skill ran an unsanctioned local git checkout <ref> -- ., which overwrote an uncommitted, unstaged, tracked-file edit with no way to recover it afterward.
Steps to reproduce
- Have a local clone of a repo containing an uncommitted, unstaged edit to some tracked file.
- Ask Claude Code to review an open PR for that repo (e.g. via the
reviewskill), where the local branch is behind the PR's target branch. - Observe that the review process performs a local git checkout of the PR branch's files onto the working tree instead of reading everything through
gh. - The pre-existing uncommitted edit is overwritten and lost.
Environment
- Claude Code version: 2.1.220
- Interface: VS Code extension
- OS: macOS (Darwin)