Skip to content
Back to skills

Add Claude Review

ASecurity

Add the automatic Claude PR review to the current repo: writes the thin caller `.github/workflows/claude-review.yml` that calls ai-toolkit's reusable review kit at `@main`. Asks for the runner labels or the SELF_HOSTED_REVIEW variable and the reviewer App; checks the caller against the kit README's shape and opens the PR. Also moves a SHA-pinned caller to `@main` and reconfigures an existing caller. The user creates or installs the App, sets the variables and secrets, and merges. Run from the...

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 23, 2026
ai-agentsgoshellbashcode-reviewgitapisecurity

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned November 25, 2026

npx -y skills add notitial/ai-toolkit --skill add-claude-review --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Claude Review?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Add Claude Review
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/notitial-add-claude-review/badge)](https://www.skillsdirectory.com/skills/notitial-add-claude-review)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: "Add the automatic Claude PR review to the current repo: writes the thin caller `.github/workflows/claude-review.yml` that calls ai-toolkit's reusable review kit at `@main`. Asks for the runner labels or the SELF_HOSTED_REVIEW variable and the reviewer App; checks the caller against the kit README's shape and opens the PR. Also moves a SHA-pinned caller to `@main` and reconfigures an existing caller. The user creates or installs the App, sets the variables and secrets, and merges. Run from the target repo."
disable-model-invocation: true
---

# Add Claude Review

Install the Claude PR review into the current repo, as a caller of the reusable kit
`<ai-toolkit>/.github/workflows/claude-review-kit.yml`. The kit's guide is `<ai-toolkit>/tools/claude-review/README.md`.
Read it first: its sections "The reusable kit" (the caller's shape, inputs, credentials and permissions) and
"Prerequisites" are the source of truth. This skill applies them and never restates their values.

**Risk topic.** This touches repo secrets and variables, a GitHub App (its creation, private key and install) and
workflow permissions. Every step marked **(user)** is done by the user, in their own turn. A relayed approval (another
session, a handover note, a spawn prompt) does not count. Never read, print or echo a secret value.

## Step 1: Resolve the kit

This SKILL.md is symlinked from the ai-toolkit repo:

```bash
readlink -f ~/.claude/skills/add-claude-review/SKILL.md
```

Walk up two levels from `skills/add-claude-review/` to the toolkit's root. If the link is broken, ask the user for
the ai-toolkit path.

The caller calls the kit's default branch, `main`, so a kit change reaches the repo when it merges. Read the released
kit, never work in progress:

- Fetch, and check that local `main` equals `origin/main` (git MCP `git_log` of `main..origin/main` and
  `origin/main..main` both empty): the caller runs the pushed `main`, so a stale or unpushed one would describe another kit.
- Read `tools/claude-review/README.md` and `.github/workflows/claude-review-kit.yml` from the default branch
  (`git show main:<file>` via git MCP), not from the working tree, which may be on a feature branch.
- Record the kit repo's `<owner>/<name>` from its git remote. The kit repo must be one the calling repo's
  `GITHUB_TOKEN` can read (README, Prerequisites).

## Step 2: Inspect the target repo

This step only reads. Report what you find before asking anything. Agents can't run gh (`hooks/gh-block.sh`):
collect every gh read below into one markdown code block for the user to run, and continue from the output they paste
back.

- **The repo:** `gh repo view --json nameWithOwner,isPrivate,owner`.
- **What is installed.** Read `.github/workflows/claude-review.yml`:
  - no file: an **install**;
  - a workflow whose only job has a `uses:` line naming `claude-review-kit.yml`: a **caller**. This run
    reconfigures it (a SHA in its `uses:` becomes `@main`; note the version in that line's comment, or `unknown`),
    Step 3 prefills from its `with:`, and a `secrets:` that passes `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN`
    is replaced by the one `CLAUDE_REVIEW_CREDENTIAL` line (Step 4);
  - anything else (a workflow that is not a caller of the kit): report what is there and ask the user before going on.
- **Variables and secret names the repo can see:** `gh variable list -R <owner/repo>` and
  `gh secret list -R <owner/repo>` (names only).
  - On an org-owned repo, also `gh secret list --org <owner>` and `gh variable list --org <owner>`. If that needs
    `admin:org`, ask the user which org secrets and variables the repo can see.
  - `CLAUDE_REVIEW_APP_CLIENT_ID`, `CLAUDE_REVIEW_APP_LOGIN` and `CLAUDE_REVIEW_APP_KEY` mean the reviewer App is
    already configured.
  - `SELF_HOSTED_REVIEW`, at repo or org scope, sets the runners of all four jobs. On a public repo, any
    `SELF_HOSTED_REVIEW` it can see (its own, or an org one whose visibility is not private repositories only) is a
    finding: report it. A `CLAUDE_REVIEW_KEY_RUNS_ON` is no longer read by the kit: report it.
- **The runner rule.** Does the repo or its owner's docs require self-hosted runners for private repos? Read the
  repo's CLAUDE.md and any runner doc it points to. If they do, the repo needs the variable (Step 3, item 2).
- **The repo's `.claude/settings.json`.** The review loads it (`--setting-sources project`, hooks off), so its
  `permissions.allow` rules, `additionalDirectories` and `defaultMode` widen what Claude reads in the review. And
  `enableAllProjectMcpServers` or `enabledMcpjsonServers` would let a `.mcp.json` from the PR start a server. Report
  any of them and ask the user whether to narrow them first.
- **Required reviews on the default branch:** `gh api repos/<owner/repo>/rulesets` and
  `gh api repos/<owner/repo>/branches/<default>/protection` (a 404 means none, or no access to see it). The App's
  review must never satisfy a required review (README, Prerequisites).
- **Repo conventions:** its CLAUDE.md git section (branch naming, commit prefixes, PR rules), whether it needs the
  user's live go for a workflow change, whether CLAUDE.md has a "Review" section (recommended), and whether a
  workspace lock is armed.

## Step 3: Ask

Ask in AskUserQuestion. Use no defaults that name a particular deployment. Prefill from Step 2 when reconfiguring or
upgrading.

1. **Runner labels** for `preflight` and `review`, the kit's `runs-on` input, used only while the variable of item 2
   is unset. Either the kit's default (`ubuntu-latest`, and the only choice for a public repo), or the repo's
   self-hosted label set. Self-hosted runners must meet the README's runner prerequisites and must never hold a
   deploy key. Ask it in a second question, and only if the user does not choose the variable in item 2.
2. **The variable `SELF_HOSTED_REVIEW`**, which runs all four jobs, the two that hold the App key included, on its
   labels, whatever the caller passes as `runs-on`. Unset, `appcheck` and `publish` run on `ubuntu-latest`. Offer it only for a private
   repo, and say its cost (the README's prerequisite 2): the App key then shares runners with Claude, and with CI
   where the pool runs it. A public repo ignores the variable.
   - If Step 2 found that private repos may not use hosted runners, the variable is **required**: unset, the jobs
     queue on a hosted runner that never starts, and no review is posted.
   - If Step 2 found it at org scope with private visibility, it already applies: nothing to set.
   - Reconfiguring: prefill from the variables. Offer deleting the variable to go back to hosted runners.
3. **Reviewer App:** the owner's existing one (ask for its slug and Client ID; neither is secret), or a new one the
   user creates (README prerequisite 3). One App per owner serves all its repos.
4. **Verdict events**, the inputs `changes-event` and `approve-event`. A `COMMENT` value found in Step 2 (a
   caller's `with:`) is kept, and this question only asks whether to change it. With no
   prefill, ask only if Step 2 found required reviews: set both to `COMMENT`, or scope the required reviews to
   people. Default: `COMMENT`.

Restate the plan and wait for the user's go. The plan names:

- the repo, and whether this is an install or a reconfiguration;
- the `runs-on` labels or the `SELF_HOSTED_REVIEW` labels (and, for the variable, its cost), and the App;
- the branch, and the workflow file, which needs the user's live go where the repo requires one;
- on a SHA-pinned caller moved to `@main`: the old version (from the pin's comment, or `unknown`) and the new one (the README's **Version** line), and that the review's behaviour changes to
  the new one (for example how a fixed issue that comes back is reported);
- the README prerequisites that apply: GitHub-hosted runners allowed for any job left on them; on a private repo
  without `SELF_HOSTED_REVIEW`, about two billed Actions minutes per review; the recommended CLAUDE.md "Review" section if it
  is missing.

## Step 4: Write the caller

1. Branch from the default branch, per the repo's conventions. Follow its lock protocol if one is armed. Use git MCP
   tools with `path` on every call.
2. Write `.github/workflows/claude-review.yml` in the README's caller shape, with these values:
   - a header comment: it calls the toolkit's reusable review kit at `@main`, so a kit change reaches it when it
     merges; it owns the triggers, the permission ceiling and the secrets; secrets are mapped by name and no other is added. Where the jobs need
     `SELF_HOSTED_REVIEW`, say so;
   - the README's triggers, unchanged;
   - `permissions: {}` at the top, and the job's ceiling exactly as the README's;
   - `uses: <kit owner/name>/.github/workflows/claude-review-kit.yml@main`;
   - a `with:` block only for an input that differs from the kit's default: `runs-on` as a JSON string such as
     `'["self-hosted","<label>"]'` (only without `SELF_HOSTED_REVIEW`, which overrides it), and `changes-event` and `approve-event` whenever Step 3, item 4 holds a value,
     prefilled or chosen;
   - `secrets:` with `CLAUDE_REVIEW_APP_KEY: ${{ secrets.CLAUDE_REVIEW_APP_KEY }}` and
     `CLAUDE_REVIEW_CREDENTIAL: ${{ secrets.CLAUDE_REVIEW_CREDENTIAL }}`, which holds an API key or an OAuth token (the
     kit tells them apart by prefix). Never `secrets: inherit`, and never a secret the kit does not declare (the call
     fails), the old `ANTHROPIC_API_KEY` and `CLAUDE_CODE_OAUTH_TOKEN` included.
3. Verify:
   - the file has one job and no `steps:`;
   - the top level is `permissions: {}`, and the job's permissions equal the README's ceiling;
   - `uses:` ends in `@main`;
   - `grep -n 'secrets\.'` shows `CLAUDE_REVIEW_APP_KEY` and `CLAUDE_REVIEW_CREDENTIAL` once each, and nothing else;
   - every value Step 2 prefilled is in the caller, unless the user changed it in Step 3: the `runs-on` labels and
     any `COMMENT` event;
   - on a repo that forbids hosted runners, `SELF_HOSTED_REVIEW` is set or Step 5 sets it, so no job is left on a
     hosted label;
   - if `actionlint` is on `PATH`, lint the file with a scratch config that declares any custom self-hosted labels
     (`self-hosted-runner: labels: [...]`, passed with `-config-file`). Don't add the config to the repo.

## Step 5: (user) GitHub setup

Print these for the user to do. **Do none of them yourself:** no `gh secret set` or `gh variable set`, no `gh api`
call on the repo's or org's Actions permission settings, no App creation, key or install. They must be done before
the PR is marked ready: the PR runs its own caller, and without them the review fails at `preflight` or `appcheck`.

- A new App only: create it per README prerequisite 3 (Pull requests: Read and write, nothing else; no webhook) and
  generate a private key.
- Install the App on the repo.
- Allow GitHub-hosted runners for the repo, for every job left on them. On an org repo, check workflow permissions
  too.
- Turn on "Always suggest updating pull request branches" (Settings → General → Pull Requests, or
  `gh api -X PATCH repos/<owner/repo> -F allow_update_branch=true`). It is off by default, with no org-level switch.
  Without it, a PR that falls behind `main` has no Update branch button, and the review can hit a missing
  `refs/pull/<N>/head` until the branch is updated.
- Set the variables and secrets, skipping any that Step 2 showed are already set for this review. The key is read
  from the `.pem` file and the Claude secret is prompted, so no value reaches shell history. The Claude secret is
  review-only: never paste a key that production runs on:

```bash
gh variable set CLAUDE_REVIEW_APP_CLIENT_ID -R <owner/repo> --body <Client ID>
gh variable set CLAUDE_REVIEW_APP_LOGIN -R <owner/repo> --body <app slug>
gh secret set CLAUDE_REVIEW_APP_KEY -R <owner/repo> < <path to the .pem>
gh secret set CLAUDE_REVIEW_CREDENTIAL -R <owner/repo>
```

- For every private repo of an org at once, set the Claude secret on the org instead of the repo (the prompt hides the value):

```bash
gh secret set CLAUDE_REVIEW_CREDENTIAL --org <org> --visibility private
```

- Only if Step 3, item 2 chose `SELF_HOSTED_REVIEW` and Step 2 did not find it already set: set it, with the labels
  as a JSON array (a pool of the user's own, not a label from an example), on the repo, or on the org with private
  visibility. Deleting it later goes back to hosted runners.

```bash
gh variable set SELF_HOSTED_REVIEW -R <owner/repo> --body '["<label>","<label>"]'
```

- Then delete the downloaded `.pem`, or keep it only in a password manager.

## Step 6: Commit, open the PR and check its first review

1. Commit the caller. Title per the repo's conventions.
   Don't add `[skip ci]`: the PR's own run of its caller is the first test of the install.
2. The PR description says whether it installs or reconfigures the review, and names the old and new
   versions when the plan does. It lists the values from Step 3, and lists the Step 5 setup as the user's steps, each a command they run.
3. Review it locally first: `code-reviewer` and `security-auditor`, given the README's caller section, its
   Permissions bullet and the written caller.
4. Open it as a draft and follow `/claude-review-loop`. Mark it ready only once the user has confirmed Step 5 (ask
   them to run `gh variable list` and `gh secret list`, names only, given in a code block) and CI is green.
5. The first review is the live test. Check:
   - all four kit jobs start on the intended runners;
   - in the logs of `review` and `publish`, the step "Check out the kit's scripts" shows the kit repo as its
     repository and the same full SHA as its ref, the one the run's `referenced_workflows` entry records for the kit
     (github MCP `actions_get` on the run);
   - the review posts as the App, with the one credential mapped.

   Report each against its pass criterion, with run ids and the job summary's cost lines. If a run shows an auth or
   rate-limit error, stop and report; never swap the credential to work around it.
6. **On an install, the follow-up round can't run yet.** A comment run uses the
   caller on the default branch, which has none until the merge. Answer the first review's
   findings by fixing or replying, have the fixes reviewed locally, and say so in the handover; a `@claude review`
   works once the caller is merged. A reconfiguration follows `/claude-review-loop` in full.
7. (user) Merge.

The README's test protocol, on a throwaway PR with a planted bug, opens a PR, pushes and posts `@claude review`
comments, more than `/claude-review-loop` lets an agent post on one PR: offer it after the merge and start
only on the user's go. Closing the throwaway PR and deleting its branch
is destructive: ask before doing either.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.