Guardrail Testerのロゴ

Guardrail Tester

コミュニティ人気
RyanAlberts
guardrail-tester

Claude Code、Codex、Gemini CLI、OpenCode、Cursorに設定済みの権限ルールやPreToolUseフックが、危険なコマンドを一連のテストで阻止できるか確認するガードレールテスターです。プレフィックスルールをすり抜けるラップ形式、順序を入れ替えた形式、フルパス形式のコマンドもテストし、直近のツール呼び出しでプロンプトがどれほど増えるかも測定します。拒否ルールやフックが強制プッシュ、rm -rf、シークレットの読み取り、シェルにパイプで渡すダウンロードを阻止できるか確認したいとき、ガードレールのテストや監査、権限設定やexecポリシーのバイパスの発見、ルールによるプロンプトやブロックの回数の確認、またはガードフックを導入したばかりで機能する証拠を得たいときに使います。ローカルでのみ動作し、ネットワークには接続しません。ユーザーが許可した場合に限り、ユーザー自身のフックコマンドを実行します。

概要

公開者RyanAlberts
リポジトリbest-of-Agent-Harnesses
スキル名guardrail-tester
スター
1.1K
フォーク
66
同梱ファイル
10
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 10個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    RyanAlbertsがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Guardrail Tester」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/RyanAlberts/best-of-Agent-Harnesses/tree/main/skills/guardrail-tester
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git /tmp/best-of-Agent-Harnesses
mkdir -p .claude/skills
cp -r /tmp/best-of-Agent-Harnesses/skills/guardrail-tester .claude/skills/guardrail-tester
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでGuardrail Testerを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にGuardrail Testerを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Guardrail Testerは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Guardrail tester

Permission rules match the text of a command, so git push origin +main, rm -r -f build, and bash -c '...' can walk past a deny rule written for the plain form. This skill checks the rules and hooks the user already has against about 90 dangerous commands in those forms, then replays their recent tool calls to count how often the rules would ask or block. The user gets a headline ("Your Claude Code guardrails block 58 of 90 dangerous commands outright. 24 more stop at a prompt..."), every miss with a tested fix, and their friction numbers. Everything is read and simulated locally; nothing is sent anywhere, and it runs the user's hook commands only after they say yes.

