Skip to content
Development
Command

/fix

Act on the findings a review left on a PR — takes or declines each by severity, edits code at pwd to match the project, 1 commit, replies once pushed.

From plugin
open-pr
195 skills5 commands
Install
$ npx -y skills add TOMOSIA-VIETNAM/open-pr --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/fix

Context preview

What this command does when you run it.

Act on the findings a review left on a PR — takes or declines each by severity, edits code at pwd to match the project, 1 commit, replies once pushed.

Command definition

fix.md
argument-hint: "[PR URL] [content]"
description: Act on the findings a review left on a PR — takes or declines each by severity, edits code at pwd to match the project, 1 commit, replies once pushed.

> **CRITICAL:** `Read` `"${CLAUDE_PLUGIN_ROOT}"/core/guardrails.md` FIRST — shared rules, not repeated > here. On top of those: > - This command EDITS REAL CODE at pwd, then commits/pushes — higher risk than the > read-only `/open-pr:review`. Step 1 MUST run BEFORE ANY other action and STOP IMMEDIATELY on > failure. FORBIDDEN: "helpfully" fixing the remote/branch just to pass it. > - FORBIDDEN: `git commit --amend`, `git push --force`/`--force-with-lease`, `git add -A`/`git add .`, > `git branch -D`, `git reset --hard`, resolving a PR thread, editing/committing when the PR's branch > is protected or the remote/branch doesn't match the PR, deciding alone on a 🔵/📝 finding, checking > out the PR/MR, `git worktree add`/`remove`, close/merge/reopen, creating a > review/draft-note batch (this command only replies; posting is `review.md`'s job). `cd`/`find` are > allowed ONLY to self-locate the project directory (Step 1a), and only once `git remote` proves the > match — never by directory name. This bullet + the one above are the SOLE enforcement layer — no > `allowed-tools` backs them (deliberate).

Step 0 — Target

`Read` `"${CLAUDE_PLUGIN_ROOT}"/core/pr-target.md`, taking its no-store branch (§2): this command never persists `git_remote_type`, it uses `<vendor_guess>` as-is. `Usage:` block:

❌ Error: No PR URL provided.
Usage: /open-pr:fix <PR URL> [content]
Example (GitHub): /open-pr:fix https://github.com/org/repo/pull/123
Example (GitLab): /open-pr:fix https://gitlab.com/org/repo/-/merge_requests/123
Example with instructions: /open-pr:fix https://github.com/org/repo/pull/123 only fix the security part

Free-form text outside the URL narrows this run's scope (Step 3 item 3).

No URL → take the PR THIS session already establishes (its review ran here, the user named it, pwd is its worktree), say which in 1 short sentence, continue. NOT exactly 1 ⇒ print the `Usage:` block. FORBIDDEN: guessing past it.

Context

Fetch:

| `V§` entry | label | |---|---| | "Fetch PR basic info", fields `number,headRefName,baseRefName` | PR info | | "Fetch PR review comments (LINE-level findings)" | Comments | | "Fetch PR reviews (FILE-level findings + review_id)" | Reviews | | "Fetch account running the command" | Account running this command | | "Fetch review threads (id + isResolved + comment ids)" | Review threads |

Plus 2 plain `git` commands, identical on any vendor so not in a vendor file — label "Git remote + current branch": `git remote -v` && `git branch --show-current`.

A vendor whose "Fetch PR reviews" entry has no equivalent returns nothing here; Step 3 item 2 then does not apply, while LINE-level handling continues normally.

`core/pr-target.md` §4-5 give `<repo>` and the empty-"PR info" stop.

Step 1 — Verify a safe context (STOP IMMEDIATELY on failure)

**1a.** `Read` `"${CLAUDE_PLUGIN_ROOT}"/core/locate-repo.md` for `<repo_dir>`, then `cd` into it — this command EDITS that repo's files, so unlike `review.md` it works from inside. Everything below runs there, `notebooks/review/<repo>/` included — `<repo_dir>` = a `review` worktree (`notebooks/review/*/worktrees/pr<pull_number>-*`) ⇒ that directory is at `../../`.

**1b. Check BOTH at the 1a directory.** Either failing → print that error, STOP COMPLETELY. FORBIDDEN: fixing the branch yourself, touching any file, proceeding to Step 2.

1. the current branch matches `headRefName` EXACTLY, || `<repo_dir>` = the 1a worktree (DETACHED, already at THIS PR's head). `<current branch>` = `detached` when none. Mismatch:

   ❌ Current branch (`<current branch>`) doesn't match the PR's branch (`<headRefName>`). Check
      out the correct branch `<headRefName>` and call this again.

2. `headRefName` is NOT one of `main`, `master`, `production`, `prod`, `staging`, `stg`, `release`, `rls`, `dev`, `development`, `develop` (case-insensitive, EXACT match, not substring). Read off the PR ⇒ holds detached too, and a PR may itself target a protected branch:

   ❌ The PR's branch (`<headRefName>`) is a protected branch — this command does NOT commit to
      one. Move the change onto a dedicated feature branch and open the PR from that.

Step 2 — Settings

`Read` `"${CLAUDE_PLUGIN_ROOT}"/core/repo-settings.md`, then `notebooks/review/<repo>/settings.json`. Resolve `chat_language` per that file.

  • `.fix` present → use its values, do NOT ask again
  • absent, or no file at all → `Read` `"${CLAUDE_PLUGIN_ROOT}"/setup/fix-bootstrap.md`, follow it

Step 3 — Identify findings to handle

2 KINDS, differing in data source and in how "still open" is decided:

`Read` `"${CLAUDE_PLUGIN_ROOT}"/core/finding-markers.md` — it defines how both kinds are recognized.

1. **LINE-level** (from "Comments") → drop a finding when EITHER holds: its `id` (databaseId) belongs to a thread in "Review threads" with `isResolved: true`, || that same thread is already handled (`core/finding-markers.md`). That is what stops a duplicate commit/reply while the thread is still unresolved — this command never resolves threads (Step 10). 2. **FILE-level / OVERVIEW-level** (from "Reviews") → an individual bullet has no resolve concept and no readable reply history, so EVERY FILE-level finding in the most recent review is ALWAYS treated as still open and re-handled every run. Accepted limitation: a repeat run after that part is already fixed may add 1 duplicate reply. 3. Free-form instructions present (Step 0) → filter both lists BY MEANING (e.g. "only fix the security part"), no rigid syntax. 4. Both lists empty after filtering → say so in 1 short sentence, STOP CLEANLY.

Step 4 — Read the project's convention

`notebooks/review/<repo>/` absent (repo never reviewed) → skip this Step, fix on ordinary

Read more
Ships withopen-pr

One AI reviewer for GitHub PRs and GitLab MRs. Learns each repo's conventions. Claude Code · Cursor · Codex · Gemini CLI · Antigravity.

Get the whole plugin, auto-invoked
Stats
19
Stars
0
Views
9
Forks
Active
Maintenance
Python
Language
MIT
License
1d ago
Last commit
25d ago
Created

Repo: TOMOSIA-VIETNAM/open-pr