agentleFS
hemapriyan-rkhemapriyan-rk/claude-rigor-skills/skills/secure-code-review/SKILL.md

secure-code-review

Skill1 starsChanged 49 days agoMITView on GitHub

Review code, a diff, or a PR for exploitable security and correctness bugs, ranked by real attacker impact, not style. Use for code or security review requests and before merging anything that crosses a trust boundary (user input, auth, service calls, file or network I/O).

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use vulnerability-triage, threat-modeling and 2 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.
  • superagent-aiSkill

    vulnerability-triage

    Triage inbound vulnerability reports - GitHub Advisories (GHSA/CVE), bug bounty submissions, HackerOne/Bugcrowd/Intigriti exports, or a researcher's issue - to decide whether a finding is real, by-design, or noise. Reads the report offline, cross-references the project's documented intent and threat model (SECURITY.md, README, code, closed issues), statically audits any PoC without executing it, and emits a structured markdown triage report with a P0-P3 / By-Design severity and a recommended action. Use whenever the user asks to triage, assess, or score a vulnerability report, advisory, CVE, GHSA, or bug bounty submission, or asks "is this a real finding or by-design?".

    Also in 3 projects that use this

  • msewellSkill

    threat-modeling

    Produces structured threat models for software systems using STRIDE on data flow diagrams. Generates DFDs with trust boundaries, identifies threats per element, scores risks, and defines concrete mitigations. Outputs a complete threat model Markdown document through phased, interactive delivery. Use when threat modeling a system, analyzing security threats, identifying attack surfaces, performing STRIDE analysis, assessing security risks in architecture, creating a threat model document, or when the user mentions threat model, attack surface, trust boundaries, STRIDE, or security risk analysis.

    Also in 3 projects that use this

  • AnthropicSkill

    competitive-analysis

    Framework for building competitive landscape decks — market positioning, competitor deep-dives, comparative analysis, strategic synthesis. Use when the user asks for a competitive landscape, competitor analysis, peer comparison, market positioning assessment, strategic review, or investment memo deck. Also triggers on "who are the competitors to X", "benchmark X against peers", "build a market map", or any request to systematically evaluate competitive dynamics across an industry.

    Also in 3 projects that use this

  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Races and TOCTOU: Check-then-act on shared state, especially between a permission check and the action it guards, or a read-then-update of …

    line 25
  2. Distinctive:

    Before reporting, check coverage: every checklist item you went through is either a finding or something you confirmed is handled.

    line 34
  3. Distinctive:

    Use this format. Rank by exploitability, not by how easy the finding was to spot.

    line 38
  4. Distinctive:

    If nothing is Critical, say so plainly.

    line 54

“Common” is measured: kept by at least 6 in 10 of the 15 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

Secure Code Review

A review that lists forty style nits and misses the one auth bypass is worse than no review. Find what an attacker can actually use, prove it with a concrete request, and stop.

1. Set scope and budget

  • Review what was asked. For a diff or PR, review the changed lines plus the code they call into. For a file, that file plus the functions it calls. Don't read the whole repository unless asked to.
  • Size the effort to the risk. Code handling auth, payments, crypto, file paths, or shell/SQL gets the full checklist. Internal utilities with no untrusted input get a quick pass of steps 2 and 3 only.
  • Read everything you need in one step. Read the code together with the reference files that apply, in parallel. The references are in this skill's base directory: references/auth-checklist.md if the code handles login, sessions, tokens, password reset, or role checks; references/sinks.md if it builds SQL, shell commands, file paths, templates, or outbound URLs. Skip any reference that doesn't apply.
  • Read the whole unit once before judging lines. A line that looks fine alone can break an invariant set elsewhere in the file.

2. Map trust boundaries

List every place untrusted data enters: request bodies, headers, query strings, cookies, file contents, environment, other services' responses, database values written by users. Then follow each one to where it is used. Most real bugs sit on these paths.

3. Check in priority order

  1. Authentication and authorization. Who is the caller, and how is that proven? Any identity taken from a client-controlled header, any "internal" caller trusted without proof, any check that fails open on an exception. Go through every item in references/auth-checklist.md that applies.
  2. Injection. Untrusted data reaching an interpreter: SQL, shell, templates, deserializers, file paths, URLs fetched server-side. Check the actual sink, not whether input "looks sanitized." Use the section of references/sinks.md for the language in front of you.
  3. Races and TOCTOU. Check-then-act on shared state, especially between a permission check and the action it guards, or a read-then-update of a single-use token.
  4. Swallowed failures. A caught exception that logs and continues past a failed check is a silent bypass.
  5. Secrets. Hardcoded keys, secrets in logs or error responses.
  6. Unsafe defaults. Fail-open behavior, debug modes, permissive CORS, missing rate limits on credential endpoints.

4. Prove each finding

For every finding, state the exact input or request that exploits it and what the attacker gets. If you can't construct one, it's Low or not a finding. Don't report theoretical issues as Critical.

Before reporting, check coverage: every checklist item you went through is either a finding or something you confirmed is handled. Minor items still go in Low, in one line each.

5. Report

Use this format. Rank by exploitability, not by how easy the finding was to spot.

## Critical | High | Medium | Low
- `file:line` **What's wrong.** Exploit: <the request or input> → <what the attacker gets>. Fix: <the specific change>.

For example:

## Critical
- `routes/files.js:9` **SQL injection in rename.** Exploit: `{"id": "1 OR 1=1", "name": "x"}` → renames every file. Fix: `db.run("UPDATE files SET name = ? WHERE id = ? AND owner_id = ?", name, id, req.user.id)`.
  • One finding per root cause. Merge duplicates.
  • End with one line naming what to fix first.
  • If nothing is Critical, say so plainly. Don't pad the list to look thorough.

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.