Skip to content
public-library› 5k ›Skills›5k-pr-review

5k-pr-review

5k-pr-review
View on GitHub

A 5K PR review is the 5,000-foot view of a pull request: high enough to see the shape of the change, low enough to make out its tables, entities and decisions.

Help a reviewer understand a pull request: what it created, what it changed, how the pieces relate, and how it was verified. This is not a bug review. Never report defects as findings; adversarial code review covers that. Describe what is there, with literal examples, so the reviewer gets a feel for how it works.

The output is one self-contained page: a section rail, a pannable canvas, and an inspector that opens when a node is clicked. You write a JSON snapshot; the bundled script renders it.

Gather

  1. Read the PR: title, body, base and head branches, the stack it sits on, stats, commits, review comments and CI status. Read the repository's planning or decision records the PR touches; they are the best source for why.
  2. Diff base against head. Work from the merge base (git diff base...head).
  3. If you are the agent that built the PR, collect your own verification from this session. Otherwise take it from the PR body, commits and comments, and say so in verification.agentNote.
  4. Read the settings. They can live in two places: the repository's own .fabrica/5k-pr-review/settings.yaml, and an organization's defaults in 5k-pr-review/settings.yaml on the default branch of its .fabrica repository (<owner>/.fabrica, beside the organization's other Fabrica tools' folders), when that repository exists and you can read it. Each top-level key the repository's file sets replaces the organization's. Copy the personas into the snapshot's personas, so the page's Settings shows them. Use them to write descriptions in the product's own terms: name a persona when a change matters to particular people ("Field agents can now..."), and otherwise say "users". If the file is missing, say "users"; never invent personas. Copy its catalog block into the snapshot's catalog as well; it is off unless the file turns it on. Copy its demos block into the snapshot's demos too: preview is the PR's preview build, with {pr} and {sha} filled in, and about says in a few sentences where the project's recordings and screenshots live, such as a CI artifact's name, a bot's PR comments or a folder. Both files are optional: without them the skill runs with no personas and no catalog.

Scan quickly

The scripts in scripts/ do the mechanical half of a scan, so your own time goes to the writing. Each prints JSON; keep their outputs beside the snapshot's build, so a rescan can reuse them.

  1. Scan the head as it is. Run scan.py changes --repo . --base BASE --head HEAD for what changed, by kind. Scan once, at the head you started from, even when someone is still pushing: rescans happen only when someone asks for one.
  2. Rescan only what changed. Record the commit you scanned in the snapshot's scan.head, and run scan.py history --repo . --base BASE --head HEAD --snapshot SNAPSHOT.json to record the PR's commits in scan.history, each with how many commits behind the head it is. On a rescan, run scan.py changes ... --since <scan.head>: its redo says which steps to repeat (schema, backend, goDeadcode, frontend, the files whose props to read again, catalog, knip, duplicates, install, evidence, stats), and redo.nothing is true when the head hasn't moved. Reuse everything else from the last build. Rescan gives the order.
  3. Let the scripts do the mechanical steps.
    • scan.py checkout --dir DIR --ref REF makes or moves a scratch worktree, and installs JavaScript dependencies only when the lockfile changed since that tree's last install.
    • scan.py schema --format goose|plain --out DIR applies the migrations at base and head, read from git, to fresh databases, both at once, and writes both dumps and a diff by table, column, constraint, index, policy and function. A database whose migrations haven't changed since the last run is kept, with the rows you loaded into it, and kept says which; pass --rebuild for fresh ones. Set PR_REVIEW_PSQL and PR_REVIEW_PG_DUMP when psql needs another user.
    • scan.py stats, scan.py components --frontend DIR (components with their JSX edges and levels, bottom-up) and scan.py deadcode --base-dir A --head-dir B --cache DIR (knip, deadcode and staticcheck at both, all at once, diffed; with --cache, a tree at a commit already run is read from the cache, so an unmoved base costs nothing).
    • scan.py duplicates --base BASE --head HEAD --within DIR... [--tree CHECKOUT] lists definitions the PR adds that already live elsewhere: the same JavaScript or TypeScript string literal in several files, class lists that nearly match one another (copies of one style that drifted, with the classes each copy adds to or drops from the first), and, given a checkout of the head, copied JavaScript, TypeScript, Go and CSS blocks found by jscpd. Every hit touches a line the PR adds. The places the PR adds come first; when a placesTotal or a list's total is larger than what it shows, rerun with a larger --max-places or --max-hits before you list every place. Feed the real ones to principles.
    • node scripts/props.cjs FRONTEND '[[file, export], ...]' reads each component's properties from the type of its first parameter.
    • node scripts/catalog-code.cjs FRONTEND CATALOG_FILES... takes each catalog state's code from its file.
    • node scripts/walk.cjs BUILT_DIR STATES.json THUMBS_DIR [CONCURRENCY] renders every state several pages at once, reports each one's errors, and screenshots each component's first state in both themes, clipped to what it draws. It serves the build through Playwright's routing, so no server listens. On a rescan, give it only the components whose states or source changed, and keep the other thumbnails.
    • scan.py rescan, scan.py started, scan.py progress and scan.py verify do a rescan's mechanical steps, mark it under way and log its steps, and check the snapshot's facts against the head; Rescan says when.
    • scan.py snapshot --page PAGE.html --out SNAPSHOT.json takes the snapshot back out of a rendered page, such as the published one read with the Artifact tool.
    • scan.py publish --root DIR --snapshot SNAPSHOT.json lists the files under DIR, the folder that holds the page's files at their published paths, that a republish must send: the new and changed ones, and null for the ones gone, since a publish keeps the files it leaves out. It records their hashes in the snapshot's scan.published, so run it before you render. The Artifact tool refuses a file that holds U+FFFD, which bundlers sometimes emit in a string, so it first rewrites each one in a .js, .mjs, .cjs, .json or .css file as an escape that means the same character, and lists the files under escaped; a file it can't escape safely, such as one with U+FFFD after a backslash or of another type, is listed under unescaped for you to fix. render.py escapes it in the page. Send files only after publish runs.

