PM step for any data-sensitive project (reusable across projects): runs an authorized adversarial security test against the project's registered pre-production host only, before any real client data is loaded. Offers two versions the user picks between — recognized scanners (no PentAGI), the PentAGI agent, or both — recommends one per project, confirms the scope out loud, writes PENTEST-REQUEST.md, drives Claude Code to run /pf-next pentest, polls for PENTEST-RESULT.md, and gives a go-live-fo...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Pf Pentest?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/singhviplove234-pf-pentest)
---
name: pf-pentest
description: "PM step for any data-sensitive project (reusable across projects): runs an authorized adversarial security test against the project's registered pre-production host only, before any real client data is loaded. Offers two versions the user picks between — recognized scanners (no PentAGI), the PentAGI agent, or both — recommends one per project, confirms the scope out loud, writes PENTEST-REQUEST.md, drives Claude Code to run /pf-next pentest, polls for PENTEST-RESULT.md, and gives a go-live-for-client-data recommendation. Use when the user says /pf-pentest, 'pentest the app', 'attack our staging', 'is it safe for client data', or 'security test before go-live'. Never targets production or a host with real data; never runs on a schedule."
---
# /pf-pentest <slug> [--mode scanners|agent|both]
Authorized adversarial test of your own pre-production. Read first: `${CLAUDE_PLUGIN_ROOT}/references/security-testing.md` (its scope rules bind this skill), `security.md`, `bridge.md`. This is the one stage that never accepts `--go` and never runs unattended.
Two versions, the user chooses (keep both; either or both). Always show the pros **and** cons at the choice (full list in `security-testing.md`):
- **scanners** — recognized tools only (OWASP ZAP, nuclei, access-control probes, TLS/headers, deps/secrets). No PentAGI. **Pro:** fast, deterministic, free, safe to run often. **Con:** finds mostly known issue classes; won't chain a novel multi-step exploit or catch logic flaws outside templates.
- **agent** — your own self-hosted PentAGI (deeper, chained reasoning). Requires `security_testing.pentagi.enabled` + endpoint. **Pro:** reasons and adapts like a human tester; finds multi-step / logic flaws scanners miss. **Con:** needs PentAGI running (your LLM keys → a per-run LLM cost); non-deterministic; slower; gated behind a second confirmation.
- **both** — scanners for breadth, then the agent for depth. **Pro:** best coverage. **Con:** longest run; needs the agent set up; carries its cost.
## 0. Flags
`--mode` preselects a version (still shown for confirmation). `--dry-run` → print the `PENTEST-REQUEST.md` that would be written, write nothing, ask nothing, stop. Seat = `--lane` (default `solo`), must equal `factory.json.pm_lane` else "Only the PM lane (`<pm_lane>`) runs the pentest." and stop.
## 1. Gate and target
Locate the project. Read `factory.json`. Require `gates.build == "approved"`. Read `security_testing.authorized_targets[]`. If none registered → "No authorized pre-production target yet — run `/pf-setup pentest <slug>` to register a pre-production staging host of your own with synthetic data." and stop. If more than one, ask which. The chosen record must be `owner: you`, `environment ∈ {staging,dev,local}`, `data_state: synthetic`; if `data_state` is `real` or unset, refuse and say the pentest runs only against a synthetic-data staging host.
## 1b. Recommend a version (per project) — then let the user choose
Suggest a default from the project, then always let the user pick. Recommendation:
- `brief.data_sensitivity == "high"` (client private/financial data) → recommend **both** (scanners for breadth + agent for depth) when PentAGI is enabled, else **scanners** and note the agent can be enabled via `/pf-setup pentest`.
- backend/auth/payments but not high-sensitivity → recommend **scanners** (agent optional).
- static or no backend → recommend **scanners** (quick).
If `--mode` was given, treat it as the user's choice but still show it. If the user picks **agent** or **both** and `security_testing.pentagi.enabled` is false or the endpoint is empty → say PentAGI isn't set up for this project, point to `/pf-setup pentest` to enable it, and offer to run **scanners** now instead.
## 2. State the scope and ask the version — always, no --go
Show plainly: "I will run a security attack-test against **<target>** (your own pre-production <environment>, synthetic data only). It will not touch production, your live site, or anything with real client data. This is authorized because it is your own pre-production system." Then AskUserQuestion, options (recommended one first, marked "(Recommended)"):
- **Scanners only** — recognized tools (ZAP, nuclei, access-control, deps/secrets); no PentAGI. Fast, deterministic, free; finds mostly known issue classes.
- **PentAGI agent** — your self-hosted agent drives it (deeper; needs it enabled). Finds multi-step/logic flaws scanners miss; non-deterministic and has an LLM cost per run.
- **Both** — scanners then the agent. Best coverage; longest run and carries the agent's cost.
- **Cancel**.
Only one of the three run options proceeds; `--go` is ignored here by design.
## 2b. Extra guardrail for the agent (added 23 Oct 2026)
If the chosen version is **agent** or **both**, require a **second** explicit confirmation before writing the request, because an autonomous agent is more powerful than passive scanners: AskUserQuestion `The PentAGI agent will actively attack <target> (your pre-production <environment>, synthetic data) and stop when done. It will only touch this one host. Confirm? Yes / No`. Only Yes proceeds. Scanners-only skips this second confirm.
## 3. Hand-off
`request_id = <slug>-pentest-<yyyymmddHHMM>`. Write `<folder>/PENTEST-REQUEST.md`:
```
PF-PENTEST v1
request_id: <id>
project: <slug>
code_path: <code root>/<slug>
target: <authorized host>
environment: staging|dev|local
data_state: synthetic
authorized_by: the user — own pre-production, authorized <date>
mode: scanners|agent|both
pentagi: <true|false — true only when mode is agent or both and it is enabled>
```
Delete any stale `PENTEST-RESULT.md`. Store `security_testing.last_request_id`, status `requested`; log the authorization. Drive Chrome per `bridge.md` on `lanes[<pm_lane>].code_url` and type `/pf-next <slug> pentest` **without `--go`** (Code re-confirms the target itself — a second human check on purpose). Fallback: "In your Claude Code session type **`/pf-next <slug> pentest`** and confirm the target." Then **wait on the result, don't poll on a loop**: the pentest is a rare, deliberate, watched run, so if the builder opens a `pentest/<yyyymmdd>` PR its PR event wakes you (`ReadNotifications`), and in any case do a **single backstop check** for `PENTEST-RESULT.md` (first line `PF-PENTEST-RESULT v1`, same `request_id`) at the 180-minute timeout — not a 5-minute poll loop.
## 4. Present
Record `security_testing.status`, `.pr_url`, `.branch`, `.critical_high_open`, `.mode`; log `{stage: "pentest", event: "<mode> <status>: C/H open <n>"}`. Show which version ran (scanners / agent / both), the findings count by severity, what was fixed, anything reverted, whether the PentAGI agent run was included, and the **go-live recommendation** in plain words. Be direct: if `critical_high_open > 0`, say "Not ready for client data yet — <n> Critical/High open" and list them. On `status: refused`, show the reason (target not authorized / may hold real data) and point to `/pf-setup pentest`.
## 5. Merge (ask)
If `status: ok` and there are fixes: AskUserQuestion `Merge the pentest fixes into main and redeploy staging? Yes / No`. On Yes: merge via `MERGE-REQUEST-pentest.md` (lane `pentest`) per `bridge.md`, then re-run `/pf-pentest` to confirm the fixes closed the findings before any client-data go-live. Advise: load client data only after a clean run (zero Critical/High), and only into a host that is **not** a pentest target.
Never: target production, a live-client host or anything with real data; run without the Yes in step 2 (and the second Yes in 2b for agent/both); accept `--go`; run on a schedule; point the agent at more than the one authorized host; or leave it running after the assessment (per security-testing.md the agent is bounded to this run and stops when done).