From promptfoo
Creates or refines promptfoo redteam configs for adversarial testing: targets, plugins, strategies, policy, and threat mapping from code evidence or live probes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/promptfoo:promptfoo-redteam-setupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Build a small, explicit redteam config that matches the real app threat model.
Build a small, explicit redteam config that matches the real app threat model. Start with a narrow scan that can be generated and inspected, then expand.
Read references/redteam-setup-patterns.md when you need concrete YAML
patterns.
For OpenAPI specs, you can run the bundled
scripts/openapi-operation-to-redteam-config.mjs to draft a one-operation
redteam setup config, then inspect the inferred inputs, policy, and plugins. The
script ships in this skill's scripts/ directory; when the skill is installed as
a plugin it lives in the plugin cache, not your project, so run it by its absolute
path (or copy it in) rather than a bare scripts/... path.
With --token-env, it infers Bearer/OAuth2/OpenID and header/query/cookie API-key auth; use
--auth-header/--auth-prefix to override.
For live connectivity QA, add --smoke-test true to include one deterministic
tests row that can be run with npm run local -- eval -c ... --no-cache
before redteam generation.
Infer these from the repo, docs, or user prompt:
If target wiring is missing, use promptfoo-provider-setup first or create a
TODO-marked target block and validate it before generation.
rg; capture file paths and line numbers for the setup notes.inputs; these are the attack surface for authorization plugins.bola, role/permission checks
imply rbac/bfla, free-form instructions imply prompt-boundary plugins,
tool URLs or shell/database calls imply SSRF/injection/tool plugins.targets for redteam configs.label; reports and generated files use it for continuity.redteam.injectVar
so generation lands in the variable the target actually uses.inputs on the target. Do not set
redteam.injectVar or invent a synthetic prompt field.redteam.purpose as security-relevant behavior: allowed users/actions,
forbidden data/actions, and domain-specific constraints.Avoid plugins: default for an initial scan unless the user explicitly wants a
broad run.
Pick 2-5 plugins from the app's real risks:
policybola, bfla, rbachijacking, prompt-extraction, system-prompt-overrideindirect-prompt-injection,
rag-document-exfiltration, rag-poisoning, rag-source-attributionexcessive-agency, tool-discovery, debug-access,
shell-injection, sql-injection, ssrfpii:direct, pii:session, pii:socialFor policy, include inline policy text unless the user intentionally references
a resolved Promptfoo Cloud policy object.
jailbreak:meta for the default first setup/generation pass.jailbreak:hydra instead when the target is stateful, supports
multi-turn conversations, and sessions are configured.jailbreak:composite only after the
first generated cases look sane.redteam.provider: file://..., make the path valid from the
command working directory; JavaScript providers expose callApi, while Python
providers expose call_api or the function named in a file://x.py:name
suffix. Run commands from the repo root unless the project convention says
otherwise.bola and bfla whenever target evidence
shows object IDs, ownership checks, or authorization boundaries.redteam.maxConcurrency: 1 for fragile local providers or rate-limited
targets.graderGuidance and graderExamples only when default
grading would misunderstand domain-specific allowed behavior.From the promptfoo repo:
npm run local -- validate config -c path/to/promptfooconfig.yaml
npm run local -- validate target -c path/to/promptfooconfig.yaml
npm run local -- redteam generate -c path/to/promptfooconfig.yaml -o /tmp/redteam.yaml --no-cache --force --no-progress-bar --strict
Outside the repo (installed plugin or your own project), use the published CLI:
npx promptfoo@latest validate config -c path/to/promptfooconfig.yaml
npx promptfoo@latest redteam generate -c path/to/promptfooconfig.yaml -o /tmp/redteam.yaml --no-cache --force --no-progress-bar --strict
Use a non-precreated output path or keep --force; redteam generate reads an
existing output file to compare metadata and an empty temp file can fail before
generation. Inspect generated YAML for tests, assert,
per-test metadata.pluginId, defaultTest.metadata.purpose, and preserved
multi-input vars. Do not proceed to redteam run until generated cases are
plausible.
If the target uses config-relative file://./target.js or file://./target.py,
write generated YAML next to the source config or switch the target to a stable
absolute/repo-root path before validating; /tmp/redteam.yaml makes relative
file targets resolve under /tmp.
# WRONG: too broad for a first pass
redteam:
plugins:
- default
# BETTER: risk-led starter
redteam:
plugins:
- id: policy
config:
policy: The assistant must not disclose another user's records.
- bola
- rbac
# WRONG: multi-input mode configured under redteam
redteam:
injectVar: message
# BETTER: define real input variables on the target
targets:
- id: https
inputs:
user_id: Signed-in user identifier.
record_id: Record being requested.
message: User message.
When done, state:
promptfoo-provider-setup was needednpx claudepluginhub p/promptfoo-promptfoo-plugins-promptfooExecutes promptfoo redteam scans, inspects results, reruns failed probes, and exports reports. Use after redteam setup when running eval or run commands.
Tests LLM/agent defenses against prompt injection, instruction hijacking, data exfiltration, and tool abuse by attempting to break them. Useful for verifying security posture of systems with untrusted content handling.
Wires Promptfoo and DeepTeam into CI/CD for automated regression red-teaming of LLM apps against OWASP LLM Top 10 and OWASP Agentic presets, failing the build when jailbreak or injection vulnerabilities regress.