Sections

Write each section that has content. Leave a section out rather than inventing it.

  • database: every table the PR creates or changes, plus the unchanged tables they reference, shown as context. Get the schema by running every migration on a fresh database at the base and at the head and diffing the dumps; never reconstruct columns from reading migrations alone. For each table say what one row is in a few words (row, such as "One task, assignable to a person."), what the PR changes as short bullets (explain, a list), each column's status (new, changed, renamed with from, removed, same), listing every column of every table shown, context tables and unchanged columns too, one entry per column, so the board and the chat show what a row holds, the column it references (ref), the values a check constraint allows (values, with the constraint's name in valuesRule), its constraints and access policies in plain words, and the migrations that touch it. Write example rows with realistic values that show each new column doing its job, load them into the head database, and keep only rows it accepts. Try at least one row each new constraint should refuse and confirm it does. When a migration rewrites existing data, insert a row at the base, run the PR's migrations over it, and show it before and after in dataMigration, naming the table it belongs to in table.
  • backend: new and changed types, enums, views, rules, store interfaces and API operations, grouped by what they are for. Give every property of a changed type, unchanged ones marked same, with its status (renamed with from), a one-line meaning and any fixed set of values, and a JSON example that matches the database example where they overlap.
  • frontend: new and changed components, bottom-up so a reviewer meets the parts before what is built from them: building blocks that draw no other component of the PR first, then components made of them, and the whole screen or panel last. Find the edges by JSX use, not imports, since an import of a type or helper draws nothing. Give each component madeOf (the PR's components it draws) and usedIn (those that draw it). Then a last group, Logic: hooks and utils, for code with no screen of its own (kind hook or util). Say where each shows, what it takes, and a short example. Read each component's properties from its source at the base and the head, the type of its first parameter, never from memory or an earlier scan, and list every one: all of a new component's properties are new, a changed component's compare by name and declared type (changed says what it was), and a property the head dropped is removed. The same holds for the properties of a new backend type. Mark hand-drawn text examples "lang": "text", which the page labels as a sketch. Leave out generated types and schemas that mirror the backend; count their files and lines in the summary.
    • Previews. Give each component a preview so its card shows a screenshot and its window shows the real component, live, in every state worth seeing, with the code each state runs beneath it. The preview is {"url", "component", "states": [{"id", "title", "code", "codeFrom", "status"}], "thumb", "thumbDark", "size": [w, h]}: the canvas draws a tab per state, frames <url>?c=<component>&s=<id>&shot=1&theme=light|dark, and shows the state's code under it, highlighted. status is new or changed for a state the PR adds or changes; size is the screenshot's CSS pixels, so the card keeps its height before the image loads; commit is the commit the screenshots were taken at. Set scan.previews to the commit the build the frames load was made from. Check every state renders without errors and screenshot the first state of each component in both themes. Publish what the frames load and the screenshots under previews/ beside the canvas; on a rebuild, send the files scan.py publish lists, which include every renamed file, since a style change renames the stylesheet too and a preview missing it renders unstyled, and remove the ones the build no longer has. Where the previews come from depends on the settings, and works without them:
      • The project's catalog, when catalog.enabled is true. Read catalog.about to learn how the catalog is laid out and how its URLs name a state. Find each changed component's states at the base and the head, from the catalog's index or its files: a state missing at the base is new, and one whose catalog file changed is changed. Build the catalog from the head in a scratch copy, with an entry that starts it from any folder, and publish it under previews/catalog/, so it shows for every viewer and at the scanned commit; set "source": "catalog", and set live to the component's page in the deployed catalog (catalog.url with {pr} and {sha} filled in), which the window links. Take each state's code from its catalog file: what the state renders, the file's own helpers it calls, the imports those use, and its controls' starting values; set codeFrom to the file. When a changed component has no states in the catalog, build none of your own: set preview to {"source": "catalog", "missing": "..."}, saying in one sentence which catalog file to add beside which component, under what contract, and the command that regenerates the index; the card says it has no catalog states yet and the Preview tab shows that sentence.
      • A page of your own, the default when there are no settings or no catalog. Build it from the PR's own frontend in a scratch copy: an entry that renders one component per ?c=<component>&s=<state id>, bare with &shot=1, in &theme=light|dark, answering its API calls from an in-memory fake that holds sample data and applies changes, so the component can be used, not only looked at. Give any bar the page keeps in view, such as its state tabs, an opaque fill, so content scrolling under it doesn't show through; check that by scrolling a tall state. Write each state's code as an app would: the imports it needs, the lines that get its data (a hook call or useState with the state's value), and the element with that state's props, one prop per line when long, in the app's own names, never the harness's helpers or fixture constants. Never commit it to the repository under review.
  • architecture: decisions that change how the system is shaped. Each has before, after, why, trade-off and its source, and a small diagram of the before and the after: rows of boxes, → label arrows and stacks, with boxes toned new, changed, removed or muted (see the example). Rate each decision's significance, which the board groups by: foundational when it is hard to reverse and later work builds on it (data model, integrity, contracts other contexts rely on), significant when it shapes how one feature works or what it promises, and local when it is a detail inside one area that is cheap to change. List decisions most significant first within each level.
  • principles: rate the PR against each principle in references/principles.md as strong, mixed or weak, with a one-line verdict and concrete evidence from this PR. List each red flag with whether you saw it and where. For each one you saw, draw the issue the same way as a decision's diagram and propose a simple fix, with its text and diagram. Rate design, not correctness. Run scan.py duplicates and check each hit by hand: a style, value, schema or block the PR defines again where one already exists, or several copies of one definition that have drifted apart, is the Repetition red flag, and Information leakage too when the copies encode one decision, such as how a form field's text looks. Leave out idioms, such as a short layout class list, and copies that only look alike. Put each real one in duplicates, which the page shows as its own column of cards: {"id", "title", "summary", "value", "places": [{"file", "line", "end", "added", "extra", "missing", "note"}], "placesTotal", "drift", "fix": {"text", "diagram"}, "handoff"}. title names the definition in a few words, such as "Popover surface"; summary is one sentence on what is copied and how far; value is the original the others came from, the step's seed for a class list, which each copy's extra and missing are measured against; each place carries the classes its copy adds (extra) and drops (missing) against value, from the step's output, or a short note for a block; placesTotal is the step's count when it cut the list short, so the card says "12 of 20 places", though a full list is better: rerun with a larger --max-places; drift lists how the copies differ, one short line each; fix names the one shared home each place should use. Then keep the Repetition red flag short: a one-line summary, and where as a list with one line per duplicate. A red flag's where may always be a list, shown as bullets, with summary on its card. Each principle and red flag window carries a handoff prompt the reader can copy to an agent working in the repository; the page builds it from the PR, the rating and the evidence. For each principle rated mixed or weak, add a handoff: one to three sentences naming the specific change that agent should make, with the files or records it touches. A red flag's prompt uses its fix, or its own handoff when it has one.
  • verification: runs of any verify-* skill (what was walked, what it found, what was fixed), the checks that ran and their results, what was found and then fixed during the work with commit references, and what was not verified. Add what you did to check the canvas itself.
    • verification.evidence (experimental): don't take the PR's word for what it verified. List what the change should prove, each from something in it: a rule the schema adds, a recorded decision, a fixed bug, or something a person sees. Then find evidence the PR can't self-report: tests the diff adds or changes, found by name and file; the CI step that ran them, checked to have passed at the head and unable to skip them; showcases or recordings a deploy made; and checks you ran yourself. The PR's own description counts only as a claim. Mark each expectation proven, partial, claimed or missing, say the gap for anything short of proven, and give a handoff naming the test that would close it. Shape: {"experimental": true, "method", "limits", "sources": {key: {label, url, result}}, "expectations": [{id, title, from, status, evidence: [{kind: test|e2e|showcase|ci|schema|claim, name, file, detail, ran: sourceKey}], gap, note, handoff}]}. In limits, say what you couldn't see, such as a CI log you couldn't read.
  • deadCode: what the PR left unused. Run the language's dead code tools on the base and the head and diff the findings, so the PR's own leftovers stand apart from what was already unused. For Go, run deadcode with and without -test from every main package, including build-tagged ones, and staticcheck -checks U1000; for TypeScript, run knip from the app entry, routes, scripts and tests, writing a config in a scratch copy when the repository has none. Group findings as Left by this PR and Already unused before this PR, with at most five in a group; put related names in one finding with entries. Each finding has name (or a plain label when it covers several names), where, status (new or existing), finding, why, fix and tool. Check each one by hand before listing it. Code reached by reflection or bindings is not dead, so leave it out. An export only its own file uses is an unneeded export rather than dead code, and a type that names part of an exported signature is usually fine to keep; say which in finding and fix. Count findings in generated files in the summary instead of listing them. List each tool in scans with its scope, counts at base and head, the command, and what it can miss.
  • media: the PR's preview build, recordings and screenshots, shown under Demos. Find them where the settings' demos says: link demos.preview with the PR's number and head filled in, and follow demos.about for recordings and screenshots. Without demos, look in the PR's description and comments, its deployments' URLs and its CI runs' artifacts, and never borrow another project's setup. Give each item a kind: preview for a link to the preview build, video for a recording, image for a screenshot, or link for anything else; the page shows them in that order. Publish images you can read as files under media/ beside the page and set src to that path, such as media/board.png, so the page stays small and a republish leaves them alone; embed them as data: URIs only in a page that will be opened as a plain file. Link the rest with url. Give each image, video and preview the commit it shows: the head the CI run or deploy that made it was built from, or the commit a bot's comment names; set "unknown" only when nothing says. A screenshot made at the base on purpose, as a before, shows as "Before this PR" with no button. A video plays in the page, with full screen, from src or else url, so link the video file itself (an .mp4 or .webm), not a page that wraps it; add a poster image if you have one. A video that can't load falls back to its Open link. The canvas works without media.
  • overview: a headline and what users can now do. Group it by the system's own things, such as Tasks or Workflows, then by subgroups within each (group, icon, subgroups of group and items). Name each subgroup for what people can now do, as a short verb phrase such as "Track status" or "View and assign teammates' work", never a bare noun.

