# critique

Adopt this skill: https://proskills.md/skills/other/remorses-critique-skills-critique

Page: https://proskills.md/skills/other/remorses-critique-skills-critique
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/critique/SKILL.md
size: 4020
upstream: https://github.com/remorses/critique/blob/main/skills/critique/SKILL.md

````text
---
name: critique
description: >
  Git diff viewer. Renders diffs as web pages, images, and PDFs
  with syntax highlighting. Use this skill when working with critique for showing
  diffs, generating diff URLs, or selective hunk staging.
---

# critique

Git diff viewer that renders diffs as **web pages**, **images**, and **PDFs** with syntax highlighting.

Agents running in headless environments (kimaki on Discord, openclaw on Slack/Telegram) have no terminal to show diffs. critique uploads diffs to critique.work and returns a shareable URL you can paste into chat. Users click the link and see a syntax-highlighted split-view diff with mobile support and dark/light mode — no install needed.

**Always run `critique --help` first** to see the latest flags and commands. The help output is the source of truth.

## Web — shareable diff URLs

Always pass a title to describe what the diff contains.

```bash
# Working tree changes
critique --web "Add retry logic to database connections"

# Staged changes
critique --staged --web "Refactor auth middleware"

# Branch diff (three-dot: changes since diverging from base)
critique main...HEAD --web "Feature branch changes"
critique main...feature-branch --web "Compare branches"

# Last N commits
critique HEAD~3 --web "Recent changes"

# Specific commit
critique --commit HEAD --web "Latest commit"
critique --commit abc1234 --web "Fix race condition"

# Filter to specific files
critique --web "API changes" --filter "src/api.ts" --filter "src/utils.ts"

# JSON output for programmatic use (returns {url, id, files})
critique --web "Deploy changes" --json
```

Share the returned URL with the user so they can see the diff.

## PDF

```bash
critique --pdf                              # working tree to PDF
critique --staged --pdf                     # staged changes
critique main...HEAD --pdf                   # branch diff
critique --commit HEAD --pdf                # single commit
critique --pdf output.pdf                   # custom filename
critique --pdf --pdf-page-size a4-portrait  # page size options
critique main...HEAD --pdf --open            # open in viewer
```

## Image

```bash
critique --image              # renders to /tmp as WebP
critique main...HEAD --image  # branch diff as images
```

## Selective hunk staging

When multiple agents work on the same repo, each agent should only commit its own changes. `critique hunks` lets you stage individual hunks instead of whole files — like a scriptable `git add -p`.

```bash
# List hunks with stable IDs
critique hunks list
critique hunks list --filter "src/**/*.ts"

# Stage specific hunks by ID
critique hunks add 'src/main.ts:@a1b2c3d4e5f6'
critique hunks add 'src/main.ts:@a1b2c3d4e5f6' 'src/utils.ts:@f6e5d4c3b2a1'
```

Hunk ID format: `file:@<hash>` or `file:@<hash>.1`. The hash is from added and removed lines, so unrelated edits above or below the hunk do not change the ID. Duplicate payloads in the same file get `.1`, `.2`. Old `file:@-oldStart,...` IDs are no longer accepted. `hunks list` still prints the `@@` header under each ID.

**Typical workflow:**

```bash
critique hunks list                          # see all unstaged hunks
critique hunks add 'file:@a1b2c3d4e5f6'     # stage only your hunks
git commit -m "your changes"                 # commit separately
```

## Raw patch access

Every `--web` upload also stores the raw unified diff. Append `.patch` to any critique URL to get it:

```bash
# View the raw patch
curl https://critique.work/v/<id>.patch

# Apply the patch to current repo
curl -s https://critique.work/v/<id>.patch | git apply

# Reverse the patch (undo the changes)
curl -s https://critique.work/v/<id>.patch | git apply --reverse
```

Useful when an agent shares a critique URL and you want to programmatically apply or revert those changes.

## Notes