When to use

  • The user asks whether their deny rules, ask rules, or hooks really stop a dangerous command.
  • The user wants to test, audit, or find bypasses in their guardrails or permission settings.
  • The user asks how many prompts their rules cause, or wants fewer without losing safety.
  • The user just installed a guard (a hook, dcg, the repo's safe-settings template) and wants proof.

When not to use

  • What the agent can reach on this machine (secret files, Docker, sudo): use sandbox-check.
  • Turning a rule from AGENTS.md or CLAUDE.md into a hook: use rules-to-guards.
  • Stopping a session that loops or overspends: use runaway-guard.
  • Building a guard from scratch: recommend dcg or templates/claude-code-safe-settings/ in this repository, then test it here.

What the tester runs

Say this to the user in short before the first run with hooks. It is the whole contract.

  • The battery commands never run. Each is only text inside the JSON a hook reads on stdin. The tester never runs them; a hook that runs or forwards its input would. Each battery command is also written to do nothing if run: its targets sit under a missing ./guardrail-tester-probe/ folder, its remotes and branches (probe-remote, probe-branch) are made up, and its hosts end in .invalid, a name reserved for addresses that resolve nowhere.
  • Rules are simulated from each harness's documented matching rules, so results are labeled "simulated". references/harness-rules.md says what each harness simulation covers.
  • It runs your hook commands only after you say yes (the --run-hooks flag). Each matching PreToolUse hook command then runs once per battery case, one run at a time, with a 10-second limit, from the folder its harness uses (usually the project), with the session's environment variables plus CLAUDE_PROJECT_DIR. A hook that writes a log or keeps state records those test calls. A hook that times out twice is not run again.
  • Replay reads session transcripts on this machine, read-only, masks secrets in its output, and checks the rules only. With --replay-hooks (which needs --run-hooks) it also runs this project's hooks on replayed calls from this project. Calls from other project folders are checked against their own rules; their hooks never run.

scripts/battery.json holds the dangerous commands on purpose: they are the test. Each line carries the marker skillscan:allow, which tells this repository's security scanner that the line is test data, not a command the skill runs.

Steps

<skill-dir> means the folder that holds this SKILL.md (Claude Code shows it as the skill's base directory). Run every command from the user's project folder, and give each Bash call a 10-minute timeout (600000 ms): hooks run one at a time, so a slow hook makes the run long.

  1. Run the rules-only test, which reads settings and runs no hook:

    bash
    python3 "<skill-dir>/scripts/test_guards.py" --project . --harness claude-code

    Add --harness for the harness you are running in (claude-code, codex, gemini-cli, opencode, or cursor) unless the user asks about all; without it the tester covers every harness with settings on this machine. Done when the output starts with a bold headline, or you have told the user the error (exit code 2 means a bad argument or an unreadable battery file).

  2. Tell the user what was found: the settings files and every hook command from the report's "What was found" section, quoted exactly. Done when the user has seen the list.

  3. Read each hook script, then ask before running hooks. Open the script each hook command runs. If a script runs, evaluates, or sends its input anywhere (eval, bash -c "$cmd", a curl with the input, a queue), or has other side effects such as writing a log, tell the user exactly that and recommend testing without hooks. Otherwise name the hook commands and say each will get test JSON for about 90 battery calls. On a clear yes, run this with a 10-minute Bash timeout:

    bash
    python3 "<skill-dir>/scripts/test_guards.py" --project . --harness claude-code --run-hooks --replay 500

    Add --replay-hooks only when the user also agrees that this project's hooks see up to 500 of their recent real calls. When the user declines, or a hook has side effects, run the same command without --run-hooks. Done when the headline matches the choice: it starts "Your ... guardrails block" after hooks ran, and "Without running your N hooks" when hooks exist and were skipped.

  4. Pick the fixes. For each row in "Misses, worst first", take the Fix column: a deny rule the simulation proved catches that case and leaves everyday commands and files such as .env.example alone, or a named hook check (an extended regular expression printed below the tables). Use references/bypass-forms.md to explain why a form slips. Done when every miss you report has its fix or the note "use the sandbox".

  5. Offer the change. Draft the settings edit or hook lines as a diff against the user's file, show it, and apply it only after a clear yes. Then rerun step 3 to show the new count.

Read the results

  • Headline: how many battery commands are blocked outright; how many more stop at a prompt, with the number that ask only because of the permission mode in parentheses; how many run without asking, with the worst example. For Codex: how many its rules block and how many its sandbox stops or asks about. The replay friction comes last when replay ran.
  • Table columns: Blocked; Not blocked; Asks (rule, hook, or check), prompts that still appear in auto mode; Asks (mode only), prompts that auto and bypassPermissions modes drop; Runs without asking, which counts allow rules, the read-only set, sandbox auto-allow, and auto mode's classifier.
  • Mode: with no defaultMode in the settings, the tester simulates auto mode, the built-in default on Claude Code 2.1.283 and later, and adds a "Claude Code in Manual mode" row. --mode simulates another mode. Plan mode lasts only until a plan is approved.
  • Should: block cases count as stopped only when blocked outright, because people approve prompts by reflex. ask cases count when they prompt or are blocked. --fail-on-miss uses this count.
  • What happens: blocked, asks first, runs without asking, left to the auto-mode classifier, or unknown. The part in parentheses names the layer that decided: a hook, a rule, a built-in check (protected paths, critical-path removals, the read-only command set), the mode, or the sandbox. With a sandbox on, a command that needs the network or writes outside the project shows asks first (needs network) or stopped by the sandbox.
  • Unknown: a hook did not answer within the tester's limit while the harness would wait longer. Unknown cases are not counted as misses; raise --hook-timeout to settle them.
  • Misses are listed worst first: runs without asking, then asks only because of the mode, then asks because of a rule, hook, or check.
  • Friction: replayed calls that would ask or be blocked, each simulated in the permission mode its session recorded, and real dangerous calls (matched by the hook checks) that ran and would still not be blocked as expected. A long command shows as the hook checks it matches.
  • Configuration problems: for example a hook that exits 1 (the call goes ahead), a hook with no timeout, a Bash matcher that Cursor never fires, a Codex hook nobody trusted in /hooks, a shadowed OpenCode deny, or bypass mode left available.
  • Notes on single cases: where Claude Code might apply a Read rule the docs do not extend to a command. --json has every case with verdict, bucket, decided_by, rules_verdict, and fix, plus hook_checks, every hook check by name.

Report to the user

  1. The headline, verbatim, in bold.
  2. The misses table, cut to its first eight rows (the report lists the worst first), each with its fix.
  3. The friction line and up to three dangerous replayed calls, quoted as the report prints them.
  4. Configuration problems, high first, one line each.
  5. The two or three fixes that close the most misses, then the offer from step 5. Point to dcg and templates/claude-code-safe-settings/ rather than writing a new guard.

Files

  • scripts/test_guards.py: the tester. Flags: --harness, --project, --run-hooks, --no-hooks (the default), --hook-workers N (default 1), --replay N, --replay-hooks, --since DAYS, --mode, --battery, --hook-timeout, --home, --json, --out, --fail-on-miss (exit 1 when a case is not blocked as expected).
  • scripts/battery.json: the dangerous commands, one case per line, each with what it needs to do its harm (network, write-outside, write-git, write-project).
  • scripts/claude_rules.py, scripts/harness_rules.py: rule simulation per harness.
  • scripts/hook_runner.py: runs one hook command with test JSON and reads its decision.
  • scripts/shell_split.py: splits a command line into the commands it runs.
  • scripts/transcripts.py: reads session transcripts for replay (shared copy).
  • scripts/safe.py: masks secrets and puts text from settings, hooks, and transcripts in inline code for the report (shared copy).
  • references/bypass-forms.md: each form in the battery and why rules miss it.
  • references/harness-rules.md: matching rules per harness, with sources and the date checked.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Guardrail Tester」では何ができますか?

Claude Code、Codex、Gemini CLI、OpenCode、Cursorに設定済みの権限ルールやPreToolUseフックが、危険なコマンドを一連のテストで阻止できるか確認するガードレールテスターです。プレフィックスルールをすり抜けるラップ形式、順序を入れ替えた形式、フルパス形式のコマンドもテストし、直近のツール呼び出しでプロンプトがどれほど増えるかも測定します。拒否ルールやフックが強制プッシュ、rm -rf、シークレットの読み取り、シェルにパイプで渡すダウンロードを阻止できるか確認したいとき、ガードレールのテストや監査、権限設定やexecポリシーのバイパスの発見、ルールによるプロンプトやブロックの回数の確認、またはガードフックを導入したばかりで機能する証拠を得たいときに使います。ローカルでのみ動作し、ネットワークには接続しません。ユーザーが許可した場合に限り、ユーザー自身のフックコマンドを実行します。

TypingMindでGuardrail Testerを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Guardrail Testerはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにGuardrail Testerをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/RyanAlberts/best-of-Agent-Harnesses/tree/main/skills/guardrail-testerを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Guardrail Testerを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Guardrail Testerで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもGuardrail Testerを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Guardrail Tester」は無料ですか?

はい。RyanAlbertsがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