Render and deliver

  1. Write the snapshot to match examples/invoice-installments.json, a made-up PR that uses every field. Keep example ids and names consistent across sections, and list them in people so the page can name the person beside each id.
  2. Check it: scan.py verify (see Rescan, step 4) compares its facts with the head; fix every mismatch before any publish, the first included. Render it: python3 scripts/render.py SNAPSHOT.json OUT.html.
  3. Open the page in a browser once and check that the schema view reads well, then give the reader the page. The page pushes apart tables that would overlap, and the reader can drag a table by its header; the layout is kept in their browser until Reset layout.
  4. When you publish it as a claude.ai Artifact, declare capabilities: {"sample": {}, "comments": {}}. The reader can then chat about the PR from the toolbar, or highlight any text and ask about it: Claude answers in a bubble from the snapshot alone, so the page never waits on you. Each answer names the parts of the snapshot it used, as links to their windows, and "See Claude's context" lets the reader browse and search the snapshot itself, so its limits are visible. A question that needs the code goes to you as a comment on the highlighted text; you are woken by it, answer from the repository in that comment thread, and never poll for questions. The toolbar's Rescan button sends you a comment on the PR title asking for a rescan: follow Rescan and reply in that thread with what changed. Republish even when the head hasn't moved: the button spins until the page loads a version rendered after the request. Opened as a plain file, the page works without asking, and the Rescan button stays hidden.
  5. Every screenshot, recording and preview build says how old it is: a green check, "Based on latest commit", when it was made at the scanned head, and otherwise how many commits behind it is, from scan.history, with an Update to latest button. The button sends you a comment asking for that one thing to be made again: follow Update to latest.