- Requires **Bun** — use `bunx critique` or global `critique`
- Lock files and diffs >6000 lines are auto-hidden
- `--web` URLs expire after 7 days (content-hashed, same diff = same URL)
````

## File: README.md
upstream: https://github.com/remorses/critique/blob/main/README.md

````text
<div align='center'>
    <br/>
    <br/>
    <h3>critique</h3>
    <p>Beautiful diff viewer for terminals, web previews, and agents.</p>
    <br/>
    <br/>
</div>

![Diff Viewer Demo](screenshot.png)

## Installation

critique requires [Bun](https://bun.sh). It does not run under Node.js.

```bash
# Run directly without installing
bunx critique

# Or install globally
bun install -g critique
```

## Quick Start

Open the current working tree diff in the terminal:

```bash
critique
```

Upload the same diff and get a shareable URL:

```bash
critique --web "Current working tree"
```

Share a GitHub pull request directly, from any directory:

```bash
critique https://github.com/remorses/sigillo/pull/19 --web "Sigillo PR #19"
```

Review staged changes:

```bash
critique --staged
critique --staged --web "Staged changes"
```

## Core Diff Commands

critique follows the same mental model as `git diff`.

A GitHub PR URL fetches the pull request diff from the GitHub API. Public PRs work without login. For private PRs, use `gh auth login`, `GH_TOKEN`, or `GITHUB_TOKEN`. The URL also works with `--pdf`, `--image`, `--filter`, or in the terminal viewer.

```bash
# View unstaged changes, including untracked files
critique

# View staged changes
critique --staged

# View changes since a ref
critique HEAD~1
critique main

# View one commit only
critique --commit HEAD~1
critique --commit abc1234

# Compare two refs, PR style
critique main HEAD
critique main feature-branch

# Watch the working tree and refresh on changes
critique --watch

# Add experimental call-stack changes to the file tree
critique --calldiff

# Filter files by glob pattern
critique --filter "src/**/*.ts"
critique --filter "src/**/*.ts" --filter "lib/**/*.js"
```

## Which Commits a Diff Contains

Whenever a diff spans commits, critique lists them before the diff or the URL.

```
3 commits, 22 files, +1573 -311

  2a09302  Correct the identity docs, and mark the release minor
  1fb8af7  Give every element a stable GPUI identity
  7998490  Launch a window without stealing focus
  base: f948f50  Reclaim the style table when the tree shrinks

  + uncommitted working tree changes
```

This matters because a **rebased branch can carry commits replayed from another
branch**. The merge base is then too far back, and a shared link silently includes
work you did not write. If a listed commit is not yours, pass the first commit of
**your own work** as the base:

```bash
# Wrong: the merge base pulls in a commit a rebase replayed onto the branch
critique f948f50 --web "Element identity"

# Right: start from your own first commit
critique 7998490 --web "Element identity"
```

Long ranges are truncated, but the **oldest commits are always kept**, because a rebase
replays a foreign commit right above the base. Silence the list in scripts with
`--no-commit-list`. With `--json` it goes to stderr and the commits are added to the
JSON payload instead.

### Diverged Branches

`critique A..B` and `critique <ref>` compare two trees directly. On **diverged**
branches such a diff also **undoes** every commit that exists only on the base side.
Those commits are part of the diff, so critique lists them too:

```
1 commit added, 1 commit reversed, 2 files, +1 -1

  added by right:
    a279fbe  Only on right

  reversed from left:
    d395611  Only on left

  ! left and right have diverged, so this diff also undoes the commits above.
```

`critique A...B` and `critique A B` start at the **merge base** instead, so they never
reverse anything, and the `base:` line names the merge base rather than the ref.

Plain unstaged and `--staged` diffs contain no commits, so nothing is printed.

## Call-stack Diffs

`--calldiff` uses [calldiff](https://github.com/tanishqkancharla/calldiff) to show how function calls changed. Each changed call tree appears below its source file in the top file tree.

```bash
# Working tree call changes
critique --calldiff

# Changes since a ref
critique main --calldiff

# PR-style comparison and web preview
critique main HEAD --calldiff --web "Call flow changes"

# One commit
critique --commit HEAD --calldiff
```

The feature is experimental. calldiff uses Tree-sitter and can install a language grammar through npm on first use. `--staged`, `--stdin`, and `--watch` are not supported with `--calldiff`.

Set `CRITIQUE_CALLDIFF=1` to enable call-stack diffs by default:

```bash
export CRITIQUE_CALLDIFF=1
critique
```

## Navigation

| Key | Action |
| --- | --- |
| `↑` / `↓` | Scroll up and down |
| `p` | Open file selector dropdown |
| `t` | Open theme picker |
| `Option` held | Fast scroll at 10x speed |
| `g` `g` / `G` | Jump to top / bottom |
| `Ctrl+D` / `Ctrl+U` | Half page down / up |
| `q` / `Esc` | Quit / close overlay |

## Web Previews

`--web` renders the diff with the same terminal renderer, uploads it to [critique.work](https://critique.work), and prints a shareable URL.

```bash
# Working tree changes
critique --web "Fix auth retry"

# Staged changes
critique --staged --web "Release notes"

# Changes since a ref
critique main --web "Branch changes"

# One commit
critique --commit HEAD --web "Latest commit"

# PR-style branch diff
critique main HEAD --web "Current branch"

# Pull request from GitHub (no checkout needed)
critique https://github.com/remorses/sigillo/pull/19 --web "Sigillo PR #19"

# JSON output for scripts
critique --web "Deploy changes" --json
```

Generated URLs look like `critique.work/v/<id>`.

![Web Preview](screenshot-web.png)

### Web Preview Options

| Flag | Description | Default |
| --- | --- | --- |
| `--web [title]` | Generate and upload a web preview | `Critique Diff` |
| `--staged` | Show staged changes | none |
| `--commit <ref>` | Show changes from a specific commit | none |
| `--calldiff` | Add experimental call-stack changes to the file tree | off |
| `--cols <n>` | Desktop render width | `240` |
| `--mobile-cols <n>` | Mobile render width | `100` |
| `--filter <pattern>` | Filter files by glob, can be repeated | none |
| `--theme <name>` | Use a fixed theme instead of auto light and dark mode | none |
| `--no-commit-list` | Do not list the commits contained in the range | off |
| `--open` | Open the URL in your browser | none |
| `--json` | Print `{ url, id, curl, files, commits }` for scripts | none |
| `--password <pw>` | Encrypt the link end to end with a password (or set `CRITIQUE_PASSWORD`) | none |

### Password Protected Links

Add a **password** to encrypt the link end to end. The CLI encrypts the HTML and the patch on your machine before upload. critique.work only stores ciphertext and never receives the password, so **nobody but the people you give the password to can read the diff**. That includes me, the person who runs critique.work, and Cloudflare, which hosts it. Viewers type the password once and their browser decrypts.

```text
your machine                     critique.work                        viewer's browser
────────────                     ─────────────                        ────────────────
diff ─► gzip ─► AES-256-GCM ───► stores ciphertext only ───────────► password ─► decrypt
        key = PBKDF2(password)   no password, no key, no hash
```

```bash
critique --web --password 'a long passphrase only you share'

# or for every upload
export CRITIQUE_PASSWORD='a long passphrase only you share'
critique --web
```

The browser remembers every password that worked, so one password unlocks all diffs you share with it. Protected links have no social preview image.

Agents read the patch with **curl**. The CLI prints the command after upload. It sends a key that opens only this diff, never the password:

```bash
curl -b 'critique_key=<key>' 'https://critique.work/v/<id>.patch'
```

> [!WARNING]
> Anyone who gets the encrypted upload can try to guess the password offline. Use 12 characters or more. A lost password cannot be recovered.

### How Web Uploads Work

```text
┌─────────────────────────────────────┐
│ git diff / GitHub PR diff      
````
