Skip to main content
skill CX Codex

security-threat-model · dotslashsimran — Claude Code skill: what it does

The security-threat-model Claude Code skill maps threats from an app’s code and tests the highest risks locally. It activates for requests about STRIDE, app security reviews, or vulnerabilities before launch.

MIT ★ 541 updated 2026-11-09

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dotslashsimran/simcraft --skill security-threat-model -a claude-code
Open on GitHub

What security-threat-model does

The skill inspects routes, authorization, data access, and outbound calls, then creates a Mermaid data-flow diagram and analyzes threats with STRIDE. It ranks each risk by likelihood and impact. Python 3 scripts help locate the attack surface and secrets, but their findings need manual review.

For serious risks, the skill writes a local test, confirms it fails, fixes the flaw, and keeps the test in the regression suite. The report is saved as THREAT_MODEL.md. Testing is limited to code the user owns and a local environment; proofs must not target production, shared staging, or third-party services. Dependency checks use npm audit or pip-audit when the relevant utility is installed.

What it helps with

  • identify routes lacking authorization and potential IDOR paths
  • map trust boundaries and data flows for STRIDE analysis
  • reproduce a serious flaw locally and retain a regression test
  • document threats, fixes, and residual risks in THREAT_MODEL.md

Example prompts for the agent

  • Build a threat model for this app and save it as THREAT_MODEL.md.
  • Run a STRIDE review of the code and verify the main risks with local tests.
  • Check authorization and tenant isolation before this app launches.

How to install security-threat-model

1Skills CLI (Vercel)

npx skills add dotslashsimran/simcraft --skill security-threat-model -a claude-code

2Manually: put the files in place

~/.claude/skills/security-threat-model/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/security-threat-model/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about security-threat-model

How do I install security-threat-model in Claude Code?

Run npx skills add dotslashsimran/simcraft --skill security-threat-model -a claude-code. The skill file is at ~/.claude/skills/security-threat-model/SKILL.md.

What does security-threat-model do?

It inspects application code, maps data flows in a Mermaid diagram, and ranks STRIDE threats. For significant risks, it creates a local test, fixes the flaw, and leaves the test in the regression suite.

What does security-threat-model need to run?

Python 3 is needed for its analysis scripts. Tests run against local code or a local development server; npm audit and pip-audit are used when installed.

Source text

SKILL.md · MIT
---
name: security-threat-model
description: Threat-model the user's own app from its real code. Draws the data flow (actors, trust boundaries, data stores, external services) as a Mermaid diagram, finds threats per element with STRIDE, ranks them by likelihood times impact, then proves each top risk with a local failing test, fixes it, and keeps the test as a regression test. Covers auth, IDOR and tenant isolation, injection, SSRF, secrets, CORS/CSRF, uploads, webhooks, dependencies, abuse, and LLM-app risks like prompt injection through tool output. Writes THREAT_MODEL.md. Use when the user says "threat model", "security review of my app", "is this secure", "STRIDE", "find vulnerabilities in my code", or before launching something that holds other people's data or money.
---

# Security threat model

The goal is not a long list of everything that could go wrong. It is the three to six things that would actually hurt, proven real on the user's own machine, fixed, and locked in with tests. A threat without a proof is a guess. A fix without a regression test comes back in six months.

Only for code and systems the user owns. Every proof runs against local code or a local dev server with throwaway data. Never send a proof to production, a staging server shared with others, or any third-party service, even one the app calls.

## 1. Scope (ask, one question at a time)

