/security:security-scanfrom security
Runs an exhaustive security audit on a repository, scoped path, or Git change set. Produces threat models, findings, and attack-path reports in markdown and JSON.
Ships in security. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Audit a target for security vulnerabilities, keep the phases separate, and produce final markdown and JSON reports. Resolve the target mode first, then run the shared pipeline with that mode's scope rules.
Resolve exactly one mode from the request before substantive work:
| Target the user names | Mode | Capability profile | Scope reference |
|---|---|---|---|
| Whole repository, or a path / package / folder / submodule | repo / scoped | security_scan | references/repository-wide-scan.md (and the repo-wide references it lists) |
| Pull request, commit, branch diff, or working-tree patch | diff | security_diff_scan | references/scan-scope-diff.md |
Read references/config-preflight.md and run the preflight with the capability profile for the resolved mode (security_scan for repo/scoped, security_diff_scan for diff) before substantive scan work.
Follow the returned block/warn/suggest/ready results.
On a blocked or incomplete result, present the exact reasons and advisory guidance to the user and ask before proceeding; do not auto-fail.
Do not treat a config value that differs from a suggested patch as a warning unless the capability requirement itself is unmet.
This scan is exhaustive — it deep-reviews files with one file-review subagent per file (or tiny shard), so the work scales with the number of files reviewed.
After the capability preflight returns ready and the target and mode are resolved, and before any substantive (model-heavy) work — threat model, ranking, or dispatching file-review subagents — scope the work with the scaling rule, present it, and get explicit approval.
<python_command> <plugin_dir>/scripts/generate_rank_input.py make-repo-rank-input --repo <repo_root> --scope <scope> --out <discovery_dir>/rank_input.jsonl — its row count is the in-scope source-like file count.
For diff: make-diff-rank-input — its rows are the changed files, all deep-reviewed.
Reuse this rank_input.jsonl in discovery; do not regenerate it.files × planned top-percent / 100 files getting full-file review (about one file-review subagent pass each), plus ranking, validation, attack-path, and report; diff ≈ the changed-file count.
You may also give a rough input-token count for one full review pass as the total size of the in-scope files in characters divided by about 4 (the ~4-chars-per-token rule), times the pass count.
Report token counts, not money — do not estimate a dollar cost; that depends on token pricing, model, and input/output/cache ratios that change.top-percent, the approximate number of file-review passes, and the optional token-count figure.
Then stop and wait for the user's explicit approval (for example "proceed") before starting the threat model, ranking, or any file-review subagent.
This is a binary go/no-go on the scan as scoped — do not propose narrowing the scope, lowering top-percent, or switching modes.
Silence or a vague "scan my repo" is not approval; proceed without waiting only if the user's request already explicitly approved this scope.Keep these phases distinct and run them in linear order. Each phase is a reference in this skill:
references/phase-threat-model.mdreferences/phase-finding-discovery.mdreferences/phase-validation.mdreferences/phase-attack-path-analysis.mdFor each phase: read that phase reference, load only the inputs it requires, complete its workflow and checklist, then read the next. Do not read ahead into later phases until the current one has completed. Do not amortize effort across phases. Treat explicit invocation of this scan as the user's authorization to use the subagents the workflow requires; if subagents are unavailable, explain the limitation instead of claiming exhaustive coverage.
The path references in this skill are default locations.
If the user explicitly provides a different path for a required input or output, use theirs instead.
If a required input is still missing, stop and ask.
Use the shared artifact path conventions in references/scan-artifacts.md.
After the capability preflight returns ready, if your host has goal/todo/task-tracking tools, create a goal capturing the coverage objective; otherwise state the same objective in your first visible update and track it yourself.
The objective should state that the scan must not stop until the resolved in-scope files/worklist rows are covered and the required coverage artifacts prove that closure.
If a compatible active goal already exists, continue under it instead of creating a duplicate. Do not mark the goal complete until:
deferred, not_applicable, or suppressed closure with exact reason (repo/scoped closure: references/repository-wide-scan.md; diff closure: references/scan-scope-diff.md)Start this plan only after the capability preflight has returned ready and the Scope and Cost Gate has been approved by the user.
Follow it in order; do not skip ahead to a later phase until the current phase has produced its intended output.
repo_name, security_scans_dir, scan_id, scan_dir, and artifacts_dir using references/scan-artifacts.md.Goal Setup.references/phase-threat-model.md first.references/phase-finding-discovery.md against the resolved scope:references/repository-wide-scan.md and every reference it lists.
Stop at discovery only when the ranked runtime-surface worklist exists and the coverage ledger has closed every applicable high-impact and seeded root-control row as suppressed, not_applicable, or deferred with exact reasons.
Open, reportable, or unresolved seeded rows continue to validation.references/scan-scope-diff.md.
Generate rank_input.jsonl from the changed files and deep-review every row.
If discovery finds no technically plausible candidates, finalize a no-findings report and stop.references/phase-validation.md for each candidate from discovery and each open, reportable, or deferred seeded/root-control ledger row that still needs closure.references/scan-artifacts.md is part of the validation input.
Every candidate must have a discovery receipt before validation and a validation receipt before final reporting.references/phase-attack-path-analysis.md for findings and validation closure rows that still need reportability, attack-path, and severity analysis.ignore, suppressed, or deferred.references/final-report.md; do not hand-author reports.
Then run python <plugin_dir>/scripts/finalize_scan_contract.py --scan-dir <scan_dir> --source-root <repo_root> to project the validated JSON into the final markdown report.references/finding-detail-fields.md from the same validated evidence used in the generated report.AGENTS.md.Populate all final report semantics in the canonical manifest, findings, and coverage JSON using references/final-report.md.
Then run python <plugin_dir>/scripts/finalize_scan_contract.py --scan-dir <scan_dir> --source-root <repo_root>; finalization owns markdown report generation.
Read references/shared-hard-rules.md first.
The mode's detailed rules live in its scope reference (references/repository-wide-scan.md for repo/scoped, references/scan-scope-diff.md for diff).
Across both modes:
Do not begin substantive scan work (threat model, ranking, or any file-review subagent) until the Scope and Cost Gate has presented the scope and the user has explicitly approved it.
Explicit invocation authorizes the workflow and subagent use, not the run as scoped; get that approval separately unless the user's request already gave it.
The gate is a binary go/no-go; do not propose narrowing the scope.
Create or adopt the scan goal only after the capability preflight has returned ready, and before substantive scan work.
Do not complete it until the resolved in-scope files/worklist rows, candidate ledgers, and final report meet the Goal Setup closure criteria.
For every scan scope, candidate-finding coverage is required.
Do not finalize a candidate finding until its candidate-ledger path from references/scan-artifacts.md shows discovery, validation, and attack-path receipts for that exact candidate, or an explicit deferred reason for the missing proof.
Subagent dispatch must have explicit ownership: ranking subagents own one generated rank_shards/*.input.jsonl shard of at most five rows and write only its matching worker-local .output.jsonl; file-review subagents own one assessed file or tiny shard and return full-file receipts plus pre-dedupe finding objects with candidate-local validation evidence and attack-path facts; validation subagents own one candidate or ledger row; attack-path subagents own one validated candidate or closure row; the parent agent owns bounded worker orchestration, ledger reconciliation, aggregation, cross-file dedupe, and final closure.
These subagent-dispatch rules are purpose-built for security scanning and take precedence over any general subagent skill (e.g. subagent-patterns) during a scan.
Candidate ids are optional links from coverage rows to findings; a not_applicable, suppressed, or deferred row is still required when the surface was in scope.
Final assembly must start from reportable validation closure rows and surviving candidates. Do not drop a reportable seeded/root-control row because attack-path analysis or discovery spent more prose on a neighboring same-family finding.
Final reporting is incomplete when a promoted high-impact finding's affected lines omit the concrete root-control file/line discovered or seeded during discovery, such as a codec, converter, parser feature setup, class filter, resource-path control, protocol state transition, or self-service update guard. Add the root-control affected line or explicitly suppress/defer it with exact counterevidence before finalizing.
Preserve independently reachable sibling instances through final reporting. Repeated vulnerable templates, query builders, parser operations, auth/object endpoints, or shared-helper callers need separate finding entries, affected lines, and dispositions; put grouping in summary prose only after the individual instances are emitted.
For query/parser injection, do not suppress syntax-control evidence solely because a later business check appears to limit impact. Carry the injection candidate until validation proves the exact query API and post-query guard defeat semantic change for that instance.
ATTRIBUTION.md (opens in a new tab)examples/completed-scan/coverage.json (opens in a new tab)examples/completed-scan/findings.json (opens in a new tab)examples/completed-scan/scan-manifest.json (opens in a new tab)preflight/capability-profiles.toml (opens in a new tab)references/attack-path-facts.md (opens in a new tab)references/config-preflight.md (opens in a new tab)references/final-report.md (opens in a new tab)references/finding-detail-fields.md (opens in a new tab)references/phase-attack-path-analysis.md (opens in a new tab)references/phase-finding-discovery.md (opens in a new tab)references/phase-threat-model.md (opens in a new tab)references/phase-validation.md (opens in a new tab)references/repo-wide-artifacts-and-ledger.md (opens in a new tab)references/repo-wide-high-impact-families.md (opens in a new tab)references/repo-wide-instance-expansion.md (opens in a new tab)references/repo-wide-validation-closure.md (opens in a new tab)references/repository-wide-scan.md (opens in a new tab)references/scan-artifacts-and-ledger.md (opens in a new tab)references/scan-artifacts.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ahgraber/skills --plugin security4 skills in this plugin
/security-deep-scanUse when the user asks for a deep, exhaustive, multi-pass, or variance-reducing repository-wide or scoped-path security scan. Run repeated independent discovery passes over one resolved scope with worker-specific threat models, semantically merge candidates, synthesize one canonical validation threat model, then run validation, attack-path analysis, canonical JSON completion, and generated reporting once. Do not use for PRs, commits, branch diffs, or working-tree diffs./security-fix-findingUse when the user explicitly asks to fix and verify a validated or plausible security finding. Do not use as the primary trigger for full PR, commit, branch, patch, or repository scans./security-Other plugins' skills for the same job