Composed PR review — ONE round of parallel reviewers (one weka-ldd pre-commit-review that routes each language to its plugin, pr-review-toolkit agents, and the risk-triggered semantic reviewers), then fix, then ONE generic reviewer over the fixes, then push. With no argument it only reports. Use when reviewing a branch, PR, or pending changes before pushing.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ldd Pr Review?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/weka-ldd-pr-review)
---
name: ldd-pr-review
description: "Composed PR review — ONE round of parallel reviewers (one weka-ldd pre-commit-review that routes each language to its plugin, pr-review-toolkit agents, and the risk-triggered semantic reviewers), then fix, then ONE generic reviewer over the fixes, then push. With no argument it only reports. Use when reviewing a branch, PR, or pending changes before pushing."
argument-hint: "[base-branch | PR number] (default: uncommitted changes vs HEAD)"
---
# Composed PR Review
Fixed four-phase flow. No loops. CI and other reviewers run after the push, so this
skill does not try to be the last gate.
Requires these plugins in the session:
- `pr-review-toolkit@claude-plugins-official` (the general review agents in step 4).
- The weka-ldd plugin for each language in the diff (step 2):
`go-linter-driven-development`, `python-linter-driven-development`,
`ts-react-linter-driven-development`, or `linter-driven-development`.
The five semantic reviewers in step 3 come with this plugin. Their agent names
carry the `ldd-pr-review:` prefix.
Before Phase 1, make sure the `pr-review-toolkit` agents are available. If they are
not, stop and tell the user to run
`/plugin install pr-review-toolkit@claude-plugins-official`. Phase 1 and Phase 3
both need them. A missing weka-ldd language plugin does not stop the review: step 2
has a fallback.
```
Phase 1 REVIEW one round, all reviewers in parallel, whole PR diff
Phase 2 FIX apply the Bugs (and cheap Design Debt), run the project gates
Phase 3 VERIFY exactly one generic reviewer over the fix diff only
Phase 4 PUSH commit and push
```
Hard rules:
- **One review round.** Never re-spawn Phase 1 agents after fixes, after a rebase,
or because a finding "feels unresolved". Phase 3 is the only post-fix review.
- **Phase 3 is one agent.** Not the trigger table again, not the ldd skill again.
- If Phase 3 finds a real bug in a fix: fix it, run the gates, and go to Phase 4.
Do not run Phase 3 a second time.
## 0. Prompt hygiene — applies to EVERY agent you spawn
These rules matter more than which agents you pick. A round of review once missed
four real bugs that an outside reviewer caught, and three of the four were failures
of the spawn prompt, not of the agent.
1. **Never describe what the diff does, or what you think it fixes.** Give the diff
range, the file list, and the role. Your summary primes agreement even when you
add "verify this" — the agent answers your framing instead of reading cold.
2. **Frame commit messages, code comments, and docs as the author's claims to
falsify** — never as context or evidence.
3. **Require self-generated questions.** Every agent writes its own falsifying
questions *before* it sees any hints, reports them, and ends with a
"questions I could not answer" section.
4. **Do not supply your own question list as the agenda.** If you have specific
worries, append them *after* demanding the agent's own list, and label them as
possibly-irrelevant extras.
5. **Rule out "matches repo convention" as a defence.** The question is correctness
under the contract *this diff* introduces.
6. **Say a clean report is a valid result**, so nobody pads a findings list.
7. **Quote the spec, the docstring or the doc for behavior; never the plan.** A
plan's "order of checks" or "X wins" is the author's mechanism, and a reviewer
handed a mechanism as the invariant verifies the mechanism. Hand it the promise
("a page miss keeps its answer whatever `section` says") and the plan only for
shapes (names, fields, files, signatures). Every claim the diff's own prose
makes about a value is a contract for the reviewer to falsify.
## 1. Determine scope — the WHOLE PR, always
| Argument | Mode | Changed files | ldd rung |
|---|---|---|---|
| none | working tree (report only) | `git diff --name-only HEAD` plus `git ls-files --others --exclude-standard` | no argument |
| a base branch `<base>` | branch | `git diff --name-only <base>...HEAD` | `--base <base>` |
| a PR number `<n>` or a PR URL | PR | as branch mode, with `<base>` = `$BASE_SHA` | `--base $BASE_SHA` |
Rules for the modes:
- **Working-tree mode is report only.** Run Phase 1, write the report, and stop.
Never fix, commit or push in this mode: the changes belong to the user.
- **Branch and PR modes need a clean working tree.** Run `git status --porcelain`.
If it prints a line, stop and tell the user. Phase 4 commits only the fixes.
- **Branch mode never commits on the base branch.** Record the branch:
`git symbolic-ref --short HEAD`. Stop on a detached HEAD. Stop when the branch
is `<base>` without its `<remote>/` prefix, or the default branch of `origin`
(`git symbolic-ref --short refs/remotes/origin/HEAD`, without `origin/`).
- **Shell variables do not live from one Bash call to the next.** Where this
skill writes `$BASE`, `$BASE_SHA`, `$HOST` or `$PRE`, record the value when
you get it, and write that value in each later command.
- **PR mode finds the base repository first.** Do not assume that `origin` is
the base: in a clone of a fork, `origin` is the fork.
- A PR URL `https://<host>/<owner>/<repo>/pull/<n>` names it:
`HOST=<host>` and `BASE=<owner>/<repo>`.
- With a PR number, `HOST=github.com` and `BASE` is the stdout of
`gh repo set-default --view`. If stdout is not one `<owner>/<repo>` line,
stop and ask the user for the PR URL. Then run
`gh repo view "$BASE" --json isFork,parent`. If `isFork` is true, the default
is a fork: set `BASE` to `parent.owner.login/parent.name`.
- **PR mode then checks out the PR,** after the clean-tree check:
1. `gh pr view <n> -R "$HOST/$BASE" --json url,headRefName,headRefOid,baseRefName,headRepository,headRepositoryOwner,isCrossRepository,maintainerCanModify`.
Write `url` in the report, so the user sees which PR was reviewed. Below,
`<head>` is `headRepositoryOwner.login/headRepository.name`.
2. `gh pr checkout <n> -R "$HOST/$BASE"`
3. Fetch the base branch from the base repository, not from `origin`. Use the
remote whose fetch URL (`git remote -v`) is exactly
`https://$HOST/$BASE`, `git@$HOST:$BASE` or `ssh://git@$HOST/$BASE`, with
or without `.git`. Any other URL does not match, for example a mirror
whose path ends in `$HOST/$BASE`, or an SSH alias in place of the host.
If no remote matches, use the URL `https://$HOST/$BASE.git`.
Run `git fetch <remote or URL> <baseRefName>`, then
`BASE_SHA=$(git rev-parse FETCH_HEAD)`.
4. Make sure `git rev-parse HEAD` equals `headRefOid`. If it does not, stop:
the review and the push must be on the PR's head.
- **A PR that you cannot push to is report only.** Run
`gh repo view "$HOST/<head>" --json viewerPermission`. You can push when the
value is `ADMIN`, `MAINTAIN` or `WRITE`. For a fork PR with
`maintainerCanModify` true, you can also push when your value for
`"$HOST/$BASE"` is one of these. Else run Phase 1, write the report, say why,
and stop.
- **Run every command from the repository root.** The scope script reviews
only the files under the folder it runs in. Record the path that
`git rev-parse --show-toplevel` prints, and start each command with
`cd <that path> &&`.
- **A failed `git` or `gh` command stops the skill,** in every phase. Show its
error. A failed command is not an empty scope.
Never review only the staged slice, and never review hunk by hunk. The bugs this
skill exists to catch are **interaction bugs** — a write whose input differs on one
path, a reader that was not updated, a migration predicate that is wider than its
author's intent. None of them are visible in a single hunk.
Do **not** discard the non-code half: `SKILL.md` files, prompt builders,
output-contract files, docs SQL, and dashboard queries are programs that a database
or an agent executes.
If the scope is empty, say so and stop.
## Phase 1 — REVIEW (one round)
Run steps 2, 3 and 4 together. Spawn every Agent-tool reviewer in ONE message so
they run in parallel. The ldd skill invocation runs in the main context; start it
first, then spawn the agents.
### 2. ldd rules review — ONE pre-commit-review
Invoke exactly one `pre-commit-review`. Its scope script splits the scope by the
language of each file. It sends each language group to the installed weka-ldd
plugin for that language. So one invocation reviews every language in the diff, and
a second invocation reviews the same files again.
Invoke the skill of the first row that matches a file in the diff and an installed
plugin:
| Diff contains | Skill to invoke |
|---|---|
| Go | `go-linter-driven-development:pre-commit-review` |
| Python | `python-linter-driven-development:pre-commit-review` |
| TypeScript/React | `ts-react-linter-driven-development:pre-commit-review` |
| any other case | `linter-driven-development:pre-commit-review`, else the skill of any installed weka-ldd plugin |
If no weka-ldd plugin is installed, skip this step and write
`not run: no weka-ldd plugin` in Coverage.
Pass two arguments: the ldd rung from the step 1 table and the mode `FULL`. Do not
pass a file list. The scope script takes either a file list or `--base`, not both.
A file list compares the working tree against `HEAD`, and on a committed branch
that diff is empty.
The ldd review bundles only files whose extension is in its language table.
When it bundles at least one file, its R9 gate also checks the markdown files the
diff touches. It does not review JSON or YAML. When the diff has no file it can
bundle, it prints "nothing to review": write `not run: no source files` in
Coverage. Steps 3 and 4 get the whole diff, so they review the other files.
The scope script puts code of a language with no row of its own in the group
`other`, which the generic plugin reviews. It drops a file whose extension is on
no list, and names those extensions on stderr. After it runs, compare the changed
code files with the files it bundled: `files.txt` of each group, minus the lines
marked `not bundled`. With several groups, or with one group that another plugin
reviews, or with one group that no plugin reviews, `groups.txt` lists the
groups. Else there is no `groups.txt`, and the plugin you invoked reviewed the
one group.
The scope script routes each group by its own lookup, not by the skills this
session loaded. It reads `~/.claude/plugins/installed_plugins.json`. With `jq`,
it keeps the entries for the whole user or for this project, and drops a plugin
that the settings disable. Without `jq`, it takes the first entry of the plugin that has an
`installPath`, for any project and with no settings check. A plugin loaded only with `claude --plugin-dir` is not in that
file. To route to it, the user starts the session with `LDD_PLUGIN_DIRS` set to
the absolute path of its folder (":" between several):
`LDD_PLUGIN_DIRS=<absolute dir> claude --plugin-dir <absolute dir>`. A relative
folder does not count.
In Coverage, name each group's reviewer from `groups.txt`,
and copy the note of an excluded group: it says why no plugin took the group.
The invocation spawns its own single-obsession rule hunters, over-abstraction
skeptic and comment critic. Let it complete.
### 3. Risk triggers — the semantic reviewers
Check the diff against this table and spawn every agent whose trigger fires. These
are the roles whose absence let real bugs through.
| Trigger in the diff | Agent | Bug class it owns |
|---|---|---|
| A new or changed DB write, persisted mutation, or file write | `ldd-pr-review:write-dataflow-reviewer` | Write correct on the happy path only; replace-vs-merge data loss |
| A value given new meaning: presence/absence asserting a fact, a sentinel, a new enum, a validated type | `ldd-pr-review:invariant-reviewer` | A swallowed failure turning a missing record into a confidently wrong one |
| Any new or changed field, column, or API property | `ldd-pr-review:consumer-reviewer` | A reader — including a `SKILL.md` — that was never updated |
| Any row-mutating migration (`UPDATE`/`DELETE`/backfill) | `ldd-pr-review:migration-reviewer` | An over-broad predicate rewriting an unknown value into a wrong value that looks valid |
| Any non-trivial PR | `ldd-pr-review:cold-adversary` | Whatever nobody enumerated |
### 4. General review agents (pr-review-toolkit)
Spawn these, each told exactly which files and which diff range:
- `pr-review-toolkit:code-reviewer` — always.
- `pr-review-toolkit:silent-failure-hunter` — always.
- `pr-review-toolkit:pr-test-analyzer` — always.
Scope it to **coverage gaps only**: which new branches, edge cases, and error
paths have no test, and whether each new assertion would fail if the behavior
it guards were reverted. Tell it test placement, test doubles, `wantErr`
tables, and sleeps are out of scope (the ldd test-placement rule owns them).
Not spawned, on purpose:
- `comment-analyzer` — the ldd comment critic covers the same comments with a
stricter standard (value toolbox, line budget, plain English, 5-year reader)
and forbids "add more context" verdicts that the analyzer would produce. Two
reviewers with opposite doctrines on one comment is noise.
- `type-design-analyzer` — the ldd primitive-obsession, self-validating-types
and mutation-discipline hunters, plus the over-abstraction skeptic, own type
design. If step 2 did not bundle a changed code file (no weka-ldd plugin, an
excluded language group, a code extension on no list, or a file that
`files.txt` marks `not bundled`), spawn
`pr-review-toolkit:type-design-analyzer` for those files after step 2's scope
script runs, and name the files in Coverage.
Do not send a generated file. A file is generated when one of its first 10
lines has a generator header (`Code generated`, `DO NOT EDIT`, `@generated`,
`auto-generated`), or when `.gitattributes` marks it `linguist-generated`.
Write `not run: generated (<the header or the attribute>)` for it in Coverage.
Review its source (the spec or template) instead.
### 5. Merge findings into ONE report
Deduplicate: a finding surfaced by several sources appears once, attributed to all
of them. Every finding needs file:line, evidence, and its source (rule ID or agent
name).
```markdown
# Review: <scope>
## Coverage
| Bucket / Trigger | Fired? | Skill or Agent | Result |
## Bugs (must fix)
- [source] finding — file:line — evidence — failure scenario
## Design Debt
## Readability Debt
## Polish Opportunities
## Unanswered questions
- <question nobody could settle> — what would settle it
## Strengths
```
The Result column takes one of these values:
- `findings` or `clean`: the reviewer returned a full report.
- `not run: <reason>`: the trigger did not fire, or a plugin is missing.
- `failed: <reason>`: the reviewer returned an error, or no report.
- `partial: <what is missing>`: the reviewer returned only part of its report.
An ldd report that says `PARTIAL coverage` or `inconclusive` is `partial`.
A reviewer that failed is never `clean`. If any row is `failed` or `partial`, say
so in the first line under the `# Review` heading.
**The unanswered-questions section is not filler** — a bug that no reviewer found is often in it.
Never drop it.
## Phase 2 — FIX
- Fix every item under **Bugs**. Fix Design/Readability Debt only when the fix is
local and cheap; otherwise list it in the final summary as deferred.
- Do not chase Polish Opportunities.
- Before the first fix, record `PRE=$(git rev-parse HEAD)`. The working tree is
clean at this point, so `git diff $PRE` plus the new untracked files is the fix
diff. Phase 3 reviews only that.
- Run the project's own gates (lint, tests, `task check:*` or equivalent). Cite the
command's **real exit code**. `task check | tail -10` reports `tail`'s status, so a
piped green tail can hide a failed gate.
- If a gate exits non-zero, fix the cause and run it again. If it still fails,
stop before Phase 4: do not commit or push. Report the gate, its exit code and
its output.
- After the gates pass, list every changed path:
`git diff --no-renames --name-only $PRE` and
`git ls-files --others --exclude-standard`. With `--no-renames`, a rename
shows both its old and its new path. Gates can write files too
(formatters, `lint --fix`, code generators, test fixtures). Put each path in
one class:
- `fix`: a file you changed to fix a finding.
- `gate-written`: a change a gate made that the repository needs, for example
regenerated code or a formatter change.
- `artifact`: a change the repository does not need, for example coverage
output or a cache. Remove it: `git restore --staged --worktree --source=$PRE -- <path>`
for a tracked file, delete an untracked one. Never stage it.
The `fix` and `gate-written` paths are the **reviewed list**. Record the
content of each one: `git hash-object <path>`, or `deleted` for a path that
no longer exists.
## Phase 3 — VERIFY the fixes (one agent)
Fixes are the highest-risk code in the PR: written fast, under a "satisfy the
reviewer" frame, after the careful review already ran. A snapshot-write bug once
entered a PR exactly this way.
Spawn exactly ONE `pr-review-toolkit:code-reviewer` with:
- the fix diff only (`git diff $PRE` and the new untracked files from Phase 2),
- the `gate-written` paths by name, with the request to confirm that each change
is mechanical and that the repository needs it,
- the Phase 1 **Bugs** list as the author's claims to falsify: for each one, did the
fix remove the failure scenario, and did it add a new path that is wrong,
- the prompt-hygiene rules from section 0.
Outcome handling:
- The reviewer errors, returns no report, or returns a partial report: stop
before Phase 4. Do not commit or push. Report the fixes as not verified, and
leave them in the working tree.
- Clean, or only polish: go to Phase 4.
- A real bug in a fix: fix it, re-run the gates, go to Phase 4. No second Phase 3.
The Phase 2 rule for a failed gate applies here too. Then classify the changed
paths again as in Phase 2: this is the new reviewed list, with its content
recorded again.
- A fix that cannot be made safe without a design change: revert that fix
(`git restore --staged --worktree --source=$PRE -- <path>`, or remove a new
file), and keep the
other fixes. If the unsafe fix shares a file with a safe fix, revert only its
lines. Then remove every `gate-written` change the same way, because a
generator does not delete the output of a reverted input. Re-run the gates,
and classify the changed paths again as in Phase 2: this is the new reviewed
list. Leave the original finding open, say so in the summary, and go to
Phase 4.
Before Phase 4, list the changed paths again, as in Phase 2, and remove new
artifacts. Stop before Phase 4 if a path is not in the reviewed list, or if its
content differs from the recorded content. A gate that ran after the review made that change, and nobody reviewed it.
Report the path.
## Phase 4 — PUSH
- Clear the index first: `git reset -q -- .`. A gate can stage a change that
is not in the working tree, and nobody reviewed it.
- Stage exactly the reviewed list: `git add <path>...`. Never `git add -A`.
- Make sure `git diff --cached --no-renames --name-only` prints exactly the
reviewed list, and that `git diff --no-renames --name-only` prints nothing
for those paths. Else stop.
- When the reviewed list is empty, skip the commit and the push, and say so.
- Record the staged tree: `TREE=$(git write-tree)`.
- Commit the fixes with a plain-English message (what the product does now, not
review history). Read the exit code of `git commit`. If it is not 0 (for
example, a hook rejected the commit), do not push: report the error.
- After the commit, make sure that a commit hook changed nothing:
`git rev-parse HEAD^{tree}` equals `TREE`, and `git status --porcelain`
prints nothing. If either check fails, do not push. Report what the hook
changed (`git diff $TREE HEAD`).
- Push:
- In PR mode, push to the PR's head: `git push <remote> HEAD:refs/heads/<headRefName>`.
`<remote>` is the remote whose push URL (`git remote get-url --push`) is
exactly `https://$HOST/<head>`, `git@$HOST:<head>` or
`ssh://git@$HOST/<head>`, with or without `.git`. If no remote matches,
use the URL `https://$HOST/<head>.git`. After the push, make sure the
`headRefOid` of `gh pr view <n> -R "$HOST/$BASE"` equals
`git rev-parse HEAD`. If it does not, report that the push did not reach
the PR.
- In branch mode, push to the branch of the same name. When the upstream
has the same name, push to its remote: `git push <remote> HEAD:refs/heads/<branch>`.
Else push with `git push -u origin HEAD:refs/heads/<branch>`. Never push
to an upstream with another name: a branch made from `origin/main` has
`main` as its upstream.
Read the exit code of `git push`. If it is not 0, report the error and the
local commit, and do not report the commit as pushed.
- Do not force-push. Do not open or merge the PR; CI review runs after the push.
End with a short summary: coverage table, bugs fixed, findings deferred, gates with
exit codes, and the pushed commit or the push error.