Communityライティング&編集github.com

コード改善ツール

指定された任意のコードターゲット(スキル、プラグイン、モジュール、ディレクトリなど)に対し、ユーザーが指定したレビュアー(インストール済みのスキルやエージェント)を使用して、自律的なレビュー&修正ループを実行します。発見事項の台帳を保持し、修正が収束しない場合はエスカレーションし、スコープを機械的に保護します。

コード改善ツール とは?

これは、コードベースの自律的な改善ループを提供するスキルです。ユーザーが指定したレビュアー(インストール済みのスキルやエージェント)を使用して、コードのレビューと修正を繰り返し、致命的または重大な問題がなくなるまで自動的に改善を続けます。このスキルは、Claude CodeやCodexなどのプラットフォームで動作し、スキル、プラグイン、モジュール、ディレクトリなど様々なコードターゲットを対象とできます。レビューと修正のループはワークフロー内で管理され、発見事項の台帳、スコープガード、エスカレーション機構が組み込まれているため、手動での実装よりも堅牢で信頼性の高い改善プロセスを提供します。最終的には、収束したか、上限に達したか、エスカレーションされたか、あるいは停止されたかの結果を報告し、エンジニアが状況を正確に把握できるようにします。

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

Installed? Explore more ライティング&編集 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

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

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

ドキュメント

コード改善ツール (Code Improver)

/code-improver:improve を実行すると、コードターゲットを改善できます。これは動的ワークフローで、指定されたレビュアーと修正サブエージェントをループさせ、レビューが重大かつ致命的な問題をゼロと報告するまで繰り返した後、自身の残骸を削除します。ループ、その台帳、ガード機構はワークフロー内に存在します。このスキルは、汎用エントリが必要とする3つの入力を収集し、結果を中継します。

ループの開始

ユーザーから提供された情報: $ARGUMENTS (空の場合は、会話の詳細から取得します)

1. 必要な3つの入力を収集する — 推測は禁止

  1. ターゲット: 改善対象のディレクトリへの絶対パス。相対パスはワーキングディレクトリを基準に解決し、ディレクトリが存在することを確認します。
  2. レビュアー: すべてのレビューを実行するインストール済みのスキルまたはエージェント。ユーザーが名前を指定する必要があります。デフォルトはなく、バンドルされたレビュアーもありません。種類を判別します:
    • 名前空間付きエージェント(例: plugin-dev:skill-reviewer)→ "kind": "agent"
    • インストール済みスキル(例: pr-review-toolkit:review-pr)→ "kind": "skill" 名前がどちらにも該当する可能性がある場合は、セッションのスキル一覧を確認します。それでも曖昧な場合はユーザーに尋ねます。レビュアーが指定されていない場合は、尋ねてください — 自分で選ばないでください。
  3. スコープ: ループが触れてよいリポジトリ相対のグロブ。汎用エントリはこれを明示的に要求します。ユーザーが指定しなかった場合は、ターゲットディレクトリ(<repo-relative-target>/**)を提案し、起動前に確認します。

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: "<ステップ2のパス>", args: {...}} で実行します:

{
  "target": "<絶対ターゲットパス>",
  "reviewer": { "kind": "agent|skill", "name": "<名前空間付き名前>", "notes": "<レビュアーがターゲットについて知っておくべきこと>" },
  "scope": ["<リポジトリ相対グロブ>/**"],
  "pluginRoot": "<ステップ2のプラグインディレクトリ>",
  "maxRounds": 5
}
  • maxRounds は、ユーザーが異なる上限を要求した場合のみ指定します。
  • pluginRoot は実行時にメトリクスコレクターを見つけるために使用します。このキーは、ステップ2がワークフロー名にフォールバックした場合のみ省略します — その場合ワークフローは自分自身を検索します。
  • finalize ({"version_bump": bool, "narration_strip": bool, "docs_pass": bool})は、デフォルトを上書きする場合のみ指定します: ターゲットがプラグイン内にある場合はバージョンバンプ、ナレーション削除とドキュメントパスは常に実行されます。
  • decision は継続時のみ指定します(下記参照)。

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

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

結果が halted: "reviewer-unavailable" の場合は、その旨を伝えて停止してください。 指定されたレビュアーはこのセッションにインストールされていません。どのプラグインが提供するかをユーザーに伝え、インストール後に再実行してください。自分でターゲットをレビューしないでください。

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

結果の中継

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

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

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

ループは設計上、エスカレーション時に停止します。ユーザーが判断したら、同じ target と reviewer に加えて以下を指定して新しい実行を開始します:

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

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

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

使用すべきでない場合

  • Claude Codeスキル: skill-improver エントリを使用してください — 適切なレビュアーを配線します。
  • ブランチ / プルリクエスト: pr-improver エントリを使用してください — 差分からスコープを導出します。
  • 1回限りのレビュー: レビュアーを直接呼び出してください。ループの価値は反復にあります。
  • 簡単な単発修正: ファイルを直接編集してください。

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-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.

trailofbits/coverage-analysis

Coverage analysis measures code exercised during fuzzing. Use when assessing harness effectiveness or identifying fuzzing blockers.

関連スキル