agentleFS
dafaalzdafaalz/agent-skills/skills/security-audit/SKILL.md

security-audit

Skill2 starsChanged 52 days agoMITView on GitHub

Use when auditing codebases for security vulnerabilities, conducting threat modeling, reviewing auth boundaries, evaluating exploitability, or verifying security fixes. Don't use for feature development (use executing-plans), code formatting (use s13n), or routine dependency upgrades (author dependency updates directly or use package manager commands).

192 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use create-stories, story-done and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • lilangMaxSkill

    create-stories

    Break a single epic into implementable story files. Reads the epic, its GDD, governing ADRs, and control manifest. Each story embeds its GDD requirement TR-ID, ADR guidance, acceptance criteria, story type, and test evidence path. Run after /create-epics for each epic.

    Also in 11 projects that use this

  • lilangMaxSkill

    story-done

    End-of-story completion review. Reads the story file, verifies each acceptance criterion against the implementation, checks for GDD/ADR deviations, prompts code review, updates story status to Complete, and surfaces the next ready story from the sprint.

    Also in 11 projects that use this

  • nicepkgSkill

    community-led-growth

    Expert in community-led growth (CLG) - leveraging user communities to drive acquisition, retention, and expansion. Covers building developer communities, user groups, ambassador programs, and turning customers into advocates. Knows the difference between community as a feature vs community as a growth engine, and how to measure community ROI. Use when "community-led, CLG, ambassador program, champion program, user community, developer community, word of mouth, user group, " mentioned.

    Also in 5 projects that use this

  • nicepkgSkill

    ph-community-outreach

    Engage Reddit, Indie Hackers, Hacker News and other communities for Product Hunt launches. Use this skill to identify relevant communities, craft appropriate posts, and drive cross-platform engagement without appearing spammy.

    Also in 5 projects that use this

  • +7 more from lilangMax
  • +1 more from nicepkg

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 173 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When user intent between modes is ambiguous, ask one clarifying question before creating files or starting the full workflow.

    line 21
  2. Distinctive:

    No external network access.

    line 34
  3. Distinctive:

    Read-only target source and toolchain mounts.

    line 36
  4. Distinctive:

    Use dummy principals, fixtures, and tokens.

    line 39
  5. Distinctive:

    Follow these six sequential phases in full audit mode.

    line 88
  6. Distinctive:

    Ask clarifying questions one at a time with concrete options and recommendations if scope boundaries or test harnesses require confirmation.

    line 106
  7. Distinctive:

    Wait for explicit user confirmation before proceeding.

    line 107
  8. Very specific:

    Run at most 3 waves total (initial plus two critic-triggered).

    line 116
  9. Very specific:

    Write all final records to findings.json.

    line 134
  10. Distinctive:

    Document the minimal source-grounded code remediation for every confirmed vulnerability.

    line 137
  11. Distinctive:

    Only confirmed records receive severity ratings.

    line 155

“Common” is measured: kept by at least 6 in 10 of the 173 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security audit

Find source-grounded vulnerabilities that violate a real trust boundary, then give owners source evidence, safe reproduction steps, priority calibration, and the smallest effective fix. This is a defensive, source-first workflow. A candidate without an affected principal, concrete resource, and observable security outcome is not a confirmed finding.

<HARD-GATE> Write-Target Boundary. Read-only against the target repository. Write only under `<output-dir>/` declared in Full audit setup. Do not commit, push, or modify files inside the target repository. Do not probe external endpoints, shared infrastructure, production identities, or live control planes. Local processes must run inside an isolated local sandbox. Any deviation requires explicit user approval recorded in `<output-dir>/sandbox-exception.md`. </HARD-GATE>

Modes

This skill operates in guidance mode by default. Loading it does not authorize unsolicited file creation or execution of the full audit workflow.

  • Guidance mode. For security questions, focused reviews, methodology checks, triage, or investigating specific findings, use only the relevant parts of this skill. Do not create run directories or audit report files. Launch focused subagents when helpful and return results directly to the active task.
  • Full audit mode. Use the complete workflow only when the user explicitly requests an audit of a codebase, asks for an end-to-end security review, or requests formal report artifacts. Run all phases in sequence and write the required artifacts.

When user intent between modes is ambiguous, ask one clarifying question before creating files or starting the full workflow.

Platform terminology and roles

This skill coordinates specialized agent roles:

  • Parent. The orchestrator that owns run metadata, directory setup, and shared state files.
  • Task tool. The platform delegation or subagent mechanism.
  • Research agent. A read-only subagent for source exploration and factual verification without disk modifications.
  • General agent. A delegated subagent for bounded investigation, sandboxed reproduction, and isolated verification.

Universal execution safety

These invariants apply across all modes. Source inspection is strictly read-only. Run target-controlled builds, tests, processes, browsers, and parsers only inside an OS-enforced sandbox providing:

  • No external network access. Use an isolated loopback namespace only when testing local client or server traffic.
  • An empty environment populated from an explicit allowlist with safe values, using scratch-local directories for temporary files and caches.
  • Read-only target source and toolchain mounts. Target-controlled processes may write only inside their assigned scratch directory.
  • Strict limits on CPU, memory, process count, file size, disk usage, and wall-clock duration.

