Communityコーディング&開発github.com

trailofbits/pr-improver

現在のブランチの変更に対して、PRレビューがクリーンになるまで自動レビューと修正のループを実行します。レビューはインストール済みのPRレビュースキル(デフォルト: pr-review-toolkitのreview-pr)によって行われ、変更があったディレクトリにのみ機械的にスコープが制限されます。

pr-improver とは?

このスキル(trailofbits/pr-improver)は、Gitブランチ上の変更に対し、自動レビューと修正のループを実行してPRレビューがクリーンになるまで改善を続けるワークフローです。開発者は「このブランチをクリーンアップして」「PRレビューが通るまで修正して」「変更に対してreview-and-fixを実行して」といった自然言語の指示で利用できます。このスキルは、まず現在のブランチとベースブランチの差分から変更ファイルのディレクトリスコープを自動導出し、そのスコープ内でのみレビューと修正を反復します。ループの実体はプラグイン内の動的ワークフロー(`workflows/improve.js`)であり、レビュアー(デフォルトはpr-review-toolkitのreview-prスキル)、最大ラウンド数(デフォルト5)、プラグインルートなどを引数として渡します。ワークフローはバックグラウンドで動作し、修正が加わるたびに再レビュー、スコープチェックを行い、クリティカル/メジャーな指摘がゼロになるか、予算上限に達するか、収束しない場合に停止します。結果は収束(converged)、上限到達(capped)、エスカレーション(escalation)、停止(halted)のいずれかとして報告され、エスカレーション後はユーザーの判断を入力として再開できます。一度きりのレビューには向かず、直接PRレビュースキルを実行すべきです。

対応✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/trailofbits/skills/tree/main/plugins/code-improver/skills/pr-improver

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

PR Improver

現在のブランチを改善するには、/code-improver:improve を実行します。これは動的ワークフローで、PRレビュアーと修正サブエージェントをブランチの変更に対してループさせ、レビューがクリティカル/メジャーな指摘をゼロにするまで繰り返します。ループ、その台帳、ガードはワークフロー内に存在します。このスキルはブランチの差分からスコープを導出し、結果を中継します。

ループの開始

ユーザーから提供された: $ARGUMENTS(空の場合は、ベースブランチと設定を会話から取得)。

1. ブランチとその変更範囲の解決

  1. リポジトリルート: git rev-parse --show-toplevel。リポジトリ外ではエラーを出力して停止。
  2. ベース: 引数があればそれ、なければリポジトリのデフォルトブランチ(git symbolic-ref refs/remotes/origin/HEAD → その短縮名、それもなければ main)。現在のブランチがベースと同じ場合は実行を拒否 — 改善する差分がありません。
  3. 変更ファイル: git diff --name-only <base>...HEAD。空の場合はその旨を伝えて停止。
  4. スコープ: 変更ファイルのディレクトリを拡大して取得 — ファイル単位のグロブは狭すぎます(PR修正では、変更コードの隣にテストを追加するのが正当です)。各変更ファイルをそのリポジトリ相対ディレクトリグロブ <dir>/** にマッピング(ルート直下のファイルが変更された場合のみ ** をルートに)、その後重複を除去し、別のグロブに包含されるものを削除。

2. ループスクリプトの解決

ループはこのプラグイン内の動的ワークフロー workflows/improve.js です。パスで起動: scriptPath は解決された絶対パスを取ります。Workflow ツールの name はビルトインおよびプロジェクトワークフローを解決するため、マーケットプレイスからインストールされたものは code-improver:improve に応答しない可能性があります。以下の順で試し、最初に見つかったものを使用 — ホームディレクトリが . より先に来るため、インストール済みコピーがこのマーケットプレイスのチェックアウトより優先されます。

  1. Bash: ls -d -- "${CLAUDE_PLUGIN_ROOT}/workflows/improve.js"
  2. Bash: ls -d -- "${CODEX_PLUGIN_ROOT}/workflows/improve.js"(代わりにその変数が設定されている場合)
  3. Bash: find ~/.claude ~/.codex . -maxdepth 7 -path '*/code-improver/workflows/improve.js' -print -quit 2>/dev/null

出力されたパスをそのまま使用します。そのプラグインディレクトリ — パスから /workflows/improve.js を削除したもの — が pluginRoot です。3つすべて空の場合は、{name: "code-improver:improve"} を一度試します。それも利用できない場合は停止し、ループが見つからなかったことを伝えます。手動でパスを組み立てたり、ループを即興で作成したりしないでください。

3. ワークフローの呼び出し

Workflow ツールで、{scriptPath: "<step 2 のパス>", args: {...}} のように実行します。

