# Guardrail tester

> Guardrail tester is an open-source agent skill for security. Checks if your agent's deny rules and hooks really block dangerous commands. It is available on Claude Code, Codex, Cursor and Gemini CLI.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI
- **Website:** https://github.com/RyanAlberts/best-of-Agent-Harnesses/tree/main/skills/guardrail-tester
- **Repository:** https://github.com/ryanalberts/best-of-agent-harnesses
- **GitHub stars:** 1,663
- **License:** MIT
- **Skill name:** guardrail-tester
- **Collection:** https://github.com/RyanAlberts/best-of-Agent-Harnesses
- **Categories:** [security](https://ai-powered.com/categories/security), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill tests the permission rules and PreToolUse hooks already configured in an agent harness against a battery of about 90 dangerous commands, including wrapped, reordered, and full-path forms that can slip past simple prefix rules. Rules are simulated from each harness's documented matching behavior, and results are reported as blocked, asking first, or running without asking, with the layer that made each decision.

The workflow starts with a rules-only pass that reads settings files and runs no hooks. It then lists the hook commands it found and reads their scripts. Only after the user agrees does it feed each matching hook test JSON, one call at a time with a time limit. The battery commands are never executed. They are written to do nothing if run, using made-up folders, remotes, and reserved hostnames. Optional replay mode checks the user's recent recorded tool calls against the same rules to count prompts and blocks.

The skill runs locally with Python and the standard library, and makes no network calls. It reads Codex config and Gemini CLI policy files, which need Python 3.11 or newer. The output lists each miss with a suggested deny rule or hook check, along with configuration problems such as hooks that exit with the wrong code.

## When your agent uses it

> Guardrail tester that checks whether the permission rules and PreToolUse hooks already set up in Claude Code, Codex, Gemini CLI, OpenCode, or Cursor stop a battery of dangerous commands, including wrapped, reordered, and full-path forms that slip past prefix rules, and measures prompt friction on the latest tool calls. Use when the user asks whether deny rules or hooks block force pushes, rm -rf, secret reads, or downloads piped into a shell; wants to test or audit guardrails, or find a bypass in permission settings or exec policy; asks how many prompts or blocks the rules cause; or just installed a guard hook and wants proof it holds. Local only, no network; executes the user's own hook commands only with their yes.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs Python scripts](https://github.com/RyanAlberts/best-of-Agent-Harnesses/tree/HEAD/skills/guardrail-tester)
- [Network calls found in its scripts](https://github.com/RyanAlberts/best-of-Agent-Harnesses/tree/HEAD/skills/guardrail-tester)
- [License: MIT](https://github.com/RyanAlberts/best-of-Agent-Harnesses/tree/HEAD/skills/guardrail-tester)

## Features

- **Dangerous command battery:** About 90 test cases covering force pushes, recursive deletes, secret reads, and downloads piped into a shell.
- **Rule simulation per harness:** Simulates the matching rules of Claude Code, Codex, Gemini CLI, OpenCode, and Cursor against each case.
- **Hook testing with consent:** Runs the user's own PreToolUse hook commands on test input only after explicit approval.
- **Miss list with fixes:** Lists every case that gets through, worst first, with a tested deny rule or hook check where one exists.
- **Replay of recent calls:** Counts how often real recorded tool calls would trigger a prompt or a block under the current rules.
- **Configuration problem checks:** Flags issues such as hooks without timeouts, unused matchers, or bypass modes left available.

## Good for

- Check whether my deny rules block force pushes and rm -rf
- Audit my Claude Code permission settings for bypasses
- Test the guard hook I just installed before trusting it
- Count how many prompts my current permission rules cause
- Find secret-reading commands my settings miss

## Install

### Claude Code

This skill ships in the `harness-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add RyanAlberts/best-of-Agent-Harnesses
/plugin install harness-skills@agent-harnesses
```

Or copy only this skill to `~/.claude/skills/guardrail-tester`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/guardrail-tester &&
cp -R "$tmp/skills/guardrail-tester" ~/.claude/skills/guardrail-tester &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/guardrail-tester` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/guardrail-tester` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/guardrail-tester &&
cp -R "$tmp/skills/guardrail-tester" ~/.agents/skills/guardrail-tester &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/guardrail-tester` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/guardrail-tester` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/guardrail-tester &&
cp -R "$tmp/skills/guardrail-tester" ~/.cursor/skills/guardrail-tester &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/guardrail-tester` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/RyanAlberts/best-of-Agent-Harnesses.git --path skills/guardrail-tester
```

Or copy the folder to `~/.gemini/skills/guardrail-tester` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/guardrail-tester`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/guardrail-tester &&
cp -R "$tmp/skills/guardrail-tester" ~/.copilot/skills/guardrail-tester &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/guardrail-tester` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/RyanAlberts/best-of-Agent-Harnesses.git
```

Then copy `best-of-Agent-Harnesses/skills/guardrail-tester` into your agent's skills folder as `guardrail-tester`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does Guardrail tester run the dangerous commands it tests?

No. The battery commands are only text sent as JSON to hooks. They are written to do nothing if run, and hooks run only after the user says yes.

### Does Guardrail tester need a network connection?

No. It makes no network calls and works offline, reading settings, hook scripts, and optionally local session transcripts.

### Which harnesses does Guardrail tester cover?

Claude Code, Codex, Gemini CLI, OpenCode, and Cursor. Support for each varies, and OpenCode is noted as not verified on a real install.

### What does Guardrail tester change in my setup?

It does not edit anything by itself. Any settings or hook change is drafted as a diff and applied only after the user gives a clear yes.

### What Python version is required?

Python 3.9 or newer for the core tests. Reading Codex config.toml and Gemini CLI policy files needs Python 3.11 or newer.

### How do I install Guardrail tester in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/guardrail-tester to use it in all your projects, or to .claude/skills/guardrail-tester in one project. Or install the harness-skills plugin, which includes it: /plugin marketplace add RyanAlberts/best-of-Agent-Harnesses, then /plugin install harness-skills@agent-harnesses.

### Does Guardrail tester run scripts?

Yes. It runs Python scripts. Its scripts contain network calls. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Guardrail tester?

Claude Code, Codex, Cursor and Gemini CLI. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Guardrail tester?

The closest alternatives to Guardrail tester are Rules to guards, Speclock guardrails, Sandbox check, Safe execution edho ferdian and Security.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Rules to guards](https://ai-powered.com/skills/rules-to-guards): Rules to guards is an open-source agent skill for developer tools.
- [Speclock guardrails](https://ai-powered.com/skills/speclock-guardrails-sgroy10): Speclock guardrails is an open-source agent skill for security.
- [Sandbox check](https://ai-powered.com/skills/sandbox-check): Sandbox check is an open-source agent skill for security.
- [Safe execution edho ferdian](https://ai-powered.com/skills/safe-execution-edho-ferdian): Safe execution edho ferdian is an open-source agent skill for developer tools.
- [Security](https://ai-powered.com/skills/security-xiaolai): Security is an open-source agent skill for security.
- [Session hardening](https://ai-powered.com/skills/session-hardening): Session hardening is an open-source agent skill for developer tools.
- [Runaway guard](https://ai-powered.com/skills/runaway-guard): Runaway guard is an open-source agent skill for developer tools.
- [Red team](https://ai-powered.com/skills/red-team): Red team is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/guardrail-tester
