Skip to main content
The security-threat-model skill guides your AI coding agent through a full adversarial security review of any feature, service, or integration. Starting from a Data Flow Diagram and trust boundary map, it systematically applies the STRIDE framework — Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege — to every component and data flow, scores each threat by probability and impact, and produces a prioritised risk register with specific, implementable mitigations. The output is an action-oriented security document, not a theoretical audit: every control is precise enough for an engineer to implement directly.
Type: Workflow  ·  Estimated time: 4–8 hours  ·  Framework: Microsoft STRIDE  ·  Output file: 12-security-threat-model.md  ·  Inclusion: Conditional — include when the system handles authentication, payments, PII, or any external attack surface

Best for

Pre-implementation security review

Threat-model a new feature before a single line of implementation code is written, when fixes are hours instead of weeks.

Third-party API and integration review

Analyse the attack surface opened by every new external integration — payment processors, webhooks, OAuth providers.

Pre-launch service assessment

Run a structured adversarial pass before a new service goes live to surface risks that functional testing misses.

Compliance documentation

Produce the security risk register required by PCI-DSS, SOC 2, and ISO 27001 audit programmes.

What it produces

The skill outputs a structured 12-security-threat-model.md document covering:
  • Scope and assumptions — what is modelled, what is explicitly out of scope, and the assumptions that bound the model
  • Threat actor profiles — opportunistic attackers, targeted actors, insiders, and APTs rated by likelihood
  • Data Flow Diagram with trust zones — Mermaid DFD marking every boundary where data crosses from untrusted to trusted zones
  • Asset classification table — every sensitive asset ranked by confidentiality, integrity, and availability value
  • Supply chain threat analysis — dependency CVEs, build pipeline attacks, third-party service compromise
  • STRIDE analysis tables — one table per category, each threat with Probability, Impact, Risk, Mitigation, and Residual Risk columns
  • Attack trees — for Critical threats, a decomposition of every viable attack path
  • Prioritised risk register — all threats ranked, with named owner, mitigation status, effort, and target date
  • Accepted risks log — risks consciously accepted with business justification and review date
  • Security controls checklist — pre-ship gate, ready to embed in a CI workflow

How to invoke it

Provide as much context as you can upfront — data flows, actor types, sensitive assets handled. The more context you give, the fewer clarifying questions the agent needs to ask, and the more accurate the threat model will be.

Example scenarios

The skill works equally well for broad system reviews and narrow feature-level assessments:

Key concepts

STRIDE framework (Microsoft SDL)

STRIDE provides six mutually exclusive categories that together cover all known attack classes:

Trust boundaries and DFDs

The agent draws Data Flow Diagrams before any STRIDE analysis begins. Trust boundaries — drawn as dashed lines — mark every location where data moves from a lower-trust zone to a higher-trust zone. These are the architectural locations where attackers concentrate attacks because input validation, authentication, and data exposure failures cluster there. Standard zones used in the template:

Risk scoring

Risk = Probability × Impact, assessed on a 3×3 matrix:
  • Critical — High probability + High impact → act immediately
  • High — High probability + Medium impact, or Medium probability + High impact
  • Medium — Various mid-tier combinations
  • Low — Low probability + Low impact → accept or schedule
Every mitigation must also document residual risk — the risk that remains after controls are applied. A threat marked “mitigated” without residual risk documentation gives false assurance.

Threat actor profiles

Four profiles are assessed for every model:
  1. Opportunistic — automated scanners, credential stuffing bots; defeated by hygiene
  2. Targeted — competitors, fraud rings with a specific interest; require defence-in-depth
  3. Insider — employees or contractors with legitimate access; require least-privilege and audit logs
  4. APT — nation-state or well-funded groups; require layered security and incident response

Additional analysis layers

The skill also covers areas that generic checklists miss:
  • Cryptographic threat analysis — algorithm selection, key management, TLS enforcement, timing attacks
  • Supply chain threats — dependency CVEs, compromised build pipelines, third-party service breach blast radius
  • Privacy threat modelling — data minimisation, consent, cross-border transfer controls (when PII is in scope)
  • Social engineering — phishing, pretexting, and baiting vectors relevant to the system
  • Incident response integration — for each High/Critical threat, detection alert, containment procedure, and recovery path

Interview process

The skill uses a Socratic interview before drafting, with a maximum of 2–3 questions using tool calls (not inline chat). It reads all prior .engineering-docs/ files first to avoid re-asking known information.

Output structure

The generated document (12-security-threat-model.md) follows this section order, directly matching the template:

Handoff

Reads from: Feeds into:

Quality gate

Before marking the document final, the agent verifies each of these gates:
1

Trust boundaries drawn first

Data Flow Diagrams with trust boundaries are complete before any STRIDE analysis begins. STRIDE without a DFD produces randomly enumerated threats that miss the highest-risk attack surfaces.
2

Every threat has a specific mitigation

No threat is marked mitigated with generic advice. “Validate inputs” is not a control. “Rate limit login to 5 attempts/IP/10 min with CAPTCHA after 3 failures” is.
3

Residual risk documented

Every mitigated threat carries a Residual Risk column. Threats still rated High or Critical after mitigation must be escalated for additional review.
4

All six STRIDE categories addressed

All six categories are evaluated for every component — even if some are marked “Not Applicable,” the justification must be written.
5

Risk register complete

Every High and Critical threat has a named owner, mitigation status, and a target date. The register is sorted by risk level, not discovery order.
Conditional skill — the threat model is required whenever the system handles authentication, payments, PII, tokens, admin privilege, or accepts input from external parties. For purely internal, read-only tooling with no sensitive data, it may be deferred — but document that decision.