Repository threat model

Writes a repository-grounded threat model: trust boundaries, assets, attacker capabilities and ranked abuse paths with mitigations, asking you to confirm key assumptions before the final file. Use when you explicitly ask to threat model a codebase.

SecurityPack: OpenAI skills81 linessecurity-threat-model
Author
Source
openai/skills/skills/.curated/security-threat-model @ 49f948f
License
Apache-2.0

About this skill

What it does

The skill writes a threat model of a repository, or of one path in it, grounded in the code rather than a generic checklist. The agent maps components, data stores, integrations and entry points; separates runtime code from CI, build tooling and tests; draws trust boundaries as concrete edges with protocol, auth, validation and rate limits; lists the assets that drive risk; and states what a realistic attacker can and cannot do, so severity is not inflated. Threats are written as a small number of abuse paths tied to assets and ranked by low, medium or high likelihood and impact, each with a short reason.

Before the final report it stops, lists the assumptions that most affect the ranking and asks one to three questions about deployment, internet exposure, auth, data sensitivity or multi-tenancy. Mitigations are tied to a component, boundary or entry point, existing ones with evidence kept apart from recommended ones. The result goes to <repo-or-dir-name>-threat-model.md.

references/prompt-template.md holds the output contract: a system prompt, a repository-summary prompt and the exact report sections, with a Mermaid data-flow diagram, asset and attack-surface tables, a threat table with IDs TM-001, TM-002 and thirteen columns from prerequisites to detection ideas, and focus paths for a later review. references/security-controls-and-assets.md lists asset and control categories.

When to use it, and when not

Use it before a security review of an unfamiliar service, before exposing a system to the internet or new tenants, or to decide where review effort goes.

Its description limits it to explicit requests for threat modelling or abuse paths. It is not for architecture summaries, code review or general design work, and it fixes nothing.

How to run it

The install command below puts SKILL.md, both references, agents/openai.yaml and the licence in place. Expect a pause for your answers before the file appears. To call it:

  • Claude Code: /security-threat-model, or ask for the skill by name.
  • Codex: $security-threat-model.
  • Cursor: type / in the Agent chat and pick security-threat-model.

Example: /security-threat-model Threat model services/api. It is internet-facing and multi-tenant.

OpenAI has marked openai/skills deprecated; our copy is pinned to a commit there, and as of November 2026 openai/plugins has no newer version of this skill. The threat-model skill in its Codex Security plugin is a different one: a phase of that plugin's security scan.

How it differs from similar skills

SECURITY_MODEL.md for review tools writes rules for automated scanners — invariants, reportable classes, owner-confirmed exclusions; this skill writes a report for people. Security best-practice review checks code against framework rules and Security review audits a diff; both can start from the focus paths this skill lists. Security hardening includes a five-minute STRIDE pass while writing code, much lighter than this. Security audit for codebases and services and the Claude Security plugin begin with a similar step, a map of trust boundaries or a threat model of the repository. Then they hunt for vulnerabilities themselves and verify each finding; this skill stops at the model.

Install

Run one command — it saves SKILL.md and the files it uses into your agent's skills folder. Claude Code and Codex pick up a new skill without a restart; if it does not show up, restart the agent.

