К основному содержанию
промпт CX Codex GP ChatGPT

opencode-review-protocol — промпт для Claude Code: обзор PR

Промпт opencode-review-protocol для Claude Code задаёт протокол ревью кода в pull request. Агент оставляет замечания к строкам, публикует сводку и записывает вердикт для CI.

Apache-2.0 ★ 423 обновлён 2026-11-16

Установить в Claude Code · Вручную: положить файлы Все способы и платформы ↓
.claude/commands/opencode-review-protocol.md
Открыть на GitHub

Что делает opencode-review-protocol

Промпт задаёт порядок проверки pull request: для каждой найденной проблемы агент публикует inline-комментарий к конкретной строке, затем обновляет сводку и записывает pass или fail в ./.opencode-verdict.txt. Уровни Critical, High и Medium приводят к fail; Low или отсутствие замечаний — к pass.

Общий протокол workflow дополняет заголовком для конкретного вида проверки. Он требует использовать gh для комментариев GitHub, а сводку временно хранить в ./.opencode-summary.md и удалить после публикации. Если комментарий-сводка уже есть, агент редактирует его, а не создаёт второй.

Для работы нужны gh, переменные GITHUB_REPOSITORY, PR_NUMBER и HEAD_SHA, а также доступный скилл, который выполняет анализ. Промпт запрещает менять файлы репозитория и обращаться к внешним URL; единственный постоянный файл для записи — ./.opencode-verdict.txt.

Какие задачи решает

  • оставить замечание на точной строке pull request
  • свести замечания ревью в один комментарий
  • записать вердикт проверки для CI
  • не допустить повторных комментариев после новых push
  • остановить ревью с ошибкой, если скилл недоступен

Примеры запросов агенту

  • Проведи ревью pull request и оставь комментарии к найденным проблемам.
  • Проверь изменения этим протоколом и обнови комментарий-сводку.
  • Если скилл ревью завершится с ошибкой, запиши вердикт fail.

Как установить opencode-review-protocol

Вручную: положить файлы

.claude/commands/opencode-review-protocol.md

Вопросы об opencode-review-protocol

Как установить opencode-review-protocol в Claude Code?

Сохраните файл промпта по пути .claude/commands/opencode-review-protocol.md.

Что делает opencode-review-protocol?

Задаёт workflow для ревью pull request: комментарии к строкам, сводка и вердикт pass или fail.

Что нужно для работы opencode-review-protocol?

Нужны gh, переменные GITHUB_REPOSITORY, PR_NUMBER и HEAD_SHA, а также доступный скилл для анализа изменений.

Исходный текст

opencode-review-protocol.md · Apache-2.0
<!-- Shared review protocol. This file is never sent to the model on its
     own: .github/workflows/opencode-review-reusable.yml appends it after a
     per-kind header (.github/prompts/opencode-review-<kind>.md). Placeholder
     tokens in angle brackets — <KIND>, <KIND_HYPHEN>, <SKILL_ID>,
     <SKILL_PATH>, <FINDING_DESC>, <SEVERITY_NOTE>, <INLINE_SCOPE_LIMIT>,
     <SUMMARY_HEADING>, <NO_FALLBACK> — are defined in that header's
     "Protocol parameters" section; substitute them everywhere below. -->

## Step 3 — Translate skill output into inline comments

For each <FINDING_DESC> the skill surfaces, post one inline review comment on the exact line:

```
gh api repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/comments \
  -F commit_id="${HEAD_SHA}" \
  -f path=<file> \
  -F line=<n> \
  -F side=RIGHT \
  -f body=<body>
```

Inline comment body format:

```
**[Severity] Category:** one-line description of the issue.

Why this matters: <one sentence>.
Suggested fix: <one sentence or a 2–3 line code snippet>.
```

<SEVERITY_NOTE> One finding per inline comment. If the same issue appears on multiple lines, pick the clearest occurrence and reference the others in its body. <INLINE_SCOPE_LIMIT>