Rescan

A rescan rebuilds a page you or another session already published while the reader watches its button, so start at once, scan the head as it is now, redo only what changed, and check the facts before you publish:

  1. Say you've started. Get the snapshot: your own last SNAPSHOT.json if you still have it, otherwise read the page with the Artifact tool and run scan.py snapshot on the saved file; don't read the page's HTML yourself, since it is mostly embedded data. Run scan.py started --snapshot SNAPSHOT.json, render, and republish the page alone, with no files: the dropdown under its Rescan button then logs when you started for every viewer. Before a step that takes minutes, such as rebuilding previews, run scan.py progress --snapshot SNAPSHOT.json --step '...', render and republish the page alone again, so the log shows it. Reply in the request's thread too.
  2. Do the mechanical steps. Run scan.py rescan --repo . --snapshot SNAPSHOT.json --out DIR --frontend FRONTEND --migrations-format goose|plain. It moves the snapshot's head and stats, diffs the schema and lists the components when the new commits call for it, and prints todo: for each section, the tables, components and files that changed under it. When moved is false, skip to step 5.
  3. Write only what todo lists. Redo the steps redo names with the scripts above, in your existing scratch trees and output folders when you have them. Reread every item whose files changed and rewrite what it says, including a renamed table or component everywhere it appears; leave the other items as they are. When todo lists principles, rerun scan.py duplicates and rebuild duplicates from it: drop a place the commits folded into a shared home, and a duplicate left with one place, then bring the Repetition and Information leakage red flags into line with the cards. Don't reread the settings, the PR body or the planning records unless the new commits change them. Rebuild and re-walk only the previews of changed components, and set their preview.commit and scan.previews to the new head. Leave the other screenshots' commits as they are: the page shows them behind, and the reader can ask for them with Update to latest.
  4. Verify. Run scan.py schema --all at the head and props.cjs for the changed components, then scan.py verify --repo . --snapshot SNAPSHOT.json --schema-diff DIR/schema-diff.json --frontend FRONTEND --props PROPS.json. It recomputes the head, stats, scan.history, every shown table's columns and types, which components are new or changed, and their properties from scratch, not from the last scan, fails when a screenshot, recording or preview build has no commit, and lists under behind the ones made before the head. Fix each mismatch it lists and run it again; never publish while it fails.
  5. Publish. Run scan.py publish on the folder of the page's files, render, and republish the page with only the files it lists. Reply with the commits since the last scan and what they changed on the page.

