evaluate-ai-guardrail
Evaluate AI security guardrails, moderation layers, prompt-injection detectors, policy engines, classifiers, and rule-based controls with reproducible adversarial and benign datasets. Use when measuri
Files3
View on GitHubSKILL.mdskills/evaluate-ai-guardrail/SKILL.md
GitHubEvaluate an AI Guardrail
Measure both attack detection and benign utility under deployment-like conditions. Preserve raw predictions and dataset provenance so every aggregate can be audited.
Read methodology before selecting metrics, thresholds, slices, or release criteria.
Safety boundaries
- Define the allowed content classes, handling rules, reviewers, storage, and retention before loading adversarial data.
- Minimize exposure to harmful content and warn human reviewers about relevant categories.
- Remove or replace personal data, credentials, live exploit targets, and operational secrets.
- Run generated or mutating tests in an isolated environment with tools and network side effects disabled.
- Do not publish raw bypasses, sensitive examples, or uniquely identifying records without a disclosure decision.
- Do not train on, tune against, or manually alter the held-out release set.
Workflow
- Define the control decision. Record protected policy, deployment point, action on detection, risk tolerance, error costs, users, languages, domains, latency and cost limits, and release decision.
- Fingerprint the guardrail. Pin code or service version, model and snapshot, prompt, rules, thresholds, preprocessing, decoding, dependencies, environment, and evaluation date.
- Specify labels and taxonomy. Write operational label definitions, ambiguous and abstain handling, multi-label rules, severity, attack family, benign intent, language, domain, and reviewer guidance before scoring.
- Audit the dataset. Record source, license or authorization, provenance, collection date, transformations, hashes, class and slice counts, deduplication, near-duplicate groups, label review, leakage checks, and split method.
- Build paired coverage. Pair adversarial cases with benign lookalikes that share vocabulary, format, domain, or user goal. Include clean, obfuscated, indirect, multilingual, long-context, and composition cases only when deployment can receive them.
- Run reproducibly. Preserve one record per case with input ID, ground truth, raw output, normalized decision, score, threshold, latency, token or cost use, error, seed or trial, and guardrail fingerprint.
- Measure by slice. Report confusion counts first, then recall or detection rate, false-negative rate, specificity, false-positive rate, precision, F1 when useful, abstention, coverage, latency, and uncertainty. Avoid unsupported percentages for tiny slices.
- Inspect errors. Review representative false negatives, false positives, abstentions, unstable trials, and system errors. Identify mechanism-level clusters without leaking the held-out set into tuning.
- Choose and verify. Compare thresholds or versions against declared error costs and release gates. Confirm selected changes on untouched data and convert failures into a separate regression suite.
Evidence rules
- Hash the dataset, split manifest, evaluator code, configuration, and raw result file.
- Preserve immutable case IDs and provenance without storing unnecessary sensitive text in the report.
- Keep raw scores and outputs; do not retain only aggregate percentages.
- Record every error, timeout, refusal, and missing prediction.
- Separate development, threshold-selection, held-out release, and regression sets.
- Report sample counts and confusion counts for every metric and slice.
- Distinguish measured results, statistical uncertainty, interpretation, and release recommendation.
Output contract
Return:
- Scope, policy, deployment action, error costs, release gates, and limitations.
- Guardrail and environment fingerprint.
- Dataset card with provenance, license or authorization, schema, label rules, split, deduplication, leakage review, and slice counts.
- Reproducibility manifest and raw-result location or hash.
- Overall and per-slice confusion matrices, metrics, uncertainty, latency, cost, and system errors.
- Audited false-negative, false-positive, abstention, and instability clusters with redacted examples.
- Threshold or version recommendation tied to risk tolerance and benign utility.
- Release decision, residual risk, monitoring plan, and regression suite.
Write each error cluster as: ID | error type | attack or benign family | slice | count | representative evidence | likely mechanism | impact | confidence | proposed change | validation set | regression IDs.
Quality gate
Do not finalize until:
- Dataset provenance, authorization or license, hashes, labels, split, deduplication, and leakage checks are documented.
- Held-out release data remains untouched by prompt, rule, model, or threshold tuning.
- Every percentage includes a denominator and every slice includes raw confusion counts.
- Attack recall and benign false-positive impact are both reported.
- Small or unstable slices are labeled inconclusive instead of overstated.
- All failed requests and missing outputs are accounted for.
- The release decision follows predeclared gates and states residual risk.
- No benchmark result is presented as proof that the protected application is secure.