Claude Code — macOS, Linux
curl -fsSL --create-dirs -o ~/.claude/skills/security-threat-model/SKILL.md https://anymodel.org/en/skills/openai/security-threat-model/SKILL.md -o ~/.claude/skills/security-threat-model/LICENSE.txt https://anymodel.org/en/skills/openai/security-threat-model/LICENSE.txt -o ~/.claude/skills/security-threat-model/agents/openai.yaml https://anymodel.org/en/skills/openai/security-threat-model/agents/openai.yaml -o ~/.claude/skills/security-threat-model/references/prompt-template.md https://anymodel.org/en/skills/openai/security-threat-model/references/prompt-template.md -o ~/.claude/skills/security-threat-model/references/security-controls-and-assets.md https://anymodel.org/en/skills/openai/security-threat-model/references/security-controls-and-assets.md
Codex, Cursor — macOS, Linux
curl -fsSL --create-dirs -o ~/.agents/skills/security-threat-model/SKILL.md https://anymodel.org/en/skills/openai/security-threat-model/SKILL.md -o ~/.agents/skills/security-threat-model/LICENSE.txt https://anymodel.org/en/skills/openai/security-threat-model/LICENSE.txt -o ~/.agents/skills/security-threat-model/agents/openai.yaml https://anymodel.org/en/skills/openai/security-threat-model/agents/openai.yaml -o ~/.agents/skills/security-threat-model/references/prompt-template.md https://anymodel.org/en/skills/openai/security-threat-model/references/prompt-template.md -o ~/.agents/skills/security-threat-model/references/security-controls-and-assets.md https://anymodel.org/en/skills/openai/security-threat-model/references/security-controls-and-assets.md
Claude Code — Windows PowerShell
foreach ($f in 'SKILL.md','LICENSE.txt','agents/openai.yaml','references/prompt-template.md','references/security-controls-and-assets.md') { $p = Join-Path "$HOME\.claude\skills\security-threat-model" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/openai/security-threat-model/$f" -UseBasicParsing -OutFile $p }
Codex, Cursor — Windows PowerShell
foreach ($f in 'SKILL.md','LICENSE.txt','agents/openai.yaml','references/prompt-template.md','references/security-controls-and-assets.md') { $p = Join-Path "$HOME\.agents\skills\security-threat-model" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/openai/security-threat-model/$f" -UseBasicParsing -OutFile $p }

Any other agent: save the file into its skills folder, or give it the link to the file: https://anymodel.org/en/skills/openai/security-threat-model/SKILL.md

SKILL.md

Raw

Threat Model Source Code Repo

Deliver an actionable AppSec-grade threat model that is specific to the repository or a project path, not a generic checklist. Anchor every architectural claim to evidence in the repo and keep assumptions explicit. Prioritizing realistic attacker goals and concrete impacts over generic checklists.

Quick start

  1. Collect (or infer) inputs:
  • Repo root path and any in-scope paths.
  • Intended usage, deployment model, internet exposure, and auth expectations (if known).
  • Any existing repository summary or architecture spec.
  • Use prompts in references/prompt-template.md to generate a repository summary.
  • Follow the required output contract in references/prompt-template.md. Use it verbatim when possible.

Workflow

1) Scope and extract the system model

  • Identify primary components, data stores, and external integrations from the repo summary.
  • Identify how the system runs (server, CLI, library, worker) and its entrypoints.
  • Separate runtime behavior from CI/build/dev tooling and from tests/examples.
  • Map the in-scope locations to those components and exclude out-of-scope items explicitly.
  • Do not claim components, flows, or controls without evidence.

2) Derive boundaries, assets, and entry points

  • Enumerate trust boundaries as concrete edges between components, noting protocol, auth, encryption, validation, and rate limiting.
  • List assets that drive risk (data, credentials, models, config, compute resources, audit logs).
  • Identify entry points (endpoints, upload surfaces, parsers/decoders, job triggers, admin tooling, logging/error sinks).

3) Calibrate assets and attacker capabilities

  • List the assets that drive risk (credentials, PII, integrity-critical state, availability-critical components, build artifacts).
  • Describe realistic attacker capabilities based on exposure and intended usage.
  • Explicitly note non-capabilities to avoid inflated severity.

4) Enumerate threats as abuse paths

  • Prefer attacker goals that map to assets and boundaries (exfiltration, privilege escalation, integrity compromise, denial of service).
  • Classify each threat and tie it to impacted assets.
  • Keep the number of threats small but high quality.

5) Prioritize with explicit likelihood and impact reasoning

  • Use qualitative likelihood and impact (low/medium/high) with short justifications.
  • Set overall priority (critical/high/medium/low) using likelihood x impact, adjusted for existing controls.
  • State which assumptions most influence the ranking.

6) Validate service context and assumptions with the user

  • Summarize key assumptions that materially affect threat ranking or scope, then ask the user to confirm or correct them.
  • Ask 1–3 targeted questions to resolve missing context (service owner and environment, scale/users, deployment model, authn/authz, internet exposure, data sensitivity, multi-tenancy).
  • Pause and wait for user feedback before producing the final report.
  • If the user declines or can’t answer, state which assumptions remain and how they influence priority.

7) Recommend mitigations and focus paths

  • Distinguish existing mitigations (with evidence) from recommended mitigations.
  • Tie mitigations to concrete locations (component, boundary, or entry point) and control types (authZ checks, input validation, schema enforcement, sandboxing, rate limits, secrets isolation, audit logging).
  • Prefer specific implementation hints over generic advice (e.g., "enforce schema at gateway for upload payloads" vs "validate inputs").
  • Base recommendations on validated user context; if assumptions remain unresolved, mark recommendations as conditional.

8) Run a quality check before finalizing

  • Confirm all discovered entrypoints are covered.
  • Confirm each trust boundary is represented in threats.
  • Confirm runtime vs CI/dev separation.
  • Confirm user clarifications (or explicit non-responses) are reflected.
  • Confirm assumptions and open questions are explicit.
  • Confirm that the format of the report matches closely the required output format defined in prompt template: references/prompt-template.md
  • Write the final Markdown to a file named <repo-or-dir-name>-threat-model.md (use the basename of the repo root, or the in-scope directory if you were asked to model a subpath).

Risk prioritization guidance (illustrative, not exhaustive)

  • High: pre-auth RCE, auth bypass, cross-tenant access, sensitive data exfiltration, key or token theft, model or config integrity compromise, sandbox escape.
  • Medium: targeted DoS of critical components, partial data exposure, rate-limit bypass with measurable impact, log/metrics poisoning that affects detection.
  • Low: low-sensitivity info leaks, noisy DoS with easy mitigation, issues requiring unlikely preconditions.

References

  • Output contract and full prompt template: references/prompt-template.md
  • Optional controls/asset list: references/security-controls-and-assets.md

Only load the reference files you need. Keep the final result concise, grounded, and reviewable.

Connect through AnyModel API