- What does the app do, who uses it, and what would be bad news (leaked data, lost money, someone else's account, a big bill)?
- What is in scope (which repo, which services) and how does it run locally?
- How is it deployed (behind a proxy, serverless, single box)? This decides which threats are the app's job.

Write the answers at the top of `THREAT_MODEL.md`.

## 2. Map the surface from the code

```
python3 ~/simcraft/skills/coding/security-threat-model/scripts/surface.py <repo>
python3 ~/simcraft/skills/coding/security-threat-model/scripts/secrets_scan.py <repo> --history
```
`surface.py` lists routes with flags (`NO-AUTH-SEEN`, `IDOR?`, `WEBHOOK-UNVERIFIED?`, `ABUSE-TARGET`, `LLM-COST`) and leads grouped by category, with `[input]` on lines that use request data. `secrets_scan.py` finds keys in files and history and prints them masked. Both are regex heuristics: they point at code to read, they never decide anything. Then read by hand, in this order: the auth middleware and how a request becomes a user, the data access layer and how queries are scoped, every route that takes an id, and every place the app calls out (HTTP, shell, files, LLM tools). If there is a lockfile, run `npm audit` or `pip-audit` if installed (see reference).

## 3. Draw the data flow

Write a short `dataflow.yaml` from what the code actually does (actors, processes, stores, externals, boundaries, flows), then:
```
python3 ~/simcraft/skills/coding/security-threat-model/scripts/dataflow.py dataflow.yaml --stride
```
It prints the Mermaid diagram, the flows that cross a trust boundary, and a STRIDE-per-element table to fill in. Every boundary crossing is where threats live. If the diagram has no boundaries, it is wrong.

## 4. Find and rank threats

Go element by element with STRIDE, but spend most of the time on these, because they are where real apps break: authorization (can user A touch user B's or tenant B's object?), injection into SQL, shell, templates and paths, unverified inbound trust (webhooks, JWTs, callbacks), and, for AI apps, what a hijacked model can do with its tools. The reference has what to look for in code for each area.

Rate each threat: likelihood 1 to 3 times impact 1 to 3, with a one-line reason. Anything reachable by any logged-in user or anyone on the internet in one request is likelihood 3. Anything that exposes other customers' data, money or code execution is impact 3. Drop theoretical threats with a one-line reason instead of padding the table.

## 5. Prove, fix, keep the test

For each threat scoring 6 or more (and cheap wins below that):
1. **Prove it.** Write a test that asserts the secure behaviour ("Alice gets 404 for Bob's invoice"), run it, and watch it fail. The failure output is the evidence. Use the app's test framework, or plain HTTP to the local dev server. Add a control test for the normal case so a fix cannot pass by breaking the feature.
2. **Fix it** at the layer where it cannot be forgotten (scope the query by owner, parameterise, resolve and contain the path, verify the signature before parsing). Smallest change that closes the class of bug, not just the payload.
3. **Rerun.** The proof now passes, the controls still pass, and the test stays in the suite.

If a real secret turns up, tell the user to revoke and rotate it at the provider first. Never print it back in full.

## 6. Write THREAT_MODEL.md

Sections: scope, data flow diagram, assets, trust boundaries, threats table (ID, element, STRIDE, threat, L, I, score, status), proofs and fixes (proof, before output, fix), residual risks with the next fix for each, and what to recheck when the system changes. Use the template in `reference.md`.

A complete worked example (an invoice API with an IDOR, SQL injection, path traversal, forged webhook, hardcoded fake key and error leak, plus the fixed copy and 18 tests) is in `examples/invoice-api/`.

© dotslashsimran · MIT · dotslashsimran/simcraft

Similar skills

All skills for Security →

security-threat-model by other authors comes first.

security-threat-model lyndonkl security-threat-model guides threat modeling across system components using STRIDE methodology, trust boundary maps, and defense-in-depth principles before audits or releases. CX Codex +1 109installs security-threat-model github.com/openai/skills security-threat-model reads your repository and writes a threat model: trust boundaries, assets, realistic abuse paths and mitigations, saved as a Markdown file. CX Codex +1 ★ 7,191repo stars openai-security-threat-model OpenAI The openai-security-threat-model plugin examines a repository for security threats and writes a concise Markdown model. Use it when you explicitly want to assess a codebase or path. ★ 540repo stars mantis-threat-model official google mantis-threat-model turns the Mantis knowledge base into a project threat model: trust boundaries, entry points, attacker profiles. Useful once the architecture is written down but the threat model is not. CX Codex +1 1,900installs threat-model-analyst official github threat-model-analyst runs STRIDE-A threat modeling for a repository or system. It can also update an earlier report against the current code or a chosen commit. CX Codex +1 1,500installs threat-model official anthropics Builds a threat model for a target codebase and writes the result to THREAT_MODEL.md. Three modes cover code-only analysis, owner interviews, and both chained together. CX Codex +1 1,300installs threat-model-generator patricio0312rev threat-model-generator builds a STRIDE threat model: lists assets, enumerates threats with risk scores, picks mitigations and works out what risk is left. CX Codex +1 270installs multi-agentic-threat-model OWASP multi-agentic-threat-model conducts systematic threat modeling for multi-agent architectures using CSA MAESTRO and OWASP guidelines. CX Codex +1 188installs

From the same set24

The whole set →
repo-timelapse The repo-timelapse Claude Code skill turns a repository’s Git history into a video of the project changing over time. It runs on requests to show project growth or animate commits. CX Codex +1 ★ 541repo stars skill-router The skill-router Claude Code skill selects a matching skill or builds a sequence for a task. It kicks in when a request is vague or could call for several skills. CX Codex +1 ★ 541repo stars bisect-anything The bisect-anything Claude Code skill tracks a regression to a commit, dependency version, or config value. It activates for requests to find what broke a test or when a problem began. CX Codex +1 ★ 541repo stars scripted-screencast The scripted-screencast Claude Code skill turns scripted browser actions into a product demo video with cursor effects, zooms, and captions. It activates for screencast requests and rerenders after interface changes. CX Codex +1 ★ 541repo stars vox-explainer The vox-explainer Claude Code skill makes Vox-style explainer graphics or a faceless video. It runs on requests for voiceover-led visuals, animated quotes, or stats. CX Codex +1 ★ 541repo stars benchmark-honestly The benchmark-honestly Claude Code skill checks performance measurements and compares code versions. It activates for benchmark requests, load tests, latency percentiles, or claims that a change made code faster. CX Codex +1 ★ 541repo stars flaky-test-killer The flaky-test-killer Claude Code skill tracks down flaky-test causes and helps fix them at the root. It stresses the test and compares failure rates before and after the change. CX Codex +1 ★ 541repo stars reverse-engineer-video The reverse-engineer-video Claude Code skill breaks down a reference clip into shots, camera moves and editing beats. Invoke it to inspect a cut, plan a remake or compare one with the original. CX Codex +1 ★ 541repo stars

Project sponsors

Companies that keep this analytics open