Use dummy principals, fixtures, and tokens. Never probe deployed endpoints, external services, shared infrastructure, production identities, or live control planes. If a decisive fact cannot be evaluated locally or through source analysis, record it as needing validation.

Full audit setup

In full audit mode, resolve these configuration values before reconnaissance:

  • Skill directory. The absolute path to this skill directory.
  • Target. The absolute repository root under audit.
  • Repo name. A stable repository identifier from the directory or local git remote.
  • Output directory. A writable directory outside the target, defaulting to ~/security-audit-skill/<repo-name>/run-<N>, where <N> is the next unused integer.
  • Source ref. The reviewed commit hash and worktree status.

Write isolation

The parent agent creates and exclusively updates shared run files:

  • run-metadata.json
  • architecture.md
  • coverage-ledger.json
  • findings.json
  • REPORT.md
  • FINDINGS-DETAIL.md
  • NEEDS-VALIDATION.md

Each hunter and verifier receives an isolated workspace under <output-dir>/agents/<agent-id>/ with separate scratch/ and artifacts/ directories. Target-controlled processes write only to scratch/. The parent alone promotes allowlisted files to artifacts/ using descriptor-based no-follow traversal. Review references/hunting.md and references/validation-and-reporting.md for exact promotion procedures.

Progressive disclosure and domain guides

Consult specific reference guides on demand based on target architecture:

Domain or taskReference fileTrigger conditions
Attack classes and taxonomyreferences/attack-classes.mdBaseline injection, access control, SSRF, path traversal
Reconnaissance and scopingreferences/reconnaissance.mdMapping entry surfaces, trust boundaries, and ledger units
Hunter wave coordinationreferences/hunting.mdDispatching hunter waves and managing agent scratch spaces
Verification and reportingreferences/validation-and-reporting.mdIndependent verification, schema validation, and deliverables
Web and authenticationreferences/web-protocol-and-auth.mdHTTP framing, cookies, sessions, JWT, OAuth 2.1, OIDC, SAML
Client-side and browserreferences/client-side.mdDOM XSS, prototype pollution, Trusted Types, CSP, postMessage
Cloud and deploymentreferences/cloud-and-deployment.mdCloud IAM, Kubernetes, containers, IMDSv2, ingress, secrets
Credentials and secret hygienereferences/credentials-hygiene.mdSafe verification, token masking, zero exposure inspection
Supply chain and releasereferences/supply-chain-and-release.mdDependencies, CI workflows, SLSA provenance, build inputs
AI, LLM, and agentsreferences/ai-and-llm.mdPrompt assembly, RAG context, MCP servers, tool-call loops
Memory safety and binaryreferences/memory-safety-and-binary.mdC, C++, Rust unsafe, FFI, parsers, allocators, race conditions
Data isolation and lifecyclereferences/data-isolation-and-lifecycle.mdMulti-tenancy, BOLA, object links, soft deletion, retention
Desktop, mobile, and IPCreferences/desktop-mobile-and-local-ipc.mdDeep links, webview bridges, Electron, IPC daemons, helpers
Protocols, RPC, and messagingreferences/protocols-rpc-and-messaging.mdgRPC, Protobuf, GraphQL transports, webhooks, message queues
Resource exhaustionreferences/resource-exhaustion-and-availability.mdReDoS, amplification, memory leaks, queue starvation
BaaS and fullstack frameworksreferences/baas-and-fullstack-frameworks.mdNext.js, Supabase, Firebase, Convex, Prisma, Server Actions

Full audit workflow

Follow these six sequential phases in full audit mode.

Phase 1. Discovery

Map source structure, trust boundaries, entrypoints, local build paths, and initial coverage units:

  • Inspect project configuration, package manifests, route definitions, and permission decorators.
  • Select applicable domain companion guides from references/.
  • Seed the deterministic coverage ledger with initial units.
  • Consult references/reconnaissance.md for ledger schema and domain selection rules.

Completion criterion. An initial coverage-ledger.json seeded with all in-scope boundaries is written to disk.

Phase 2. Threat modeling and trust boundaries

Align with the user on attack surface priority, trade-offs, and run profile before dispatching hunters:

  • Present the mapped trust boundaries, entrypoints, and sensitive assets discovered in Phase 1.
  • Formulate 2 to 3 distinct audit approaches with trade-offs. For example, compare a targeted auth and API sweep against deep data lifecycle analysis or a full-spectrum audit.
  • State the proposed run profile (quick, standard, or deep) and agent invocation budget.
  • Ask clarifying questions one at a time with concrete options and recommendations if scope boundaries or test harnesses require confirmation.
  • Wait for explicit user confirmation before proceeding.

Completion criterion. Explicit user approval is recorded for the selected audit approach, scope paths, and run profile.

Phase 3. Vulnerability scanning

