Keystone · security
Audit against OWASP Top 10:2025, OWASP LLM Top 10 2026 (prompt injection), agent/MCP configuration (incl. the project's own MCP server), supply chain, IaC and race conditions. Read-only for code and tests. The only
file this skill may write is docs/keystone/security-ignores.md (the ignore flow). Fixing a finding is
/keystone:fix (or an edit inside /keystone:implement), never this skill. Other Keystone skills call it: plan for L changes that
touch security, verify as a gate.
Output rendering. Report and summary templates in code blocks below show structure only. Render them as Markdown —
headings, tables, bold labels, bullet lists — never wrapped in a code block (it shows as a monospace wall); keep paths
and commands in inline code. The closing Blocked on me: / Changed: / Found: lines become three bullets with bold labels.
Next step (mandatory). End the answer with a Next: line that names the step in a few words, then put the exact
command on its own, on the following line(s), inside a fenced code block with no language tag — the app shows a
copy button on a code block. Never tag it ```bash: a /keystone:* command is not a shell command, and the bash tag
adds a Run button that would fail. When nothing runs now, write Next: nothing now — waiting for <event> and put the
later command in that fenced block. Never end on a caveat or an open-ended question. A path in that command must open
from the session's working directory, because the next session (after /clear) starts there: a file inside it →
its path relative to it; a file you wrote in another repository or folder (after cd) → its absolute path.
Choice at the end (menu). When the stage leaves more than one sensible next step, end with one AskUserQuestion
menu instead of a single command, as AI Factory does: 2–4 options, the recommended one first with (Recommended),
and Stop here last. Print the report and the summary first, then ask. On a pick, carry it out: an option that
continues in this session runs now — for another Keystone skill, read ${CLAUDE_SKILL_DIR}/../<skill>/SKILL.md and
follow it with the chosen arguments; an option that needs a clean session (/clear first), an irreversible external
step (push, deploy, production) or a human action outside the chat is not run — it becomes the Next: command. With
one sensible next step, or when AskUserQuestion is unavailable (claude -p, CI), skip the menu. The Next: line
always closes the answer.
Status colors. In the chat (not in files other tools parse) mark statuses so they scan at a glance: ✅ ok / done ·
⚠️ not proven / warn / partial · ❌ missing / wrong / fail · ⏸️ BLOCKED · 🔄 in progress · ⏳ pending; verdicts and gates
🟢 PASS / pass · 🟡 PASS-UNPROVEN / warn / not proven · 🔴 FAIL / fail · ⚪ n/a; severity and risk 🔴 critical / High ·
🟠 high · 🟡 medium / Medium · 🟢 low / Low. The marker goes before the word; the word stays.
File links. Every file you write or point the user to lives inside the session's working directory
(the folder Claude Code runs in — in a worktree, the worktree, never the main checkout), and its link is relative to
that directory: [intent.md](wordpress-plugin/x/docs/keystone/<task>/intent.md), not relative to a nested repo or a
subproject. Check the link before showing it: the app opens links only from the working directory. A file outside
it (Claude's memory under ~/.claude, another repository, a temp folder) is never a link — the app cannot open
it and shows "file not found", and a path in code becomes such a link too: give its absolute path as plain
text, without backticks. Link only a file you checked exists.
Arguments: $ARGUMENTS.
Step 0 — context and ignore-list
Read, in this order, what exists: CLAUDE.md and .claude/CLAUDE.md; docs/architecture.md; .claude/rules/**/*.md
(rules with paths: frontmatter apply only to matching files); AGENTS.md.
MUST / MUST NOT lines there are project rules; a violated security MUST is a finding.
Then always read docs/keystone/security-ignores.md before any audit. If it exists, it lists the checks the team decided to ignore.
Modes
| Argument |
Scope |
| empty |
whole project: all categories in ${CLAUDE_SKILL_DIR}/references/CHECKLIST.md |
auth, injection, xss, csrf, secrets, crypto (A04), logging (A09), api, infra, iac (references/IAC.md), prompt-injection, race-condition, agent (references/AGENT-MCP.md, incl. the project's own MCP server), supply-chain (references/SUPPLY-CHAIN.md, incl. model weights) |
that category only |
| a path (file or directory) |
all categories, only code under the path |
a plan path (…/plan.md) or an active plan with no other argument |
diff of the task — see below |
ignore <id> <reason> |
add an ignore entry, then stop — no audit, no gate line |
Diff of the task: base = the same base /keystone:verify uses (P = first commit that added the plan:
git log --diff-filter=A --format=%H -- <plan>, last line; C = first commit after P; base = parent of C, or P if there is no
C). Audit git diff <base> (committed + uncommitted), reading each changed file in full, and its direct callers when the change
touches an entry point, a query, a permission check or an LLM call. For a diff scope also recommend the built-in
/security-review as a second, independent pass — it is not a substitute for the ignore-list or the gate.
Audit procedure
- Run
bash ${CLAUDE_SKILL_DIR}/scripts/audit.sh once for a whole-project or infra/secrets scope (read-only; skip for a diff
scope unless dependencies or .env handling changed). Its output is a lead, not a finding: confirm every hit in the code.
- Walk the categories of the scope in
${CLAUDE_SKILL_DIR}/references/CHECKLIST.md. Read the code; grep starters only find candidates.
Read AUTH.md, PROMPT-INJECTION.md, RACE.md, AGENT-MCP.md, SUPPLY-CHAIN.md, IAC.md or MAPPING.md (same folder) when the scope includes that category and the code needs a pattern
comparison. Skip categories the project cannot have (no LLM calls → no prompt injection) and say so in one line.
- A finding needs evidence: file:line you read, and a concrete way it is exploited. No exploit path → not a finding and not in the gate;
it may go, one line each, under
## Hardening suggestions (no severity, no effect on the gate). Before reporting, check each candidate against ${CLAUDE_SKILL_DIR}/references/DO-NOT-FLAG.md (server-controlled
values, framework-escaped output, tests, dead code, maintainer-only triggers…); a match is dropped.
- Confidence — HIGH: the exploit path is traced end to end in code you read (entry point → … → sink) → a finding. MEDIUM: plausible, but one link
is not confirmed (a caller, a config, a runtime value) → goes to
## Needs verification, never into Findings, and does not affect the gate.
LOW: speculative → not reported at all.
- Severity — pick it by the rubric in
${CLAUDE_SKILL_DIR}/references/SEVERITY.md, not by feel: the same issue must get the same rating on every run.
(CHECKLIST.md keeps the quick table; SEVERITY.md decides disputes.)
- Match each finding with the ignore-list by item id (
no-csrf, no-rate-limit, no-auth-/admin, …). A match: do NOT
flag it as a finding — put it under Ignored. An entry older than 12 months, or whose reason no longer holds in the code (e.g.
"no cookies used" but the code sets a cookie), is shown as ignored — stale, re-confirm, and counts as a warn, not as a finding.
The ignore-list — docs/keystone/security-ignores.md
/keystone:security ignore <id> <reason>: read the file (create it with the template below if absent), refuse an entry without a
reason, set Date = today, Author = git config user.name (or ask once), append the row, show the diff, confirm. Short kebab-case ids:
no-csrf, no-rate-limit, no-https, no-xss-csp, no-sql-injection, no-prompt-injection, no-race-condition,
no-secret-rotation, no-auth-{route}, verbose-errors, or a custom descriptive id.
# Security: ignored items
Items below are excluded from /keystone:security audits and from the security gate. Review periodically — ignored risks may become relevant.
| Item | Reason | Date | Author |
|------|--------|------|--------|
| no-csrf | SPA with token auth, no cookies used | 2026-03-15 | @dev |
Output
- Findings (Confidence HIGH only; when the app can run locally or on staging, offer
/keystone:pentest <your target URL> <this report> for the S-n findings too) — one block each, ordered critical → low, ids S-1…:
🔴 S-1 [critical] <title> — <file>:<line> (🔴 critical · 🟠 high · 🟡 medium · 🟢 low) then Confidence: HIGH, Entry point: (where untrusted input enters: route, handler, webhook, file, CI trigger, tool output),
Exploit: (Repro: request / input / sequence an attacker uses), Impact: (one line),
Fix: (the smallest concrete change, with the safe pattern from the references), Refs: <OWASP id> · <CWE-n> · <ASVS 5.0 chapter if clear> · <ISO 27001:2022 A.8.x if clear>
(taken from ${CLAUDE_SKILL_DIR}/references/MAPPING.md; omit a part you cannot map, never invent an id). OWASP / LLM ids always carry the edition year:
A05:2025, LLM01:2026 — never a bare A05. Never print secrets, tokens or credential values — name the variable and the location only.
1a. ## Needs verification (only if there are MEDIUM candidates) — one line each: N-1 <title> — <file>:<line> — Confidence: MEDIUM — missing link: <what to check>.
When the app can run locally or on staging, offer in one line to confirm these and any S-n findings against it:
/keystone:pentest <your target URL> <this report> (your own targets only; it confirms or lowers each finding).
Not findings, not counted in Found:, no effect on the gate; list the count in the summary.
1b. ## Hardening suggestions (optional) — one line each, no severity; never counted in Found: or the gate.
- Ignored — table: item, reason, date, author; then
N items ignored. Review them periodically.
- Gate line — last of the report body, exactly one of:
Security gate: fail — unignored critical/high: S-1, S-3
Security gate: warn — <medium/low findings, stale ignores, incomplete evidence (what could not be checked)>
Security gate: pass
Rules: fail only when an unignored critical or high finding remains. warn: only medium/low findings, stale ignores, or
incomplete audit evidence (a tool unavailable, code not readable, any UNASSESSED: line). pass: the audit completed and nothing unignored remains.
A tool that could not run (no network, missing binary — audit.sh prints these as UNASSESSED: <what>) is reported in the
report as UNASSESSED: <what> and makes the gate at least warn; it is never a silent pass.
- Summary (always, three lines):
Blocked on me: <what I need from you, or none> · Changed: <files written — at most the ignore-list, or nothing> · Found: <counts by severity; ignored count>.
The report supports ISO/IEC 27001 evidence (Annex A.8.25–8.29) but does not certify compliance.
On fail, the next step is /keystone:fix for the first critical/high finding. For ignore, report only Changed: and the new row.
Rules
- Never edit code, tests, config or the plan. Never run the application, exploit code against a live service, or install packages.
- Run only the read-only audit commands in
allowed-tools; if npm audit and friends need the network and fail, that is UNASSESSED → warn,
not pass. gitleaks (history scan) runs only through audit.sh when installed.
- A security gate from
/keystone:verify consumes only the gate line and the S-ids: keep the line format exact.
- Context is heavy after an audit. Consider
/clear or /compact before continuing with other tasks.
1---2name: security3description: "Keystone: security audit on OWASP Top 10:2025, LLM Top 10 2026 / prompt injection, agent and MCP configuration, supply chain, IaC (Dockerfile, Kubernetes, Terraform) and race conditions — whole project, a path, a category or the diff of a task. Every finding has severity, file:line, how to exploit it and a fix; ignored items live in docs/keystone/security-ignores.md with reason, date and author; ends with a machine-readable line `Security gate: pass | warn | fail` (fail only on an unignored critical/high finding). Read-only for code. Use for 'security check', 'is this secure', 'before deploy', auth/payments/user-input changes, or `ignore [id] [reason]`."4argument-hint: "[auth|injection|xss|csrf|secrets|crypto|logging|api|infra|iac|prompt-injection|race-condition|agent|supply-chain | <path> | <plan path>] | ignore <id> <reason>"5allowed-tools: Read Glob Grep Write Edit Bash(npm audit*) Bash(pip-audit*) Bash(cargo audit*) Bash(grep *) Bash(git diff*) Bash(git log*) Bash(git rev-list*) Bash(git config user.name) Bash(bash ${CLAUDE_SKILL_DIR}/scripts/audit.sh) AskUserQuestion6model: opus7effort: high8disable-model-invocation: false9metadata:10 source: https://skillmd.com/skills/sattva2020/security11---1213<!-- derived from ai-factory@2.19.0 skills/aif-security-checklist/SKILL.md (MIT); see THIRD_PARTY_NOTICES.md -->1415# Keystone · security1617Audit against OWASP Top 10:2025, OWASP LLM Top 10 2026 (prompt injection), agent/MCP configuration (incl. the project's own MCP server), supply chain, IaC and race conditions. **Read-only for code and tests.** The only18file this skill may write is `docs/keystone/security-ignores.md` (the `ignore` flow). Fixing a finding is19`/keystone:fix` (or an edit inside `/keystone:implement`), never this skill. Other Keystone skills call it: `plan` for L changes that20touch security, `verify` as a gate.2122**Output rendering.** Report and summary templates in code blocks below show structure only. Render them as Markdown —23headings, tables, **bold** labels, bullet lists — never wrapped in a code block (it shows as a monospace wall); keep paths24and commands in `inline code`. The closing `Blocked on me:` / `Changed:` / `Found:` lines become three bullets with bold labels.2526**Next step (mandatory).** End the answer with a `Next:` line that names the step in a few words, then put the exact27command on its own, on the following line(s), inside a fenced code block **with no language tag** — the app shows a28copy button on a code block. Never tag it ```bash: a `/keystone:*` command is not a shell command, and the bash tag29adds a Run button that would fail. When nothing runs now, write `Next: nothing now — waiting for <event>` and put the30later command in that fenced block. Never end on a caveat or an open-ended question. A path in that command must open31from the session's working directory, because the next session (after `/clear`) starts there: a file inside it →32its path relative to it; a file you wrote in another repository or folder (after `cd`) → its absolute path.3334**Choice at the end (menu).** When the stage leaves more than one sensible next step, end with one AskUserQuestion35menu instead of a single command, as AI Factory does: 2–4 options, the recommended one first with `(Recommended)`,36and `Stop here` last. Print the report and the summary first, then ask. On a pick, **carry it out**: an option that37continues in this session runs now — for another Keystone skill, read `${CLAUDE_SKILL_DIR}/../<skill>/SKILL.md` and38follow it with the chosen arguments; an option that needs a clean session (`/clear` first), an irreversible external39step (push, deploy, production) or a human action outside the chat is not run — it becomes the `Next:` command. With40one sensible next step, or when AskUserQuestion is unavailable (`claude -p`, CI), skip the menu. The `Next:` line41always closes the answer.4243**Status colors.** In the chat (not in files other tools parse) mark statuses so they scan at a glance: ✅ ok / done ·44⚠️ not proven / warn / partial · ❌ missing / wrong / fail · ⏸️ BLOCKED · 🔄 in progress · ⏳ pending; verdicts and gates45🟢 PASS / pass · 🟡 PASS-UNPROVEN / warn / not proven · 🔴 FAIL / fail · ⚪ n/a; severity and risk 🔴 critical / High ·46🟠 high · 🟡 medium / Medium · 🟢 low / Low. The marker goes before the word; the word stays.4748**File links.** Every file you write or point the user to lives inside the session's working directory49(the folder Claude Code runs in — in a worktree, the worktree, never the main checkout), and its link is relative to50that directory: `[intent.md](wordpress-plugin/x/docs/keystone/<task>/intent.md)`, not relative to a nested repo or a51subproject. Check the link before showing it: the app opens links only from the working directory. A file outside52it (Claude's memory under `~/.claude`, another repository, a temp folder) is **never a link** — the app cannot open53it and shows "file not found", and a path in `code` becomes such a link too: give its absolute path as plain54text, without backticks. Link only a file you checked exists.5556Arguments: `$ARGUMENTS`.5758## Step 0 — context and ignore-list5960Read, in this order, what exists: `CLAUDE.md` and `.claude/CLAUDE.md`; `docs/architecture.md`; `.claude/rules/**/*.md`61(rules with `paths:` frontmatter apply only to matching files); `AGENTS.md`.62MUST / MUST NOT lines there are project rules; a violated security MUST is a finding.6364Then **always read** `docs/keystone/security-ignores.md` before any audit. If it exists, it lists the checks the team decided to ignore.6566## Modes6768| Argument | Scope |69|---|---|70| empty | whole project: all categories in `${CLAUDE_SKILL_DIR}/references/CHECKLIST.md` |71| `auth`, `injection`, `xss`, `csrf`, `secrets`, `crypto` (A04), `logging` (A09), `api`, `infra`, `iac` (`references/IAC.md`), `prompt-injection`, `race-condition`, `agent` (`references/AGENT-MCP.md`, incl. the project's own MCP server), `supply-chain` (`references/SUPPLY-CHAIN.md`, incl. model weights) | that category only |72| a path (file or directory) | all categories, only code under the path |73| a plan path (`…/plan.md`) or an active plan with no other argument | **diff of the task** — see below |74| `ignore <id> <reason>` | add an ignore entry, then stop — no audit, no gate line |7576**Diff of the task:** base = the same base `/keystone:verify` uses (`P` = first commit that added the plan:77`git log --diff-filter=A --format=%H -- <plan>`, last line; `C` = first commit after `P`; base = parent of `C`, or `P` if there is no78`C`). Audit `git diff <base>` (committed + uncommitted), reading each changed file in full, and its direct callers when the change79touches an entry point, a query, a permission check or an LLM call. For a diff scope also recommend the built-in80`/security-review` as a second, independent pass — it is not a substitute for the ignore-list or the gate.8182## Audit procedure83841. Run `bash ${CLAUDE_SKILL_DIR}/scripts/audit.sh` once for a whole-project or `infra`/`secrets` scope (read-only; skip for a diff85 scope unless dependencies or `.env` handling changed). Its output is a lead, not a finding: confirm every hit in the code.862. Walk the categories of the scope in `${CLAUDE_SKILL_DIR}/references/CHECKLIST.md`. Read the code; grep starters only find candidates.87 Read `AUTH.md`, `PROMPT-INJECTION.md`, `RACE.md`, `AGENT-MCP.md`, `SUPPLY-CHAIN.md`, `IAC.md` or `MAPPING.md` (same folder) when the scope includes that category and the code needs a pattern88 comparison. Skip categories the project cannot have (no LLM calls → no prompt injection) and say so in one line.893. A finding needs evidence: file:line you read, and a concrete way it is exploited. No exploit path → not a finding and not in the gate;90 it may go, one line each, under `## Hardening suggestions` (no severity, no effect on the gate). **Before reporting, check each candidate against `${CLAUDE_SKILL_DIR}/references/DO-NOT-FLAG.md`** (server-controlled91 values, framework-escaped output, tests, dead code, maintainer-only triggers…); a match is dropped.924. **Confidence** — HIGH: the exploit path is traced end to end in code you read (entry point → … → sink) → a finding. MEDIUM: plausible, but one link93 is not confirmed (a caller, a config, a runtime value) → goes to `## Needs verification`, **never** into Findings, and does not affect the gate.94 LOW: speculative → not reported at all.955. **Severity — pick it by the rubric in `${CLAUDE_SKILL_DIR}/references/SEVERITY.md`, not by feel**: the same issue must get the same rating on every run.96 (CHECKLIST.md keeps the quick table; SEVERITY.md decides disputes.)976. Match each finding with the ignore-list **by item id** (`no-csrf`, `no-rate-limit`, `no-auth-/admin`, …). A match: do **NOT**98 flag it as a finding — put it under Ignored. An entry older than 12 months, or whose reason no longer holds in the code (e.g.99 "no cookies used" but the code sets a cookie), is shown as `ignored — stale, re-confirm`, and counts as a warn, not as a finding.100101## The ignore-list — `docs/keystone/security-ignores.md`102103`/keystone:security ignore <id> <reason>`: read the file (create it with the template below if absent), refuse an entry without a104reason, set Date = today, Author = `git config user.name` (or ask once), append the row, show the diff, confirm. Short kebab-case ids:105`no-csrf`, `no-rate-limit`, `no-https`, `no-xss-csp`, `no-sql-injection`, `no-prompt-injection`, `no-race-condition`,106`no-secret-rotation`, `no-auth-{route}`, `verbose-errors`, or a custom descriptive id.107108```markdown109# Security: ignored items110111Items below are excluded from /keystone:security audits and from the security gate. Review periodically — ignored risks may become relevant.112113| Item | Reason | Date | Author |114|------|--------|------|--------|115| no-csrf | SPA with token auth, no cookies used | 2026-03-15 | @dev |116```117118## Output1191201. **Findings** (Confidence HIGH only; when the app can run locally or on staging, offer `/keystone:pentest <your target URL> <this report>` for the S-n findings too) — one block each, ordered critical → low, ids `S-1…`:121 `🔴 S-1 [critical] <title> — <file>:<line>` (🔴 critical · 🟠 high · 🟡 medium · 🟢 low) then `Confidence: HIGH`, `Entry point:` (where untrusted input enters: route, handler, webhook, file, CI trigger, tool output),122 `Exploit:` (Repro: request / input / sequence an attacker uses), `Impact:` (one line),123 `Fix:` (the smallest concrete change, with the safe pattern from the references), `Refs: <OWASP id> · <CWE-n> · <ASVS 5.0 chapter if clear> · <ISO 27001:2022 A.8.x if clear>`124 (taken from `${CLAUDE_SKILL_DIR}/references/MAPPING.md`; omit a part you cannot map, never invent an id). **OWASP / LLM ids always carry the edition year:**125 `A05:2025`, `LLM01:2026` — never a bare `A05`. Never print secrets, tokens or credential values — name the variable and the location only.1261a. `## Needs verification` (only if there are MEDIUM candidates) — one line each: `N-1 <title> — <file>:<line> — Confidence: MEDIUM — missing link: <what to check>`.127 When the app can run locally or on staging, offer in one line to confirm these and any S-n findings against it:128 `/keystone:pentest <your target URL> <this report>` (your own targets only; it confirms or lowers each finding).129 Not findings, not counted in `Found:`, no effect on the gate; list the count in the summary.1301b. `## Hardening suggestions` (optional) — one line each, no severity; never counted in `Found:` or the gate.1312. **Ignored** — table: item, reason, date, author; then `N items ignored. Review them periodically.`1323. **Gate line** — last of the report body, exactly one of:133 - `Security gate: fail — unignored critical/high: S-1, S-3`134 - `Security gate: warn — <medium/low findings, stale ignores, incomplete evidence (what could not be checked)>`135 - `Security gate: pass`136 Rules: **fail** only when an unignored critical or high finding remains. **warn**: only medium/low findings, stale ignores, or137 incomplete audit evidence (a tool unavailable, code not readable, any `UNASSESSED:` line). **pass**: the audit completed and nothing unignored remains.138 A tool that could not run (no network, missing binary — `audit.sh` prints these as `UNASSESSED: <what>`) is reported in the139 report as `UNASSESSED: <what>` and makes the gate at least `warn`; it is never a silent `pass`.1404. **Summary** (always, three lines): `Blocked on me: <what I need from you, or none>` · `Changed: <files written — at most the141 ignore-list, or nothing>` · `Found: <counts by severity; ignored count>`.142143The report supports ISO/IEC 27001 evidence (Annex A.8.25–8.29) but does not certify compliance.144145On `fail`, the next step is `/keystone:fix` for the first critical/high finding. For `ignore`, report only `Changed:` and the new row.146147## Rules148149- Never edit code, tests, config or the plan. Never run the application, exploit code against a live service, or install packages.150- Run only the read-only audit commands in `allowed-tools`; if `npm audit` and friends need the network and fail, that is `UNASSESSED` → `warn`,151 not `pass`. `gitleaks` (history scan) runs only through `audit.sh` when installed.152- A security gate from `/keystone:verify` consumes only the gate line and the S-ids: keep the line format exact.153- Context is heavy after an audit. Consider `/clear` or `/compact` before continuing with other tasks.