agentleFS
junhjangjunhjang/claude-harness/.claude/skills/review-changes/SKILL.md

review-changes

Skill0 starsChanged 6 months agoMITView on GitHub

Semantic review of every changed file in the current branch's diff vs main. Dispatches /review-doc per changed .md and code-reviewer per changed .rs/.py/.sh/.yaml/.json config. Writes a state artifact tagged with HEAD sha so the pr-create-gate hook will allow `gh pr create` and `gh pr merge`. Use this before opening or merging any PR.

  • Reads credentials
  • Commits and pushes

38 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use explore-codebase, debug-issue and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • srclightSkill

    explore-codebase

    This skill should be used when the user asks to "explore this codebase", "understand this project", "give me an overview", "how does this work", "onboard me", "walk me through the architecture", "map the codebase", or any request to understand a codebase's structure, architecture, or design.

    Also in 4 projects that use this

  • NVIDIASkill

    debug-issue

    Use when the user asks to debug, investigate, or fix a GitHub issue or supplies a repository bug report.

    Also in 4 projects that use this

  • srclightSkill

    refactor-safely

    This skill should be used when the user asks to "refactor", "rename", "move", "change a function signature", "extract a method", "delete unused code", "clean up", or any modification that could break callers or dependents. Provides a pre-change safety checklist using srclight's graph tools to assess blast radius before touching code.

    Also in 4 projects that use this

  • JetBrainsSkill

    fix-bug

    End-to-end bug fix workflow for the Exposed project. Accepts a GitHub issue (#NUMBER), YouTrack issue (EXPOSED-NUMBER), or YouTrack URL (https://youtrack.jetbrains.com/issue/EXPOSED-NUMBER). Fetches the issue, creates a failing reproducer test, commits on a new branch, implements the fix, validates, and opens a PR. Use this skill whenever the user wants to fix a bug from an issue tracker, mentions a EXPOSED issue number, or references a GitHub issue to fix.

    Also in 3 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 3 projects that use this

  • GitHubSkill

    refactor

    Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 37 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    If the branch IS main, refuse with: '/review-changes' is for feature branches.

    line 22
  2. Very specific:

    When ANY file in the diff matches a security-sensitive path, additionally dispatch the security-reviewer agent in parallel to the per-file …

    line 38
  3. Very specific:

    If the diff has NO match, security-reviewer is NOT dispatched (don't pay for review on diffs that have no security surface).

    line 48
  4. Very specific:

    If verdict is PASS, print the gate-allowed line: state artifact written.

    line 135
  5. Very specific:

    If the operator amends the commit (git commit --amend), force-pushes, or rebases — the HEAD sha changes and the state artifact no longer …

    line 139

“Common” is measured: kept by at least 6 in 10 of the 37 edited versions of this file we could read. “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

/review-changes

Semantic per-PR review for the current branch. Operator-triggered; subscription-only (uses Claude Code subagent dispatch). Pairs with pr-create-gate.sh hook which blocks gh pr create and gh pr merge until this skill has run with a non-BLOCK verdict for the current HEAD sha.

When invoked: /review-changes

1. Compute the diff scope

BASE="$(git merge-base origin/main HEAD)"
HEAD_SHA="$(git rev-parse HEAD)"
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
git diff --name-only "$BASE...HEAD"

If the branch IS main, refuse with: '/review-changes' is for feature branches; nothing to review on main.

2. Filter to reviewable file kinds

KindPath patternsReviewer
Markdown docsdocs/**/*.md, .claude/**/*.md, CLAUDE.md, README.md/review-doc <path> (semantic doc review)
Rust source**/*.rscode-reviewer agent against the file's diff
Python source**/*.pycode-reviewer agent against the file's diff
Shell scripts.claude/hooks/**/*.sh, scripts/**/*.shcode-reviewer agent against the file's diff
YAML / JSON configconfig/**/*.yaml, .github/workflows/*.yml, .claude/settings.jsoncode-reviewer agent against the file's diff

Shell scripts under .claude/hooks/ are substantive harness components. Including .sh here closes the gap where hook changes might otherwise land without semantic review.

2a. security-reviewer auto-fan-out

When ANY file in the diff matches a security-sensitive path, additionally dispatch the security-reviewer agent in parallel to the per-file reviewer above. This implements the cross-cutting policy "PR-by-PR review with the third reviewer firing automatically when the diff touches a security-critical surface."

Configure security-sensitive paths in this skill's project config. Example security-sensitive surfaces — replace per your project:

Path patternWhy security-sensitive
Auth / credential subsystemCredential storage, signing logic, key material handling
Safety / correctness gatesPre-action checks, fail-closed paths, circuit breakers
External-input parsing / validationUntrusted input boundaries; deserialization, schema enforcement

If the diff has NO match, security-reviewer is NOT dispatched (don't pay for review on diffs that have no security surface). If the diff has even one matching file, security-reviewer reviews the WHOLE diff — security concerns span the system.

security-reviewer dispatch counts as one additional fan-out slot — concurrency cap stays ≤4 total across all reviewers.

Skip: *.md under scratch/ (gitignored anyway); generated files declared in registries; binary files; vendored third-party scripts. If the filtered list is empty, write an empty-pass state artifact and return — there's nothing to review.

3. Pre-flight cost estimate

For each file, predict the dispatching model:

  • .md: per /review-doc heuristic (Sonnet default; Opus on the safety-critical paths configured in /review-doc).
  • .rs / .py / .sh / .yaml / .json config: Sonnet default for code-reviewer; no Opus override (code-reviewer is uniformly Opus per its current frontmatter — re-evaluate if cost concerns surface).
  • security-reviewer (§2a): counted as one additional Opus dispatch when any security-sensitive path is in the diff (the agent's frontmatter is model: claude-opus-4-7 — see .claude/agents/security-reviewer.md). Roughly 5–15× Sonnet per token; include in the cost estimate before applying the $1.00 cap.

Sum estimate. Refuse if estimate > $1.00 (per-PR cap, smaller than /audit-docs-semantic's $5.00 because PR diffs are typically narrower than full subtrees).

4. Operator confirmation

Show the file count + per-kind breakdown + estimate. Default: ask. Skip with --yes.

5. Bounded fan-out dispatch

Concurrency ≤4 (same as /audit-docs-semantic). For each file:

  • .md → invoke /review-doc <path> skill
  • .rs / .py / .sh / .yaml / .json config → dispatch code-reviewer agent with the file path + the diff slice for that file. For .sh files, the agent reads docs/harness/components/hooks/SPEC.md as its invariant source (stdin schema / exit codes / matcher narrowing / latency budgets).
  • If §2a security-sensitive path matched: in parallel, dispatch security-reviewer agent with the FULL diff (not just matching files) — security concerns span the system. Counts as one slot in the concurrency cap.

Mid-flight cost tracking; abort remaining if cumulative > cap (emit partial artifact with EARLY-TERMINATED marker; verdict defaults to BLOCK so the gate refuses).

6. Aggregate verdict

Per-file verdict ∈ {PASS, CHANGE-REQUEST, BLOCK}. Plus security-reviewer's diff-level verdict (when dispatched per §2a) — uses the same {PASS, CHANGE-REQUEST, BLOCK} domain (the agent's own contract may use the GitHub-PR-review verb REQUEST-CHANGES; normalize to the harness-canonical CHANGE-REQUEST when reading). Aggregate ALL of them:

Per-file + security outcome countsAggregate verdict
any BLOCK OR any EARLY-TERMINATED OR security-reviewer = BLOCKBLOCK
any CHANGE-REQUEST (no BLOCK) OR security-reviewer = CHANGE-REQUESTCHANGE-REQUEST
all PASS (including security-reviewer if it ran)PASS
zero filesPASS (no-op)

7. Write state artifact

var/<env>/review-changes/<head-sha>.json

Where <env> = ${HARNESS_ENV:-dev} and <head-sha> is the full HEAD sha at review time (git rev-parse HEAD). This is keyed by commit identity, not branch name — required for multi-session correctness when two Claude Code sessions share one working tree.

The branch name is preserved in the state JSON's branch field for human readability and audit-log navigation, but the gate's lookup key is the SHA in the filename. A git commit --amend / rebase / new commit changes HEAD sha → state file's filename no longer matches → the gate correctly demands re-review (because the diff content changed).

Schema:

{
  "branch": "feature/foo-bar",
  "head_sha": "abc1234",
  "base_sha": "def5678",
  "reviewed_at": "2026-05-06T09:00:00Z",
  "files_reviewed": 7,
  "verdict": "PASS|CHANGE-REQUEST|BLOCK",
  "blockers": 0,
  "change_requests": 2,
  "nits": 3,
  "ambiguous": 0,
  "per_file": [
    {"path": "docs/harness/components/auth/SPEC.md", "verdict": "CHANGE-REQUEST", "model": "claude-opus-4-7"},
    {"path": "scripts/cron/c1_docs_audit.py", "verdict": "PASS", "model": "claude-opus-4-7"}
  ],
  "security_review": {
    "dispatched": true,
    "trigger_path": "src/auth/lib.rs",
    "verdict": "PASS"
  },
  "early_terminated": false,
  "cumulative_cost_usd": 0.42
}

The security_review block is present iff §2a auto-fan-out fired. dispatched: false (or block omitted) means no security-sensitive path in the diff.

The hook reads head_sha and verdict from this file.

8. Surface to operator

Print: file counts / verdict / cited findings. If verdict is BLOCK or CHANGE-REQUEST, list the per-file BLOCKERs and CHANGE-REQUESTs explicitly so the operator can address them and re-run.

If verdict is PASS, print the gate-allowed line: state artifact written; gh pr create / gh pr merge will now be allowed.

Re-running

If the operator amends the commit (git commit --amend), force-pushes, or rebases — the HEAD sha changes and the state artifact no longer matches. The hook will block again until /review-changes is re-run.

Operator escape valve

This skill is disable-model-invocation: true. Drive steps 1-8 above turn-by-turn through chat (the Edit/Write/Agent tools the chat session uses are not locked; only the slash is). Hotfix bypass: BYPASS_REVIEW_CHANGES=1.

Failure modes (§9)

FailureDetectionMitigation
Skill tool invocation of /review-doc errors mid-flight on one fileTool returns error result for that file in step 5Mark that file's per-file verdict BLOCK; continue remaining files; aggregate to BLOCK per step 6
Agent tool dispatch refuses (permission missing, subagent crash) for one fileTool returns error in step 5Same as above — BLOCK that file, continue, aggregate BLOCK
Operator does not respond to step 4 confirmationNo timeout in chat; the procedure halts indefinitelyOperator-discipline: re-fire the procedure OR resume with explicit "proceed" / --yes analog. No artifact written until confirmation; gate stays blocked safely
Cumulative cost exceeds $1.00 mid-flightMid-flight cost tracker in step 5Abort remaining; write artifact with early_terminated: true and verdict BLOCK per step 6
State JSON write fails (filesystem error, missing parent dir)mkdir -p "$ENV_DIR" succeeds + jq/file-write failsSurface the error to the operator; do NOT pretend success; the gate stays blocked because no artifact exists for HEAD sha

Bypass

For hotfixes or for explicitly accepting CHANGE-REQUEST findings:

BYPASS_REVIEW_CHANGES=1 gh pr create ...

The hook accepts the bypass via either (a) BYPASS_REVIEW_CHANGES=1 in its own environment, OR (b) the same env-var prefix on the command string itself. Both paths log a bypass record to var/<env>/review-changes/bypass.log for retrospective review. Path (b) is required because Claude Code's PreToolUse hook is launched by the harness — not by the user's shell — so a shell-prefix env var on a Bash-tool command never reaches the hook's own env.

Rules

  • Subscription-only. No anthropic SDK calls; no ANTHROPIC_API_KEY reads.
  • Per-file scope. This skill never reviews unchanged files — that is /audit-docs-semantic's territory.
  • Cost cap is mandatory. $1.00 default; configurable via a future config/cron/d5.yaml (deferred until first non-default cap is needed).
  • No auto-block of merge from CI. The local hook is the only gate; CI deterministic checks remain unchanged.
  • No auto-fix. Findings are surfaced; operator decides whether to address before re-running.

Forbidden

  • Reviewing files outside the diff scope.
  • Concurrency > 4.
  • Auto-promoting verdict (operator cannot override the artifact's verdict; they must address findings + re-run).
  • Calling anthropic SDK directly anywhere in this skill or invoked agents.

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.