{
  "target": "<リポジトリルート>",
  "reviewer": {
    "kind": "skill",
    "name": "pr-review-toolkit:review-pr",
    "notes": "ワーキングツリーの変更を <base> に対するプルリクエストとしてレビュー: 正確性、テスト、エラーハンドリング、およびスキルが規定するレビューの観点。"
  },
  "scope": ["<導出されたディレクトリグロブ>/**"],
  "pluginRoot": "<step 2 のプラグインディレクトリ>",
  "maxRounds": 5
}
  • reviewer — 上記のデフォルトでは pr-review-toolkit プラグインが必要です。ユーザーが別のPRレビュアー(スキルまたはエージェント)を指定した場合は、それを使用し、kind を適宜設定します。
  • maxRounds は、ユーザーが異なる上限を指定した場合のみ設定。
  • pluginRoot は実行がメトリクスコレクターを見つけるために必要です。step 2 でワークフロー名にフォールバックした場合のみ、このキーを省略 — ワークフローは自身を検索します。
  • finalize のデフォルトはPRに適しています: ブランチがプラグイン内にない限りバージョンバンプなし、ナレーション削除とドキュメントパスはそのまま。
  • decision は継続時のみ(後述)。

ループのベースラインスナップショットはループ開始時のツリーです — そのスコープガードはブランチの未コミット作業を保護します。PR自身のコミットがレビュアーによってレビューされるものです。

ワークフローはバックグラウンドで実行され、監視は不要です: レビュー、修正、再レビュー、修正ラウンドごとにスコープチェックを行い、クリーンレビューでのみ完了できます。決してコミットは行いません。すべての変更はワーキングツリーに残ります。

Workflow ツールが利用できない、または拒否された場合は、その旨を伝えて停止してください。 ループを直接編集で即興で作成しないでください — 台帳、スコープガード、エスカレーション保証はワークフローに存在し、インラインで模倣したものにはそれらがありません。

結果が halted: "reviewer-unavailable" の場合は、その旨を伝えて停止してください。 レビュアーがこのセッションにインストールされていません。どのプラグインがそれを提供しているか(デフォルトでは pr-review-toolkit が必要)をユーザーに伝え、インストール後に再実行してください。自分でブランチをレビューしないでください。

ループが実行中はあなたのターンを終了しないでください。 Workflow ツールはタスクIDを即座に返します。結果は後で届きます。インタラクティブセッションでは、完了通知があなたを再度呼び出します — それを待ってください。非インタラクティブ実行(スクリプト、CI、eval)では後続のターンがないため、途中で停止するとループを放棄することになります。起動後は、返されたタスクIDを使って TaskOutput でポーリングするか、スリープして再チェックし、完了するまで待機してから結果を中継してください。「ループは実行中です。後で報告します」と答えるセッションは実行を失います。

結果の中継

ワークフローは構造化された結果を返します。正直に報告してください — 違いは重要です。

  • converged: true — 最後のアクションがクリティカル/メジャーな指摘ゼロのレビューでした。使用したラウンド数、残ったマイナー指摘数(open_minor_count)、および成果物パス(ledger_path、metrics)を報告。
  • capped: true — 修正予算を使い切り、最終レビューでも依然としてブロッキングな問題が見つかりました。明確に: 上限到達、収束していないと伝え、open_blocking をリストアップ。これを成功として提示しないでください。
  • escalation — ループが収束しないことを検出(繰り返し発生する指摘、減少しないカウント、または修正が問題を別の場所に移動させたなど)。エスカレーションメッセージと指摘IDをユーザーに伝えてください: これはさらなるラウンドではなく、設計上の決定が必要です。
  • halted — ガードが発動(スコープ違反、未登録の新しいファイル、応答しないまたは利用できないレビュアー、またはファイナライズパスでそれに続くチェックに失敗した編集など)。violations/new_untracked_files 内のパス、finalize_regressions 内の箇所、および notes を報告。
  • notes は常に結果と共に添付されています — それらを表面化してください。例えば「git リポジトリが初期化されました」のような重大な警告が含まれます。

エスカレーション後の継続

ループは設計上、エスカレーションで停止します。ユーザーが決定したら、同じ引数に以下を追加して新しい実行を開始します。

{ "decision": "<ユーザーの判断をそのまま>" }

新しい実行はディスク上の台帳を再読み込みするため、すべての指摘、却下、判定が引き継がれます — ラウンドは再開され、再導出は行われません。

実行中のループを停止するには、ワークフロータスクを停止します(TaskStop)。ディスク上の台帳は最後のラウンドまでの状態であり、再実行はそこから再開します。

使用すべきでないケース

  • 一度きりのレビュー: PRレビュースキルを直接実行してください。ループの価値は反復にあります。
  • スキル: skill-improver エントリを使用してください。適切なレビュアーを配線します。
  • プッシュ前の探索的作業: review-and-fix ループは差分を固めます。形状が流動的なうちは、手動の反復がより制御を提供します。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

trailofbits/address-sanitizer

AddressSanitizer detects memory errors during fuzzing. Use when fuzzing C/C++ code to find buffer overflows and use-after-free bugs.