This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.

More from the pack OpenAI skills

ASP.NET Core apps

Guides the agent through current ASP.NET Core practice: choosing Blazor, Razor Pages, MVC or Minimal APIs, Program.cs and middleware order, auth, EF Core, tests and upgrades to .NET 10. Use when building, reviewing or upgrading an ASP.NET Core app.

ChatGPT Apps SDK

Builds ChatGPT apps on the Apps SDK: reads current OpenAI docs first, picks an app archetype, plans MCP tools, adapts an official example or scaffolds a Node server and widget, then tests in Developer Mode. Use when building or fixing an app inside ChatGPT.

CLI creator from API docs

Builds a durable CLI from API docs, an OpenAPI spec, curls or a script: JSON output, doctor and dry-run commands, safe auth, installed on PATH and paired with a companion skill. Use when an agent keeps hitting the same service through ad hoc calls.

Define a measurable goal

Turns a fuzzy intention into one measurable goal with a validator, scope and stop condition, then registers it via get_goal and create_goal. Use before goal-backed or long-running agent work, when "done" needs a number or a check.

Address GitHub PR comments

Fetches all comments, reviews and inline threads on the current branch's GitHub PR with a gh GraphQL script, numbers them and fixes only the ones you pick. Use when a PR has review comments to work through and you want to choose which get changed.

Fix failing GitHub Actions checks

Finds failing GitHub Actions checks on a PR with gh, pulls the logs, extracts the failure snippet and drafts a fix plan, changing code only after approval. Use when a PR's CI is red and you want the cause and a plan before any edit.

Jupyter notebooks

Creates and tidies Jupyter notebooks for experiments or tutorials from bundled templates via a stdlib script, with structure patterns and a run-top-to-bottom checklist. Use when starting a notebook or turning a messy one into something others can rerun.

Linear issues and projects

Works with Linear issues, projects and cycles through Linear's MCP server in a fixed order: setup, scope, read, then write, with sample workflows for triage, sprints and releases. Use when an agent should read or update Linear as part of a task.

Deploy to Netlify

Deploys the current project to Netlify with `npx netlify`: checks the login, links the folder to a site by Git remote or creates one, builds locally and returns a preview or production URL. Use when you want to publish a site to Netlify from your machine.

Browser automation with Playwright CLI

Drives a real browser from the terminal with playwright-cli: snapshots give element refs for clicks and typing, plus screenshots, console, network and traces, with no test files written. Use when a task needs a browser clicked through step by step.

Deploy to Render

Deploys an app to Render from a Git repo: writes and validates a render.yaml Blueprint with services, databases and secrets, or creates one service through the Render MCP server, then checks status and logs. Use when an app needs hosting on Render.

Security best-practice review

Checks Python, JavaScript/TypeScript and Go code against bundled security specs for ten frameworks, writes a report by severity with line numbers and fixes one finding at a time. Use when you explicitly ask for a security best-practice review.

Sentry issues and events

Reads Sentry issues and events through the sentry CLI without changing anything: recent production errors, issue and event details, AI root-cause summaries, with PII redacted. Use when you ask what is failing in production according to Sentry.

Deploy to Vercel

Deploys a project to Vercel, as a preview unless told otherwise, through the Vercel CLI or, without an account, a bundled script that uploads the folder and returns a preview link and a claim link. Use when you want a shareable deployment link fast.

Figma MCP design context

Reads Figma frames through the Figma MCP server in a fixed order (design context, metadata, screenshot) and rebuilds them with the project's components and tokens; also covers server setup in Codex. Use when connecting Figma MCP or coding from a frame link.

Figma use_figma prerequisite

Sets the rules an agent must load before every use_figma call that runs Plugin API JavaScript in a Figma file: return values, page resets, colours, fonts, node IDs, small validated steps. Use when creating or editing anything inside a Figma file.

Implement a Figma design in code

Implements a Figma frame or component as code in your repo with 1:1 visual parity: fetches context and a screenshot, maps the output to project tokens and components, then runs a validation checklist. Use when a Figma link must become production UI.

Generate a Figma design from an app

Builds or updates a full screen in Figma from code or a description, section by section, using the file's published components, variables and styles instead of hardcoded values. Use when a page from your app should exist as a Figma screen.

Figma design system from a codebase

Builds a Figma design system library from a codebase in five supervised phases: discovery, variables and styles, page structure, components one by one, QA. Use when a product needs a Figma library that matches its code tokens and components.

Figma Code Connect components

Links published Figma components to the code components that implement them via Code Connect: finds unmapped ones, matches them in the codebase, maps only what the user approves. Use when a Figma library and its code both exist but are not linked.

Figma design system rules

Writes project rules for turning Figma designs into code into CLAUDE.md, AGENTS.md or a Cursor rules file, based on Figma's rule template and an analysis of the codebase. Use when setting up an agent for regular Figma-to-code work in a repo.

Create a new Figma file

Creates a blank Figma design file or FigJam board in your drafts, resolving the plan through whoami, and returns the file key and URL. Use when the next Figma step needs a fresh file to write into.