agent-security-hardening
AFaffaan-m/ECC315k4,381 new stars in the last 7 days
Audit current changes, a path, or the full project for quality, security, performance, or test problems and record durable findings. Independent mode prepares or completes a fresh-reviewer checkpoint handoff. Use for /audit, independent review, security review, code quality review, dead code, duplication, or standards drift.
Context reuse: Reuse any required file already loaded in project instructions or the current session. Read it again only if absent, changed, or exact current bytes or line references are needed.
First action: Before project inspection, preflight, or any other tool call,
publish running to blueprint/.state/run.json when blueprint/.state/
exists. From the project root, run the first helper that exists,
node .agents/skills/blueprint-doctor/scripts/run-state.mjs or
node .claude/skills/blueprint-doctor/scripts/run-state.mjs, with start --command <skill> --summary "<truthful summary>" --boundary <read-only|reviewed|local-only>. Use update at milestones, with --status blocked --resume <command> for a blocker, and finish --status ready|completed
at the end; --help lists every option and blueprint/workflow.md has the full
activity contract. A missing or failing helper is a warning, not a blocker.
Where this sits in the workflow:
/implement or /autopilot -> [audit] -> fixes or /complete
(code exists) (review + (repair quality issues
ledger) or close the feature)
/check proves behavior against the spec. /blueprint-doctor checks Blueprint setup and
workflow health. This skill checks the code itself through either a broad review
or one focused lens: quality, security, performance, or tests.
It reviews code without changing it: it never edits source files, installs
dependencies, commits, merges, pushes, or starts product work. A normal audit's
one write is the findings ledger at blueprint/context/findings.md (Step 4),
the durable record of findings and their status. Independent mode may also
write blueprint/context/review.md using the exact record contract in
reference/independent-review.md.
The quality-gate config controls when another workflow invokes this skill
automatically. An explicit /audit or $audit request always selects the audit
regardless of whether the applicable gate is manual, conditional, or always.
A selected independentReview gate invokes independent mode instead of letting
the builder satisfy its own review. When both audit and independent review are
selected, one passing independent review satisfies the audit gate.
A missing config means built-in defaults. If it exists but is invalid, stop and
point to /blueprint-doctor before writing the findings ledger.
Treat scope and lens as separate controls. Arguments may appear in either order,
such as /audit security current or /audit src/auth tests.
Optional scope:
current when an active feature exists, otherwise use
changed when local changes exist, otherwise use fullcurrent: audit the active current-feature.md, every committed feature-branch
change from its merge base through HEAD, staged and unstaged changes,
untracked source files, and nearby code affected by the featurechanged: audit staged, unstaged, and untracked source files plus nearby codefull: audit all project-owned source, tests, and configuration while excluding
dependencies, generated files, build output, coverage output, caches, vendored
code, and minified assets unless the user explicitly includes themOptional lens:
quality: maintainability, duplication, dead code, consistency, complexity,
and standards driftsecurity: authorization, input trust, injection, data exposure, secret
handling, and unsafe configurationperformance: query, network, rendering, memory, payload, concurrency, and
unbounded-work riskstests: missing coverage for important logic, weak assertions, skipped or
focused tests, poor isolation, brittle mocks, and likely flakinessfull is always the full-project scope, not a lens. /audit full therefore runs
all lenses across the full project. When only a lens is supplied, select scope
with the normal no-scope rules. A focused pass may name one or more lenses. If
the request names multiple lenses, review their union and report them separately.
If the requested scope is unclear, pick the smallest useful scope and state it. If the lens is unclear, use all lenses and state that choice.
Optional review mode:
independent: prepare or complete an independent review of current across
all four lenses. It cannot be combined with changed, full, a path scope,
or a focused lens because a completion receipt must cover the whole active
work item./audit independent current is a two-context workflow. The builder prepares a
request. With review.independentExecution: "manual", the selected fresh
reviewer session runs the same command to complete it. With automatic, the
current adapter may start a fresh isolated reviewer subagent after preparing the
request. Blueprint verifies the exact target and later staleness. The adapter,
model, and fresh-context identity remain declared metadata.
An explicit invocation uses this execution setting even when the active
workflow's independentReview gate is manual; that gate value disables only
automatic selection by the workflow.
Read reference/independent-review.md before either phase. It holds the
record contract and both procedures: Phase A prepares the handoff when
blueprint/context/review.md has no current pending request for HEAD and
the current spec hash; Phase B performs the review when a current pending
request exists.
The builder never performs Phase B itself. Never let the builder review its own work or skip a selected independent-review gate.
Resolve this required context:
AGENTS.mdblueprint/config.jsonblueprint/context/project-overview.md, targeted: search it for the scope's
feature, paths, and distinctive nouns. Read the matching passages plus the
security and data passages they touch, meaning the trust, access, and tenancy
facts in Users and Usage model and the affected Data model entries. Do not
read the whole overview by default.blueprint/context/coding-standards.mdblueprint/context/current-feature.mdblueprint/context/findings.md, for existing IDs and statusesblueprint/context/review.md, for independent request and receipt stateblueprint/build-plan.md, when feature order mattersFor current, changed, and path scopes, begin with the diff or named area and
follow only the callers, dependencies, tests, and contracts needed to verify a
reachable finding. Do not survey unrelated directories. For full, preserve the
declared exclusions and inspect by bounded area rather than dumping the project
into one response.
For current, resolve the comparison base without network access:
main, then master.HEAD, then add
staged, unstaged, and untracked work.Do not fetch or pull to discover the base. For full, state the excluded paths
before reviewing so generated or third-party code does not consume the audit.
Prefer rg and targeted file reads. Do not dump large files into the response.
Use existing commands only. Do not install tools.
Run or inspect only the signals relevant to the selected lens and scope:
Do not run broad checks unrelated to a focused lens. If a useful command is missing, report that as a gap. Do not invent a pass or claim that a focused review covered the other lenses.
For all lenses, ground findings in reachable code and project-specific expectations. Apply only the selected lens or lenses:
Do not nitpick harmless style differences unless they signal drift from the local patterns. Prefer a short list of real findings over a broad list of guesses.
For a proportionality finding, state in Suggested fix what can be deleted,
which existing, standard-library, native-platform, or installed mechanism
replaces it, and which current requirement would be lost. Use None when no
current requirement would be lost. If the suggested fix removes or changes
shipped behavior, require an explicit user decision and never describe it as an
automatic repair.
Do not broaden a focused pass because another category might be interesting. Do not report or call out non-critical concerns from omitted lenses, even as suggestions for a later audit. If an obvious P0 is directly encountered outside the selected lens, report and record it as an out-of-lens critical risk, but do not continue searching that other lens.
If a possible secret is found, never quote its value, paste the matching source line, or include raw command output containing it. Report only the redacted secret category, file, line, risk, and remediation. Redact sensitive values from all audit evidence before responding.
blueprint/context/findings.md is the durable record of findings. Chat reports
do not survive a context clear; the ledger does. It is the only file this skill
writes. If it is missing (an older install), create it with a # Findings
heading first.
The ledger never scopes the review. Review the code fresh in Step 3, then record what the review found. Working from the open findings as a checklist and verifying only those is the exact failure this file exists to prevent: a repair can introduce a new defect that no existing entry points at.
One block per finding. The header line is the machine-readable contract and must keep this exact shape; the prose below it is for humans and may vary:
### F-03 [P0] open - Retained auth volumes carry the run label
**File:** ops/agent-proof/compose.yaml:86
**Found:** 2026-07-21 by /audit (scope: current; lens: security)
**Why it matters:** ...
**Suggested fix:** ...
**Resolution:**
IDs are sequential within the ledger (F-01, F-02, ...), never reused and
never renumbered while their entries live here, even after a finding closes.
Bare IDs are scoped to the live ledger: /complete archives resolved entries
under a work-item prefix (feature 12's first F-03 becomes 12/F-03, and its
second build's becomes 12-build-2/F-03). The build attempt comes from the verified
spec, not arbitrary filename text; fix prefixes stay their archive filenames. That prefixed form is the permanent reference. A later
ledger that has emptied and reset starts at F-01 again without colliding. Severity reuses the P0-P3
scheme from Step 5; only P0 and P1 block /complete. Status is one of:
| Status | Meaning | Blocks P0/P1 at /complete |
|---|---|---|
unverified | Suspected, no confirming evidence yet | No |
open | Confirmed, not yet repaired | Yes |
fixed | Repaired, not yet re-reviewed | Yes |
closed | Repaired and re-reviewed against the new code | No |
accepted | Not fixing, by the user's explicit decision; reason recorded in Resolution | No |
invalid | Re-examination proved the finding wrong; evidence recorded in Resolution | No |
After the review:
open with the next sequential ID, one
past the highest ID present in the ledger (entries carried forward from
earlier work count; a fresh ledger starts at F-01).unverified. It is a lead, not a
defect, and never gates a merge.fixed finding to closed only when all three hold: this pass's
reviewed set included the finding's file, re-examining the repaired code
confirmed the original defect is gone and the repair introduced no new one,
and the report names the finding as closed. An unrelated new finding in the
same file gets its own entry and does not keep the repaired one open. Never
close a finding implicitly.accepted only on the user's explicit decision in the current session,
and record their reason. Never accept a finding on their behalf.invalid only when re-examination shows the finding was wrong, and
record that evidence in Resolution. It is a review verdict (or the
user's explicit call), never a shortcut past the gate for blocked work.fixed blocking /complete is deliberate: a repair is not done when the code
changes, it is done when a review has looked at the result. /implement marks
repairs fixed; only a review pass moves them to closed.
Lead with findings, ordered by severity, using the IDs the ledger assigned:
F-04 [P1] Title
File: path:line
Why it matters: ...
Suggested fix: ...
Severity:
P0 - data loss, security break, or code that cannot shipP1 - likely bug, broken contract, missing guard, or high-risk duplicationP2 - maintainability issue worth fixing before the feature closesP3 - small cleanup, consistency issue, or follow-up candidateUse P0 or P1 only when a concrete code path, violated contract or security
boundary, failing command or test, or reproducible behavior confirms the risk. If
the evidence is incomplete, list it under Unverified risks with the missing
validation instead of presenting it as a confirmed high-severity finding.
An otherwise pure proportionality finding is P2 or P3. Raise it to P0 or P1 only
when the unnecessary machinery causes a concrete reachable defect or violates an
established security or data-integrity boundary.
If there are no findings, say that clearly for the selected lens and name any remaining risk or missing signal, such as "no test command declared" or "browser flow not audited."
Then include:
current, when availableFor full, say whether coverage was complete or partial. Never label a partial
review as a full-project audit.
blueprint/context/findings.md and blueprint/context/review.md.
Never edit, format, install, commit, merge, push, or delete anything else.Format the output to match the project's conventions in
blueprint/context/ai-interaction.md: concise, scannable markdown, with lists for
enumerations and tables for matrices rather than dense paragraphs.
AFaffaan-m/ECC315k4,381 new stars in the last 7 days
Audit the whole repo: find bugs, security holes and performance bottlenecks. Get a ranked report in plain English.
DIDietrichGebert/ponytail203k4,904 new stars in the last 7 days
GAgarrytan/gstack143k598 new stars in the last 7 days
ADaddyosmani/agent-skills122k1,667 new stars in the last 7 days
Harden code against the OWASP Top 10: input handling, authentication, sessions and dependencies.
ADaddyosmani/agent-skills122k1,667 new stars in the last 7 days
RUruvnet/RuView106k739 new stars in the last 7 days