# Code review and file compare in Skink

> Review a diff with comments in Skink: uncommitted work, staged changes, a commit, a branch or everything an agent changed. Compare any two files side by side, also as git difftool.

Source: https://skink.cc/tools/code-review/

`:codereview` shows a diff you can comment on, line by line. `skink --diff A B` puts two files side by side.

## Review a diff

| Command | Reviews |
|---|---|
| `:codereview` | Uncommitted changes |
| `:codereview staged` | What is staged |
| `:codereview REV` | One commit |
| `:codereview branch [BASE]` | This branch against `BASE`, else the first of `main`, `master`, `trunk`, `develop` that exists |
| `:codereview since REV` | Everything changed since a commit, such as what an agent did |

`:log` gets you there too: c on a commit reviews it.

## Comments

| Key | Does |
|---|---|
| c | Comment on the diff line |
| e | Edit a comment (empty it to delete) |
| x | Resolve or reopen |
| D | Delete |
| ] / [ | Next / previous comment |
| Enter | Open the file at that line |
| g | Refresh |
| m | Write the review as Markdown and open it |
| a | Send the open comments to the [agent panel](https://skink.cc/tools/ai-agents/) |

Comments follow their line when the code moves. Comments whose line is gone are listed at the end as outdated.

They are kept in `.git/skink-review/`, per repository and per target, so they survive restarts and never land in your work tree.

## Compare two files

```sh
skink --diff old.rs new.rs
```

From a file, `:diff OTHER` does the same.

| Key | Does |
|---|---|
| n / p | Next / previous change |
| &gt; / &lt; | Copy the change under the cursor to the right / left file |
| Enter / o | Edit the right / left file at that line |
| s | Save both |
| r | Read both again |

A copied change is an unsaved edit in that file's tab, so Ctrl+Z there undoes it.

### As git difftool

```sh
git config --global diff.tool skink
git config --global difftool.skink.cmd 'skink --diff "$LOCAL" "$REMOTE"'
git difftool
```

Folder diffs (`git difftool --dir-diff`) are not supported yet.