Assign ledger units to focused hunter agents in waves:

  • Hunter agents inspect source invariants and execute sandboxed local checks where safe.
  • Hunters output structured JSON candidates with source traces, proof-of-concept inputs, and observed results.
  • Run at most 3 waves total (initial plus two critic-triggered). After wave 3, record all unresolved units as deferred and proceed to Phase 4. Emit .agents/state/security-audit/wave-log.json with wave_number, units_assigned, units_candidate, units_deferred, and terminal: true when waves end.
  • Consult references/hunting.md and references/attack-classes.md for hunting rules.

Completion criterion. All planned ledger units resolve to candidate, covered, or deferred states with zero unassigned units, and .agents/state/security-audit/wave-log.json is written to disk.

Phase 4. Exploitability verification

Subject every candidate vulnerability to independent verification:

  • Deduplicate candidates by unique vulnerability fingerprint.
  • Dispatch fresh, isolated verifier agents with clean contexts for each candidate.
  • Verifiers attempt independent reproduction and confirm source invariants.
  • Consult references/validation-and-reporting.md for verification protocols.

Completion criterion. Every candidate receives an evaluation from an isolated verifier and an assigned confirmed, needs-validation, or rejected verdict. The count of needs-validation verdicts must be less than 30 percent of total candidates. If 30 percent or more are needs-validation, stop and ask the user whether to widen sandbox scope or reduce candidate scope before proceeding.

Phase 5. Remediation guidance

Compile verified results into structured machine-readable format and formulate precise remediations:

  • Write all final records to findings.json.
  • Validate findings with scripts/validate-findings.cjs.
  • Validate coverage claims with scripts/validate-coverage-ledger.cjs.
  • Document the minimal source-grounded code remediation for every confirmed vulnerability.

Completion criterion. Both validation scripts execute with exit code 0 against the generated output files and remediations are documented.

Phase 6. Verification re-test

Re-verify confirmed records against current target source and generate audit deliverables:

  • Re-verify that code references and line numbers match current target source.
  • If the target source has moved since Phase 5, record the delta SHA in .agents/state/security-audit/source-drift.json and re-verify only the findings whose primary source path changed. Do not re-run hunter waves. If more than 10 findings are affected by drift, stop and ask the user whether to close the current audit against the pinned SHA or restart with the new SHA as the new source_ref.
  • Produce REPORT.md with executive posture, methodology, and coverage metrics.
  • Produce FINDINGS-DETAIL.md with confirmed vulnerabilities, source traces, and fixes.
  • Produce NEEDS-VALIDATION.md with hypotheses blocked on external environment facts.
  • Exclude live probe instructions or exploit payloads that target external systems.

Completion criterion. All three report markdown files match validated records and code references align with the target source revision.

Severity calibration

Only confirmed records receive severity ratings. Overall severity must not exceed observed impact:

  • critical. An unauthenticated actor gains code execution, full datastore compromise, or arbitrary account takeover.
  • high. An actor fully defeats an explicit security control with real consequences, including auth bypass, cross-tenant data access, or stored script execution affecting other users.
  • medium. A boundary violation with limited blast radius, uncommon preconditions, or impact restricted to narrow resources.
  • low. Disclosure of non-sensitive internal state or effects requiring disproportionate effort for minor impact.
  • informational. A confirmed observation with minimal standalone impact, useful as part of defense-in-depth.

Anti-patterns

IDTitlePattern descriptionWhy it failsConcrete fix
SEC-1Checklist as vulnerabilityReports a framework or config checklist omission without an exploit pathNot actionable; inflates finding count without confirming trust-boundary violationRequire an exploitable trust boundary and demonstrable impact
SEC-2Hardening adviceEmits general best-practice prose without a source-grounded findingCannot be validated against repository evidenceGround all findings in a proven breach of a source invariant
SEC-3External network probeSends traffic to deployed systems outside the sandboxViolates universal execution safety and audit scopeTest only against local sandboxed processes and mock endpoints
SEC-4Cloud config guessAsserts cloud, proxy, or browser behavior not declared in repo configFails source-grounding barAssert only behaviors declared directly in repository configuration
SEC-5Same-principal confusionTreats authorized self-service actions as privilege escalationMiscategorized severity; erodes trust in findingsValidate multi-principal or unauthenticated boundaries only
SEC-6Scoping skipLaunches hunter waves before user confirms approach and budgetViolates Phase 2 completion criterionSecure explicit user confirmation on approach, scope, and budget
SEC-7Prose-only findingEmits markdown findings without JSON reproduction evidenceNot machine-verifiable; cannot be re-testedBack every finding with structured JSON reproduction evidence
SEC-8Target mutationEdits target repository code or configs during auditCorrupts the audit baseline and violates HARD-GATEKeep target read-only; emit patches externally

Boundary isolation

Security audits operate in an advisory capacity. Never modify production database data, commit mock credentials to git, or weaken production security controls during audit probing.

Quick audit checklist

Review this table before completing security audit tasks:

CheckPassing condition
Source groundingEvery finding traces directly to a vulnerable code path in repository source
Boundary validationExploitable trust boundary demonstrated between distinct principals
Sandboxed executionLocal processes run inside sandboxes without external network traffic
Scope confirmationUser explicitly approved audit approach, scope boundaries, and budget
Deliverable validationSchema validator scripts pass and report files reflect confirmed findings

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.