The first rescan of a page published before scan.published existed sends every file once. On the first rescan of a page published before screenshots recorded their commits, set each one's commit (and scan.previews) to the commit it was made at when you know it, and otherwise to "unknown", so verify passes and the page offers Update to latest.

Update to latest

A reader asked, from a screenshot, recording or preview build that is behind, for it to be made again at the PR's latest commit. The comment names it and the commit it was made at.

  1. If the PR's head has moved past scan.head, the page itself is out of date: follow Rescan, and before its publish step also make the thing the comment names again, as step 2 says, since a rescan leaves unchanged screenshots and Demos as they are. Reply once, in the comment's thread.
  2. Otherwise make only that one again at the head. A component's card screenshot: build the previews at the head if scan.previews is older, walk that component with walk.cjs, and set its preview.commit. The live preview: rebuild the catalog or your page at the head and set scan.previews. A recording or screenshot under Demos: take it again where demos.about says they come from, or from the PR's preview build, and set its commit; if it can't be made here, such as a recording only CI makes, leave it and say so in the reply.
  3. Run scan.py verify, then scan.py publish, render, and republish with only the files it lists. Reply in the comment's thread with what you made again and at which commit.

Write for someone who has not read the code: plain sentences, the product's own words, no em dashes. Prefer short bullets under a plain heading to a paragraph.

Never show a list of more than five items flat. Group it under short headings, with at most five items in a group: in the overview by the system's own things (see overview), and for verification runs by a group on each run.

Put field, column, type and operation names in backticks, such as description or tasks.create; the page shows them as code.

Shared 5k shell

The page shares the 5k skills' look, its fonts, palette, top bar, ⋯ menu, Settings modal and About dialog, from 5k-shell.css. The bundled script puts it into every page it writes or serves, so change neither the page's shell nor that file: the library updates them together for every 5k skill. It embeds Inter and JetBrains Mono, both under the SIL Open Font License 1.1: keep Inter-OFL.txt and JetBrainsMono-OFL.txt with the skill when you redistribute it.