Skip to content
Back to skills

Threat Model

ASecurity

Threat model a feature before it is built, listing principals and their authority, protected assets, trust boundaries with the strongest control on each, an entry point by boundary by attack class matrix, the risks of giving agents tools and authority, and mitigations mapped to build slices, saved as a short threat-model.md. Use when the user types /threat-model or asks to threat model a design, spec, charter or new feature, map the attack surface or the security risks of a design, list abuse...

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsrustgoawssecurity

Works with

  • cli
  • mcp

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add Ilexpwh/istack --skill threat-model --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Threat Model?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Threat Model
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ilexpwh-threat-model/badge)](https://www.skillsdirectory.com/skills/ilexpwh-threat-model)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: threat-model
description: Threat model a feature before it is built, listing principals and their authority, protected assets, trust boundaries with the strongest control on each, an entry point by boundary by attack class matrix, the risks of giving agents tools and authority, and mitigations mapped to build slices, saved as a short threat-model.md. Use when the user types /threat-model or asks to threat model a design, spec, charter or new feature, map the attack surface or the security risks of a design, list abuse cases, run STRIDE, or weigh prompt injection and agent permissions before building. Not for checking a diff that already exists (security-check).
disable-model-invocation: true
metadata:
  phase: review
---

# Threat model

A short `threat-model.md` that says who could cross which boundary in a new feature, what stops them today, and which build slice adds each missing control.

## When to use
- Before building a feature that touches sign-in, permissions, tenant data, payments, uploads, outbound calls, webhooks or secrets.
- Before giving an agent tools, credentials or the power to act for a person.
- The `feature` playbook's design step flags auth, data access or agent authority.

**Not for:** reviewing code that already exists (`security-check`) or a full security audit.

## Steps
1. **Frame the feature.** Read the charter, design notes and the code the feature will touch. Copy `assets/threat-model.md` next to the design note from `architect` (else the ledger's `run/threat-model-<slug>.md`) and fill its header: the feature in one sentence, its inputs and the source commit. *Done when:* the header is filled and every input is linked.
2. **List principals and their authority.** Include every actor: anonymous visitors, signed-in users, users of other tenants, admins, operators, service accounts, CI jobs, third-party callers, agents and MCP servers. For each, record how it is authenticated, what it may do by design, and what it must never do. *Done when:* every principal has a "must never" line.
3. **List protected resources.** Data, money, credentials, compute and spend, availability, and other users' trust. Give each an owner and the worst outcome if it is lost. *Done when:* every resource has an owner and a worst outcome.
4. **Map trust boundaries and their controls.** A boundary is any place where data or control passes between principals, processes or networks. For each, name the strongest control and cite it as `file:line`, or write "depends on deployment: <the exact fact>". Mark boundaries this feature adds as new, with control "none yet" until a slice builds one. *Done when:* every boundary has a cited control, "depends on deployment: <fact>" or "none yet".
5. **Fill the threat matrix.** List the entry points: routes, jobs, queues, webhooks, uploads, CLI flags, model context and tool calls. Cross each with the boundaries it reaches and the classes in `references/attack-classes.md` that apply. Keep a cell only when a named principal could get a concrete result. *Done when:* each kept cell names the principal, the threat, today's control and the gap.
6. **Model agent authority.** When the feature lets an agent read, write, spend or send on someone's behalf, work through the agent section of `references/attack-classes.md`: excessive agency, approval bound to the exact action, tool and MCP trust, prompt injection from untrusted content, and loops that spend without a bound. *Done when:* each agent tool has its identity, allowed actions, approval rule and untrusted inputs written down, or the section says "no agent authority".
7. **Map mitigations to slices.** For each gap, choose the smallest control at the last trusted decision point, the slice that builds it (`plan-slices`), the test that proves it, and an owner. A risk left unmitigated goes under Accepted risks only when a named human accepts it; the agent never accepts risk. Unknown facts go under Open facts. *Done when:* every gap has a slice and a test, a named human's acceptance, or an open question.
8. **Challenge the model.** Give a fresh agent the design and the draft model, without your reasoning, and ask it to find a missing principal, entry point or boundary. Add what holds up. *Done when:* the challenge result is noted in the file, or the file says no fresh agent was available.
9. **Save and record.** Keep the file to about two pages; cut cells without a named principal and result. With an active ledger, run `decide` for each mitigation-to-slice choice and `block --id <id> --need '<fact>' --command '<how to check>'` for each open fact, using `../ledger/scripts/ledger.py`. Flag the slices that need `security-check` at review. *Done when:* the file is saved and the ledger matches its open facts.

## Red flags
| If you're thinking | Do this instead |
|---|---|
| "Users are signed in, so they're trusted." | Signed in is not authorised. Write what each principal may do and must never do. |
| "The gateway handles that." | Cite where. If it isn't in the repo, write "depends on deployment: <fact>" and open a question. |
| "The system prompt tells the agent not to." | A prompt is not a control. Name the deterministic check, scoped credential or approval. |
| "The user approved the tool call." | The approval must bind the exact tool, arguments, target and expiry. A changed argument needs a new approval. |
| "I'll cover every STRIDE letter for every component." | Keep cells with a named principal and a concrete result. A long matrix hides the three that matter. |
| "We'll add security after it works." | Map each mitigation to a slice now, with a test. |
| "This risk is unlikely, I'll accept it." | Only a human accepts risk. Record who. |

## Verify
- [ ] Every principal has its authentication, authority and "must never".
- [ ] Every boundary has a control cited as `file:line`, "depends on deployment: <fact>" or "none yet".
- [ ] Every kept matrix cell names a principal, a result, today's control and the gap.
- [ ] The agent section is filled, or says "no agent authority".
- [ ] Every gap maps to a slice with a test, an acceptance by a named human, or an open fact.
- [ ] The file is about two pages or less.

## Reply
```
Threat model: <feature>, saved to <path>

Top risks (up to 5):
| Risk | Principal -> result | Mitigation | Slice |

Agent authority: <one line, or "none">
Needs your sign-off: <numbered accepted risks, or "none">
Open facts: <numbered: fact, who can answer>
Review hooks: <slices that need security-check>
```

## Credits
Mapping principals, their authority and the controls on each boundary, inventorying entry surfaces against sinks, and citing facts as `file:line` or marking them deployment-dependent follow the reconnaissance phase of Cloudflare's MIT-licensed `security-audit` skill. The agent section draws on its AI and LLM companion: excessive agency, approvals bound to the exact action, tool metadata that is not policy, and prompt injection that matters only when it crosses a code-level boundary. Prose is original to this pack.

Files in this skill

  • SKILL.md6.9 KB
  • agents/openai.yaml236 B
  • assets/threat-model.md1.2 KB
  • references/attack-classes.md4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.