/collaboration-skills:pr-diff-verificationfrom collaboration-skills
Verifies that a branch's actual git diff matches claims in commit messages or subagent reports before push or PR creation. Catches missing files, wrong line counts, and other commit-log accidents.
Ships in collaboration-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Before:
git push of a feature branch (especially after subagent return)gh pr creategh pr merge (final sanity)--force-with-lease) of a rebased branchSkip when: pushing a single trivial commit you authored line-by-line in the current session and didn't amend.
For the HEAD commit (or all commits on the branch since base), extract concrete claims:
create mode 100644 Y in the --summary outputdelete mode 100644 Z in the --summary outputrename dir/{A => B} (NN%) in the --summary outputgit show --stat --summary HEAD # for single commit
git diff --stat --summary origin/main...HEAD # for branch cumulative
git log --oneline origin/main..HEAD # for commit count
git diff takes three dots (origin/main...HEAD, diff against the merge base — otherwise
commits landed on origin/main since the branch forked also show up in the stat);
git log --oneline keeps two dots (origin/main..HEAD, commits reachable from HEAD but not
from origin/main).
Plain --stat only prints path | N +- per file; the create mode / delete mode /
rename A => B (NN%) lines only appear with --summary added.
For each concrete claim, grep the stat output. If the claim mentions a path that doesn't appear in the stat, that's a discrepancy — investigate before push.
| Symptom in stat | Likely cause | Recovery |
|---|---|---|
Total LOC far off the claim (e.g. +50/-3 vs "1-line fix") | git commit --amend or a rebase squashed the wrong content | Inspect git show on the commit; re-amend or split it |
File count doesn't match (0 files changed vs "refactored X module") | A worktree wipe lost commits before push | Restore from reflog (git reflog | grep <SHA>); re-dispatch if truly unrecoverable |
A named file (e.g. Foo.swift:42) is missing from the stat | Subagent's report claimed work that never got committed | Cherry-pick from a sibling branch, or re-apply the edit manually |
git log --oneline shows a different commit count than expected | Unintended squash, or a force-push from another branch overwrote this branch's commits (the "push wrong ref" footgun) | Re-dispatch the subagent with explicit recovery instructions |
"Commit log claims work, diff doesn't show it": this class of mistake recurs when (a) git commit --amend after partial revert loses hunks but keeps the original message, (b) force-push from a stale branch overwrites newer commits, (c) subagent returns a structured "I committed X" report but the commits never made it to the branch ref due to worktree wipe before push. Each failure mode is caught by the same single check: git show --stat --summary HEAD vs. the commit body. Before git push origin <local-ref>:<branch>, also confirm that the local ref holds the feature commits (see the wrong-ref anti-pattern below); recovering from a wrong-ref push takes a force-push from reflog.
git push origin worktree-agent-X:feat/Y pushes worktree-agent-X's HEAD to remote feat/Y. If worktree-agent-X doesn't have the commits (because they were committed to a different local branch by the subagent), remote feat/Y gets reset to whatever worktree-agent-X is at — usually main SHA.This skill starts after commits exist; it does not prescribe commit granularity. It is the POST-commit verification step — confirms the commits that survived actually contain what the message claims.
Rewriting a branch into cleaner commits (re-slicing, squashing fix-ups) must not change the end result: before the rewrite, save git update-ref refs/backup/<branch> HEAD; after it, git rev-parse refs/backup/<branch>^{tree} HEAD^{tree} must print the same tree twice (git diff refs/backup/<branch> HEAD is empty); only then push with --force-with-lease, never a bare --force.
The four symptom patterns are in the Step 3 table above — those are the cheap signals to scan for. Don't deep-read diffs as part of this skill — that's Code Reviewer's job. Just confirm the SHAPE matches the claims.
A verification/acceptance report's own summary numbers need the same check. This failure mode recurs often enough to warrant its own check: a report's headline count ("N items verified", "M files changed") doesn't match its own itemized table below it. Before trusting or forwarding such a report, re-count its table rows yourself and compare against the summary line it prints — don't take the summary number on faith just because it's inside a "verification" document.
Subagent returns: "3 commits, 11 files, +265/-272 LOC, all 7 wiring tests pass"
Leader runs:
git log --oneline origin/main..HEAD # should show 3 commits
git diff --stat origin/main...HEAD # should show ~11 files, ±540 line tags
If git log shows 1 commit (subagent squashed without saying) → OK if intentional
If git log shows 0 commits (commits lost to worktree wipe) → STOP, recover, re-push
If git diff --stat shows different file count → investigate
github-contribution-workflow — routes diff-vs-commit verification here before push/PR; that skill owns the gh CLI mechanics, this one owns the post-commit sanity check.references/official-docs.md.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub wei18/apple-dev-skills --plugin collaboration-skills12 skills in this plugin
/agent-impl-notes-logKeep a running impl-notes file next to the phase meeting log while a subagent executes a task, recording design decisions, intentional deviations from spec, tradeoffs, and open questions as they happen rather than after the fact. Use at the start of any non-trivial subagent dispatch (multi-file change, ambiguous spec, new dependency or module, refactor), when ambiguity is hit mid-task, or before deviating from spec. Not the post-hoc meeting log (session-to-meeting-log); the two coexist./backlog-routing-by-topicRoute a stray idea that surfaces mid-task to the §Backlog of the right living doc in a spec-phase-orchestration repo (design.md, foundations.md, plan.md, methodology.md, or today's meeting log) as a single line, without derailing the current work. Use when a not-now-but-don't-forget idea comes up, when tidying a meeting log's parking-lot items, or when asked where an idea should go. Not for decisions that must be acted on now (those belong in the body of plan.md)./claude-skill-plugin-packagingPackage Claude Code skills as a plugin plus marketplace and install them into other repos — globally, pinned per project via committed settings, or as a skills-dir plugin. Use when sharing skills across repos, wiring an existing skill plugin into a project, choosing flat project skills versus a plugin, aggregating other people's skill repos by reference, or when a submodule or nested folder of skills is not being discovered. Does not cover PR/issue mechanics (github-contribution-workflow) or how to write the skill itself (skill-authoring-patterns).Other plugins' skills for the same job