agentleFS
kchojnkchojn/claude-code-tradecraft/skills/pr-review-watch/SKILL.md

pr-review-watch

Skill1 starsChanged 6 days agoMITView on GitHub

One pass of the review watcher; finds open PRs that request your review and runs /tradecraft:pr-review --publish on each in its own headless session. Run it on a timer with /loop.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. antonio-orionus/skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run one pass of the review watcher.

    line 6
  2. Very specific:

    When the background command's completion notice arrives, read only the Review:, Findings:, and Highest: lines from each result file's …

    line 76
  3. Very specific:

    When the file is not valid JSON or is_error is true, print failed <owner/repo>#<number> and the paths of the .json and .err files.

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Run one pass of the review watcher. Start it with:

/loop 15m /tradecraft:pr-review-watch

The clone roots are the directories that hold your local clones; a clone is a direct child of one of them. $ARGUMENTS lists them; when it is empty, read them from ~/.config/pr-review-watch/roots, one directory per line, ~ allowed. When neither gives a root, print no clone roots: pass directories or write ~/.config/pr-review-watch/roots and end the pass; do nothing else.

Each review runs in its own claude -p process with a fresh context, so this session never holds a review. It sees one summary line per PR. Never use em dashes. Keep each pass short.

State lives in ~/.cache/pr-review-watch/: the directory lock exists while a batch runs and holds the batch's pid in lock/pid; results/<owner>/<repo>/<number>-<head7>.json and .err hold the one attempt at that head.

1. Take the lock

mkdir -p ~/.cache/pr-review-watch && mkdir ~/.cache/pr-review-watch/lock is the lock: mkdir either creates it or fails, with no gap between the check and the claim. When it fails, read lock/pid; if kill -0 on that pid succeeds, print review batch running and end the pass; if not, the batch died, so rm -r lock and take it again. When lock/pid is missing, step 5 has not written it yet: treat the lock as live and end the pass if the lock directory is younger than ten minutes (find ~/.cache/pr-review-watch/lock -maxdepth 0 -mmin +10 prints nothing). Only a pid-less lock older than that is stale. Release the lock with rm -r lock at the end of a pass that starts no batch.

2. Find requests

gh search prs --review-requested=@me --state=open --draft=false \
  --updated=">=$(date -u -v-1d +%F 2>/dev/null || date -u -d yesterday +%F)" \
  --json number,url,repository,author,updatedAt --limit 100

The window is since yesterday in UTC, GitHub's clock for updated:; it is a cheap pre-filter that cannot miss a request from the last 24 hours, and step 3 does the exact checks. Drop PRs whose author has is_bot: true. GitHub removes you from the requested reviewers once you submit a review and adds you back when the author re-requests one, so this list is the PRs waiting on you.

3. Skip PRs already handled

For each PR:

gh pr view <number> -R <owner/repo> --json state,isDraft,headRefOid,reviewRequests,reviews

Skip it unless state is OPEN and isDraft is false: the search index lags, so a PR merged or closed minutes ago still shows up as open. Skip it when your login (gh api user -q .login, fetched once per pass) is not in reviewRequests: the search index lags, and the request may already be gone. Skip it when a review by your login with state other than PENDING has commit.oid equal to headRefOid: that covers index lag the other way and a re-request with no new commits, which gets no second review. Skip it when results/<owner>/<repo>/<number>-<head7>.json exists: one attempt per head, so a review that failed does not run again in every batch until the author pushes.

Then keep only requests made in the last 24 hours. The search window above is on PR activity, not on the request, so an old request on a PR that got a comment today would slip through it. The PR timeline has the exact event:

gh api repos/<owner>/<repo>/issues/<number>/timeline --paginate \
  --jq '[.[] | select(.event=="review_requested" and .requested_reviewer.login=="<login>") | .created_at | fromdateiso8601] | max > (now - 86400)'

Skip the PR unless that prints true.

4. Find the clone

For each clone root, check each child directory's git remote -v. A match is a remote whose URL ends in <owner>/<repo> or <owner>/<repo>.git, over https or ssh, on github.com. No match: print skip <owner/repo>#<number>: no local clone and drop the PR. Never clone.

5. Start the batch

When no PR remains, release the lock and print one line that says why: no new review requests when step 2 found none, otherwise <n> requests, none reviewed: <m> handled, <k> without a clone under <roots>. Otherwise start one background Bash command (run_in_background) that writes its pid to lock/pid, removes lock on exit with a trap, and reviews the PRs three at a time, oldest updatedAt first, one line per PR fed to xargs:

printf '%s\t%s\t%s\n' <clone> <url> <owner>/<repo>/<number>-<head7> ... | xargs -P 3 -L 1 sh -c '
  mkdir -p ~/.cache/pr-review-watch/results/$(dirname "$2")
  cd "$0" && timeout -k 30s 60m claude -p "/tradecraft:pr-review $1 --publish" \
    --permission-mode auto --permission-prompts none \
    --disallowedTools "Edit,Write,NotebookEdit" \
    --strict-mcp-config --max-budget-usd 10 \
    --no-session-persistence --output-format json \
    > ~/.cache/pr-review-watch/results/$2.json 2> ~/.cache/pr-review-watch/results/$2.err'

Why each piece: -P 3 runs three reviews at once, enough to drain a morning's requests without a dozen concurrent agents hitting rate limits, and the next starts when one finishes; timeout bounds one stuck review so the lock is not held forever (macOS gets it from coreutils); nobody answers prompts, so --permission-prompts none denies instead of hanging; --disallowedTools blocks the file-editing tools, the review's own rules cover the shell; --strict-mcp-config skips every MCP server, which the review does not use and which cost tokens on every call; --max-budget-usd caps one runaway review; --no-session-persistence leaves nothing in /resume.

One PR failing does not stop the rest. Then print reviewing <n> PRs: <owner/repo>#<number> ... and end the turn. Never read a review transcript into this session.

6. Report a finished batch

When the background command's completion notice arrives, read only the Review:, Findings:, and Highest: lines from each result file's .result (jq -r .result <file> | grep -E '^(Review|Findings|Highest):') and print one line per PR:

<owner/repo>#<number>: <Review event>, <findings> findings, highest <severity or none>

When the file is not valid JSON or is_error is true, print failed <owner/repo>#<number> and the paths of the .json and .err files. When .result has none of those lines, /tradecraft:pr-review stopped early, for example on a draft; print its first line.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.