Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

testing-llm-guardrails

БесплатноБез исполняемых скриптовНе проверен

Tests the runtime validation around model output - schema conformance, PII leakage, moderation, refusal behaviour, tool-call safety - and the adversarial…

jaktestowacот jaktestowac★ 124 звезды на GitHub

Об этом скилле

Testing LLM Guardrails

Use this skill when an LLM feature can affect something - render output to a user, call a tool, write to a database, send a message - and you need to know what happens when the model is manipulated or simply wrong.

Two layers, tested together because they fail together:

  • Guardrails - the runtime validation between the model and the world: schema, moderation, PII filtering, refusal handling, tool authorisation. Deterministic code you can unit-test.
  • Adversarial resistance - whether those guardrails hold when someone tries to defeat them, including through content the model reads rather than what the user types.

The principle that drives all of it: the model is untrusted input, and so is everything it reads. A prompt is not a security boundary. Code around the model is.

Authorization Gate - read before anything else

Adversarial testing is security testing. Before running a single case, confirm in writing:

  • the system is yours, or you have explicit written permission from its owner
  • the target environment is named and non-production, or production testing is explicitly authorised
  • the time window and rate limits are agreed
  • who to notify on a real finding, and how findings are handled

If any of that is missing, stop and say what is needed. Do not "just try one". The same rule as testing-application-security, for the same reason.

Scope boundaries that always apply: test only the surfaces you were authorised for, do not exfiltrate real user data as proof, never use another tenant's live data as a test payload, and report findings privately before they go anywhere public.

When to Use

  • an LLM feature is about to reach real users
  • the model can call tools, especially any that mutate state or spend money
  • the feature reads content it did not author: retrieved documents, user uploads, web pages, webhook payloads, tool results
  • model output is rendered as HTML, markdown, or executed as code or SQL
  • a security review asks whether the AI feature can be manipulated
  • an incident involved the model doing something it should not have

Operating Principles

  • Prompt instructions are not enforcement. "Never reveal the system prompt" is a hope. A regex on the output is a check. Authorisation in the tool handler is a control.
  • Validate on the way out, always. Every model output crossing a trust boundary gets schema-validated, and a validation failure is a handled case with defined behaviour - not an exception in the logs.
  • The tool layer is where the damage happens. Injection is only as dangerous as the capability it reaches. Test authorisation in the handler, not in the prompt.
  • Indirect injection is the realistic attack. Nobody needs to type a jailbreak if a retrieved document can carry one. Any feature with retrieval or tool output has this surface.
  • Test the failure path, not just the refusal. What happens after the guardrail trips - does the user get a usable message, does the request fail closed, is it logged, can it be replayed?
  • Fail closed. When validation fails, the safe outcome is no action and a clear error. A feature that proceeds on unparseable output has no guardrail.
  • A corpus, not a handful of tricks. "Ignore previous instructions" is one case. Categories, versioned and grown from real attempts, is a suite.
  • Success is measured on effect, not on wording. Whether the model said something odd matters far less than whether it did something unauthorised.

Workflow

Phase 1: Map trust boundaries

Draw the path from every input to every effect:

Boundary Question
User input → prompt is it delimited, escaped, length-capped?
Retrieved content → prompt who can write into the index, and is retrieved text marked as data?
Tool result → prompt can a tool return attacker-controlled text?
Model output → user rendered as HTML/markdown? sanitised?
Model output → tool call who authorises the call, and against whose permissions?
Model output → storage or another system validated before it lands?
Model output → another model or agent injection propagates through chains

Then list capabilities: every tool the model can call, what each can change, whose authority it runs under, and what it costs. A tool that mutates state, spends money, or reads another user's data is the finding surface. Everything else is noise by comparison.

Phase 2: Test the guardrails (deterministic, cheap, unit-testable)

./resources/output-contract-checks.md has the implementations. These are ordinary tests - no model call needed if you feed recorded or synthetic model output.

  • Schema conformance - valid output parses; malformed, truncated, extra-field, and wrong-type output are rejected with defined behaviour
  • Refusal handling - when the model refuses, the app handles it as a refusal rather than treating the refusal text as data
  • **PII and secret
Полный SKILL.md на GitHub

Установить testing-llm-guardrails в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

resources/indirect-injection-scenarios.mdresources/injection-test-corpus.mdresources/output-contract-checks.md

FAQ

Что делает скилл testing-llm-guardrails?

Tests the runtime validation around model output - schema conformance, PII leakage, moderation, refusal behaviour, tool-call safety - and the adversarial suite that tries to defeat it: direct prompt injection, jailbreaks, and indirect injection through retrieved documents, tool results and user content. Use when an LLM feature reaches real users, when a model can call tools or read untrusted content, when an AI feature needs a security-style test suite, or when asked whether a chatbot or agent can be manipulated.

Как установить скилл testing-llm-guardrails?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл testing-llm-guardrails запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить testing-llm-guardrails с