trailofbits/aflpp

AFL++ is a fork of AFL with better fuzzing performance and advanced features. Use for multi-core fuzzing of C/C++ projects.

trailofbits/agentic-actions-auditor

Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI, OpenAI Codex, and GitHub AI Inference. Detects attack vectors where attacker-controlled input reaches AI agents running in CI/CD pipelines, including env var intermediary patterns, direct expression injection, dangerous sandbox configurations, and wildcard user allowlists. Use when reviewing workflow files that invoke AI coding agents, auditing CI/CD pipeline security for prompt injection risks, or evaluating agentic action configurations.

trailofbits/algorand-vulnerability-scanner

Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing field validations, and access control issues. Use when auditing Algorand projects (TEAL/PyTeal).

trailofbits/ask-questions-if-underspecified

Clarify requirements before implementing. Use when serious doubts arise.

trailofbits/atheris

Atheris is a coverage-guided Python fuzzer based on libFuzzer. Use for fuzzing pure Python code and Python C extensions.

trailofbits/audit-augmentation

Augments Trailmark code graphs with external audit findings from SARIF static analysis results and weAudit annotation files. Maps findings to graph nodes by file and line overlap, creates severity-based subgraphs, and enables cross-referencing findings with pre-analysis data (blast radius, taint, etc.). Use when projecting SARIF results onto a code graph, overlaying weAudit annotations, cross-referencing Semgrep or CodeQL findings with call graph data, or visualizing audit findings in the context of code structure.

trailofbits/audit-context-building

Enables ultra-granular, line-by-line code analysis to build deep architectural context before vulnerability or bug finding.

trailofbits/audit-prep-assistant

Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools, increases test coverage, removes dead code, ensures accessibility, and generates documentation (flowcharts, user stories, inline comments).

trailofbits/burpsuite-project-parser

Searches and explores Burp Suite project files (.burp) from the command line. Use when searching response headers or bodies with regex patterns, extracting security audit findings, dumping proxy history or site map data, or analyzing HTTP traffic captured in a Burp project.

trailofbits/cairo-vulnerability-scanner

Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging issues, address conversion problems, and signature replay. Use when auditing StarkNet projects.

trailofbits/cargo-fuzz

cargo-fuzz is the de facto fuzzing tool for Rust projects using Cargo. Use for fuzzing Rust code with libFuzzer backend.

trailofbits/chrome-mcp-troubleshooting

Diagnose and fix Claude in Chrome MCP extension connectivity issues. Use when mcp__claude-in-chrome__* tools fail, return "Browser extension is not connected", or behave erratically.

trailofbits/claude-in-chrome-troubleshooting

Diagnose and fix Claude in Chrome MCP extension connectivity issues. Use when mcp__claude-in-chrome__* tools fail, return "Browser extension is not connected", or behave erratically.

trailofbits/code-improver

Runs an autonomous review-and-fix improvement loop over any code target — a skill, plugin, module, or directory — using a reviewer the user names: any installed skill or agent. Keeps a cross-round findings ledger, escalates when fixes stop converging, and guards scope mechanically. Use when asked to 'improve this code until review passes', 'run an improvement loop with <reviewer>', or to iterate review-and-fix with a specific reviewer. For skills prefer the skill-improver entry; for a branch prefer pr-improver.

trailofbits/code-maturity-assessor

Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing practices, access controls, complexity, decentralization, documentation, MEV risks, low-level code, and testing. Produces professional scorecard with evidence-based ratings and actionable recommendations.

trailofbits/codeql

Scans a codebase for security vulnerabilities using CodeQL's interprocedural data flow and taint tracking analysis. Triggers on "run codeql", "codeql scan", "codeql analysis", "build codeql database", or "find vulnerabilities with codeql". Supports "run all" (security-and-quality + security-experimental suites) and "important only" (high-precision security findings) scan modes. Also handles creating data extension models and processing CodeQL SARIF output.

trailofbits/constant-time-analysis

Detects timing side-channel vulnerabilities in cryptographic code. Use when implementing or reviewing crypto code, encountering division on secrets, secret-dependent branches, or constant-time programming questions in C, C++, Go, Rust, Swift, Java, Kotlin, C#, PHP, JavaScript, TypeScript, Python, or Ruby.

trailofbits/constant-time-testing

Constant-time testing detects timing side channels in cryptographic code. Use when auditing crypto implementations for timing vulnerabilities.

trailofbits/cosmos-vulnerability-scanner

Scans Cosmos SDK blockchain modules and CosmWasm contracts for consensus-critical vulnerabilities — chain halts, fund loss, state divergence. 25 core + 16 IBC + 10 EVM + 3 CosmWasm patterns. Use when auditing custom x/ modules, reviewing IBC integrations, or assessing pre-launch chain security. Updated for SDK v0.53.x.

関連スキル