## Step 4 — Write the verdict

After posting inline comments and before composing the summary, write the verdict to `./.opencode-verdict.txt` in the workspace root:

- `fail` if any posted finding has severity `Critical`, `High`, or `Medium`.
- `pass` if posted findings are only `Low`, or none.

Single word, no other content. This file is the ONLY persistent file you may write.

## Step 5 — Compose and post the summary

Compose the top-level summary body with this shape:

```
<SUMMARY_HEADING>

<one short paragraph summarising what the skill analysed and the overall posture>

<bulleted list of inline findings by severity, or "No issues found.">

**<KIND>:** ✅ no issues found
<!-- opencode-verdict: pass -->
```

The final two lines are the load-bearing verdict signal:

- A marker line starting `**<KIND>:** ...` — use `✅ no issues found` when you posted zero `Critical`/`High`/`Medium` findings, or `⚠️ N issue(s) flagged inline` (exact count) otherwise.
- Immediately after it, the machine-readable HTML comment `<!-- opencode-verdict: pass -->` or `<!-- opencode-verdict: fail -->`. It renders invisibly on GitHub; CI reads it as the authoritative verdict. The marker value must match the verdict file.

### Posting the summary

Use the discover-then-edit pattern so the PR ends up with exactly one <KIND_HYPHEN> summary comment, not one per push:

1. Look up any prior summary written by this workflow:
   ```
   gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \
     --jq 'map(select(.user.login == "github-actions[bot]"
                       and (.body | contains("**<KIND>:**"))))
           | sort_by(.created_at)
           | last
           | .id // empty'
   ```
2. If that returns a numeric id, **edit** the existing comment in place:
   ```
   gh api -X PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/<id>" -f body="$(cat ./.opencode-summary.md)"
   ```
3. Otherwise, **create** a fresh comment:
   ```
   gh pr comment ${PR_NUMBER} --body-file ./.opencode-summary.md
   ```

Stage the summary body in a workspace-local temp file `./.opencode-summary.md` so it survives shell quoting, and **delete that temp file after posting**. Never post a second summary in the same run — if PATCH fails, surface the error rather than falling back to `gh pr comment`.

The posted body must be the file's **content** — `$(cat ./.opencode-summary.md)` or `--body-file` — never a file reference. An `@@/.opencode-summary.md` mention, a bare path, or any other reference syntax is posted as literal text and the PR gets a placeholder instead of its summary and verdict marker (observed on PR #337). Before finishing, re-read the posted comment's body and confirm it starts with the `**<KIND>:**` header line; if it does not, surface the error and stop — do not leave a placeholder.

## Step 6 — Failure mode: skill unavailable or errors mid-run

If the `<SKILL_ID>` skill cannot be invoked or errors out mid-run — examples: the `skill` tool reports it is not installed, `<SKILL_PATH>` cannot be located, or the skill exits with an error you cannot work around — do the following and stop:

1. Write `fail` to `./.opencode-verdict.txt`.
2. Post-or-update the summary comment (using the discover-then-edit pattern above) naming the failure, e.g. `**<KIND>:** ⚠️ <SKILL_ID> skill unavailable or failed. Details: <short description of what failed>.` followed by `<!-- opencode-verdict: fail -->`.
3. Do **NOT** fall back to <NO_FALLBACK>. The review must be loudly broken, not silently degraded to ad-hoc heuristics.

## Constraints

