agentleFS
arjunprabhulalarjunprabhulal/agent-skills/skills/security/threat-modeling/SKILL.md

threat-modeling

Skill4 starsChanged 4 months agoMITView on GitHub

Works out what could go wrong in a system's design before it is built — who would attack it, how, and which defences are worth having. Use this whenever the user is designing a system that handles sensitive data, money, or authentication, asks what the security risks are, mentions threat modeling or STRIDE, or is starting a feature with a meaningful attack surface. This is design-time and systematic; for finding vulnerabilities in code that exists, use security-analysis.

29 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use supply-chain-security, architecture-review and 3 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.
  • MicrosoftSkill

    supply-chain-security

    Activate when reviewing or modifying dependency resolution, lockfile schema, package downloaders, signature/integrity checks, file integration cleanup, or anything that could expose APM to dependency confusion, typosquatting, malicious packages, or token leakage.

    Also in 3 projects that use this

  • SentrySkill

    architecture-review

    Staff-level codebase health review. Finds monolithic modules, silent failures, type safety gaps, test coverage holes, and LLM-friendliness issues.

    Also in 4 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    skill-authoring

    Write Agent Skills that comply with the agentskills.io specification. WHEN: "create a skill", "new skill", "write a skill", "skill template", "skill structure", "review skill", "skill PR", "skill compliance", "SKILL.md format", "skill frontmatter", "skill best practices". DO NOT USE FOR: general documentation. INVOKES: vally CLI.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 27 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep it to one diagram someone can hold in their head.

    line 30
  2. Distinctive:

    Done when: every trust boundary in the design is marked.

    line 32
  3. Distinctive:

    Done when: every element has been walked against all six.

    line 66

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

Threat modeling

Threat modeling asks what could go wrong here while the answer is still cheap to act on. Code review finds the bug you wrote; threat modeling finds the defence you never designed.

Four questions structure the whole exercise:

  1. What are we building?
  2. What can go wrong?
  3. What are we going to do about it?
  4. Did we do a good enough job?

The output is a short list of decisions, not a risk register nobody reads.

1. Draw the system and mark the trust boundaries

You cannot reason about attacks without knowing where untrusted things meet trusted things.

Sketch: the components, the data flows between them, the datastores, and — most importantly — the trust boundaries those flows cross. A boundary is anywhere the level of trust changes: internet to your edge, your service to a third party, one tenant's data to another's, user to admin.

Keep it to one diagram someone can hold in their head. See diagramming.

Done when: every trust boundary in the design is marked.

2. Name the attackers and what they want

Generic "hackers" produces generic mitigations. Be specific about who and why:

  • An anonymous internet user: the largest population, lowest capability
  • A legitimate user acting maliciously: has valid credentials. Most under-modelled, and the source of most real access-control failures
  • A compromised account: a real user whose credentials were stolen
  • A malicious or compromised insider: has infrastructure access
  • A compromised dependency: code you did not write, running with your privileges

For each, what would they want here? Data, money, disruption, access to something else? An attacker with no motive for your system is not worth designing against.

Done when: each attacker has a stated capability and objective.

3. Walk each element with a prompt list

Systematic beats creative. Use STRIDE against each component and flow:

ThreatAsk
SSpoofingCan someone pretend to be another user or service?
TTamperingCan data be modified in transit or at rest?
RRepudiationCould someone deny an action, and could you prove otherwise?
IInformation disclosureCan data leak to someone who should not see it?
DDenial of serviceCan someone make it unavailable, cheaply?
EElevation of privilegeCan someone gain rights they should not have?

The prompt list matters because it surfaces the categories you do not naturally think about — repudiation and DoS are consistently the ones teams skip.

Done when: every element has been walked against all six.

4. Prioritise by reachability and impact

You cannot mitigate everything. Rank by:

  • Who can reach it: anonymous internet > authenticated user > admin > physical access
  • What it gets them: full compromise > other users' data > their own data > information
  • How hard: a single request > a chained multi-step attack > requires an insider

Then decide, explicitly, for each: mitigate, accept, transfer, or eliminate. Accepting a risk is a legitimate decision when written down with a reason. Silently not addressing it is not the same thing, and the difference matters at the review afterwards.

Done when: each threat has a named decision, including the accepted ones.

5. Prefer structural mitigations

Rank the fixes by how hard they are to get wrong later:

  1. Eliminate — do not store the data, do not build the feature. Nothing beats not having it
  2. Structural — a permission boundary, a separate credential, a network segment. Holds even when someone writes a bug
  3. Code-level — validation, encoding, authorization checks. Effective and easy to omit on a new path
  4. Detective — logging, alerting. Does not prevent, but bounds the damage

A control that depends on every future developer remembering it will eventually fail. Push protections down to where the platform enforces them.

Done when: the important threats have structural, not procedural, mitigations.

6. Write it down briefly, and revisit it

A page or two: the diagram, the boundaries, the ranked threats, the decisions.

Revisit when the design changes materially — a new integration, a new data type, a new user role. A threat model from before the third-party integration does not cover it.

Done when: the document is short enough that it will be read again.

Report

Give the diagram, the top threats with their decisions, and — separately — the accepted risks with their reasoning. That accepted list is the most valuable output: it is the record of what you knowingly chose, which is what distinguishes a considered design from an oversight.

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.