|
| 1 | +--- |
| 2 | +name: hunk-review |
| 3 | +description: Use when the task involves Hunk or Hunk MCP review sessions. Helps Pi briefly explain what Hunk is, prefer live Hunk MCP inspection over shell parsing, inspect current review focus, navigate hunks, and leave inline review comments. |
| 4 | +compatibility: Requires Hunk from this repo or the published hunkdiff package. Works best with a real TTY for interactive review. |
| 5 | +--- |
| 6 | + |
| 7 | +# Hunk Review |
| 8 | + |
| 9 | +Use this skill when working with Hunk itself or when the user wants a code-review workflow centered on Hunk. |
| 10 | + |
| 11 | +When this skill activates, start by briefly explaining what Hunk is in plain language before jumping into MCP details. |
| 12 | + |
| 13 | +## What Hunk is |
| 14 | + |
| 15 | +Hunk is a review-first terminal diff viewer for agent-authored changesets. |
| 16 | + |
| 17 | +Keep these product rules in mind: |
| 18 | +- the main pane is one top-to-bottom multi-file review stream |
| 19 | +- the sidebar is for navigation, not single-file mode switching |
| 20 | +- layouts are `auto`, `split`, and `stack` |
| 21 | +- `[` and `]` navigate hunks across the full review stream |
| 22 | +- agent notes belong beside the code they explain |
| 23 | + |
| 24 | +## Default rule: prefer live MCP review |
| 25 | + |
| 26 | +If a live Hunk session already exists, prefer Hunk's MCP tools over launching new shell commands or scraping terminal output. |
| 27 | + |
| 28 | +The MCP daemon is local-only and brokers commands to one or more live Hunk sessions. |
| 29 | + |
| 30 | +Important behavior: |
| 31 | +- normal Hunk sessions auto-start and register with the daemon when MCP is enabled |
| 32 | +- `hunk mcp serve` exists for manual startup or debugging |
| 33 | +- `HUNK_MCP_DISABLE=1` disables MCP registration for a session |
| 34 | +- one daemon can serve many Hunk sessions |
| 35 | + |
| 36 | +## Recommended MCP review loop |
| 37 | + |
| 38 | +Use this flow by default: |
| 39 | +1. `list_sessions` |
| 40 | +2. `get_selected_context` |
| 41 | +3. `navigate_to_hunk` only if the current focus is wrong |
| 42 | +4. `comment` |
| 43 | + |
| 44 | +Use `get_session` only when you need broader session metadata. |
| 45 | + |
| 46 | +Guidelines: |
| 47 | +- if multiple sessions are live, pass `sessionId` explicitly |
| 48 | +- prefer `get_selected_context` before navigating blindly |
| 49 | +- use `navigate_to_hunk` for hunk-level movement; do not invent extra remote-control behavior |
| 50 | +- use `comment` for concise inline review notes tied to real diff lines |
| 51 | +- prefer `reveal: true` unless the user wants a quieter action |
| 52 | + |
| 53 | +For concrete MCP tool behavior and examples, read [references/mcp-review.md](references/mcp-review.md). |
| 54 | + |
| 55 | +## Start Hunk only when needed |
| 56 | + |
| 57 | +If no live Hunk session exists and the user wants an interactive review UI, launch Hunk itself with a minimal command and let it auto-start/register with the MCP daemon. |
| 58 | + |
| 59 | +After launching Hunk, go back to `list_sessions` rather than suggesting manual daemon management. |
| 60 | + |
| 61 | +Inside the Hunk repo, prefer the source entrypoint: |
| 62 | + |
| 63 | +```bash |
| 64 | +bun run src/main.tsx -- diff |
| 65 | +bun run src/main.tsx -- show HEAD~1 |
| 66 | +``` |
| 67 | + |
| 68 | +Outside the repo, prefer the installed CLI: |
| 69 | + |
| 70 | +```bash |
| 71 | +hunk diff |
| 72 | +hunk show |
| 73 | +``` |
| 74 | + |
| 75 | +For more CLI entrypoints, read [references/commands.md](references/commands.md). |
| 76 | + |
| 77 | +## Repo-specific review notes |
| 78 | + |
| 79 | +When using Hunk for agent changes: |
| 80 | +- prefer a real TTY or tmux session over redirected stdout captures |
| 81 | +- use `hunk diff --agent-context .hunk/latest.json` when the repo has fresh review notes |
| 82 | +- refresh `.hunk/latest.json` after code changes if the repo expects it |
| 83 | +- keep `.hunk/latest.json` concise and review-oriented |
| 84 | +- if new files should show up before commit, use `git add -N <path>` |
| 85 | + |
| 86 | +## What this skill should steer Pi toward |
| 87 | + |
| 88 | +Prefer a skill over a prompt dump: |
| 89 | +- keep always-loaded context small |
| 90 | +- load the full Hunk workflow only when the task is actually about review |
| 91 | +- use Hunk's existing MCP tools rather than ad hoc shell parsing |
| 92 | + |
| 93 | +Prefer review-oriented actions: |
| 94 | +- inspect the current live diff session |
| 95 | +- move to the right hunk only when needed |
| 96 | +- attach concise inline review comments |
| 97 | +- keep agent rationale spatially tied to the code |
0 commit comments