- Do not modify any files in the repo. The only persistent file you may write is `./.opencode-verdict.txt`; the summary body may be staged in `./.opencode-summary.md` and must be deleted after posting.
- Stage every scratch file — a patch dump, a fetched fragment, anything you write in order to read it back — under the workspace root (for example `./.review-scratch.txt`), never under `/tmp` or any path outside the repository: the sandbox auto-rejects reads of external directories, which kills the review mid-run (observed twice on PR #761, `external_directory (/tmp/*)` auto-reject). Delete the scratch file when you are done with it.
- Do not fetch external URLs. Shell use is limited to the `gh pr ...` and `gh api repos/...` invocations described above and the verdict/summary file handling.
- Keep inline comments short and high-signal. If you are unsure whether something is a real issue, prefer not posting — false positives erode trust in this check faster than missed findings.

© relatedb · Apache-2.0 · relatedb/relate

Похожие промпты

Все промпты по теме «Код-ревью и рефакторинг» →
ship-ci-review-loop Community Команда ship-ci-review-loop запускает цикл отслеживания CI и комментариев к пулл-реквесту. Она ждёт прохождения тестов, выгружает замечания ревьюеров и заставляет агента закрыть каждую ветку перед слиянием. CX Codex +1 ★ 2 003звёзд репо pr-review-triage Cobus Greyling Скилл pr-review-triage следит за открытыми PR: проверяет CI, конфликты, зависшие ревью и комментарии без ответа, а потом отдаёт приоритетный список блокеров. CX Codex +1 ★ 11 819звёзд репо opendirector-review ThinkFlowLab Скилл opendirector-review для Claude Code проверяет коммит пулл-реквеста и выдаёт вердикт PASS, WITHHOLD или REQUEST CHANGES. Запускается при запросе ревью ветки перед слиянием. CX Codex +1 ★ 413звёзд репо github openclaw Скилл для работы с GitHub через CLI на Claude Code: просмотр и создание PR, управление issues, проверка статуса CI. Доступен также на Codex, Cursor, GitHub Copilot, Gemini CLI и OpenCode. CX Codex +1 6 100установок om-auto-fix-pr open-mercato Скилл om-auto-fix-pr доводит открытый пулл-реквест до готовности к мержу: подтягивает базовую ветку, чинит CI, прогоняет ревью и UI-тесты. Сам PR не мержит, передавая результат следующему шагу. CX Codex +1 4 500установок shepherd chrisbanes Скилл shepherd отслеживает открытые pull request и merge request, разбирает замечания ревьюеров и падения CI, а также готовит правки к пушу. CX Codex +1 1 400установок

Из того же набора18

Весь набор →
stellar-nightshift Промпт stellar-nightshift для Claude Code исправляет только замечания из заданного кластера и применяет указанные для них решения. Работает с кодом в каталогах crate. CX Codex +1 ★ 423звёзд репо opencode-review-rust Промпт opencode-review-rust для Claude Code запускает автоматическое ревью Rust-изменений в pull request. Сначала проверяет список изменённых файлов, затем передаёт полный diff скиллу rust-reviewer. CX Codex +1 ★ 423звёзд репо opencode-review-security Промпт opencode-review-security для Claude Code проверяет pull request в Rust-репозитории на риски безопасности. Для PR без изменений кода он записывает вердикт pass и публикует сводный комментарий. CX Codex +1 ★ 423звёзд репо opencode-review-stellar Промпт opencode-review-stellar для Claude Code запускает строгую проверку сопровождаемости и качества кода в pull request Rust-проекта. Он собирает выводы субагентов, но не публикует комментарии и не выносит вердикт. CX Codex +1 ★ 423звёзд репо release-notes Промпт release-notes для Claude Code готовит заметки к выпуску relate по журналу изменений и истории коммитов. Запускается для помеченного тега релиза. CX Codex +1 ★ 423звёзд репо security-review Скилл security-review для Claude Code проверяет изменения кода с точки зрения безопасности и предлагает способы устранить риски. CX Codex +1 ★ 423звёзд репо neo4j-query-workload-skill Скилл neo4j-query-workload-skill для Claude Code наращивает набор запросов к графовой базе по одному требованию за раунд. Он проверяет новые запросы на данных и выявляет регрессии в уже проверенной нагрузке. CX Codex +1 ★ 423звёзд репо relate Помогает подключать в JVM-приложения локальную графовую базу Relate и выполнять запросы на Cypher. Срабатывает при работе с Java- и Kotlin-кодом, который создаёт или использует такую базу. CX Codex +1 ★ 423звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой