Index of every page on this site: llms.txt
All skills
Run it yourself

Build a threat model for a target codebase. Three modes: "interview" walks an application owner through the four-question framework and produces a threat model from their answers; "bootstrap" derives a threat model from the code plus past vulnerabilities (CVEs, git history, pentest reports) when no owner is available; "bootstrap-then-interview" chains the two when both owner and codebase are present. All write THREAT_MODEL.md in a shared schema. Use when asked to "threat model", "build a threat model", "map the attack surface", or "what should we be worried about in this codebase".

Use this Skill: https://skilld.dev/gh/anthropics/defending-code-reference-harness/threat-model

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

README.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

threat-model

A Claude Code skill that builds a threat model for a target codebase. Three modes: bootstrap derives the threat model from the target itself (source tree, git history, public advisories, an optional past-vulns file); interview discovers the threat model by walking an application owner through the four-question framework; bootstrap-then-interview chains the two. All modes write THREAT_MODEL.md in a shared schema.

Why a threat model

Vulnerability scanners find instances; a threat model is the map of where instances are likely to be and which ones matter. Hand the pipeline a threat model and it knows where to look. Hand triage a threat model and it knows which findings to escalate. Use the output's focus areas to seed the vuln-pipeline recon partition and to inform how you prioritize /triage results.

Model selection

The skill has no model: frontmatter pin; it runs on whatever model your session uses (or --model if you pass one). It is designed for reasoning-capable Claude models — use the same model you run the rest of the pipeline with. If you want the skill itself to request a model, add a model: line to SKILL.md frontmatter. It overrides the session model (however set, /model or --model) only for the turn the skill is invoked in — fine for bootstrap, but the multi-turn interview reverts to the session model on your next reply, so to hold a model across an interview, set it at the session level instead.

Installation

Project-scoped (already done if you cloned this repo):

ls .claude/skills/threat-model/

User-scoped:

cp -r .claude/skills/threat-model ~/.claude/skills/

Usage

Bootstrap (derive from target, git history, advisories)

Use when no application owner is available. Point it at a checkout and, optionally, a list of past vulnerabilities:

/threat-model bootstrap targets/drlibs
/threat-model bootstrap targets/drlibs --vulns targets/drlibs/vulns.txt

Without --vulns the skill mines git log, CHANGELOG, and GitHub Security Advisories itself; with it, it ingests your supplied list first.

The skill spawns a parallel research swarm (docs reader, surface mapper, asset finder, git-history miner, advisory fetcher, vuln-file parser), synthesizes their returns into the system-context / assets / entry-points sections, generalizes the collected vulns into threat classes, gap-fills with STRIDE for surfaces the vuln history didn't cover, and writes targets/drlibs/THREAT_MODEL.md. On small targets (<50 source files) it runs the same briefs sequentially instead of spawning.

Interview (discover via owner conversation)

Use when an application owner is in the session.

/threat-model interview targets/alsa
/threat-model interview targets/alsa --design-doc targets/alsa/README.md

Without --design-doc the interview opens cold by asking the owner to describe the system; with it, the skill reads the doc first and summarizes it back for confirmation.

The skill will walk the owner through the four questions ("what are we working on?", "what can go wrong?", "what are we going to do about it?", "did we do a good job?"), grounding answers in the code as it goes, and write targets/alsa/THREAT_MODEL.md.

Bootstrap then Interview (bootstrap a draft, then refine via interview)

Use when an owner is available but their time is limited: bootstrap produces the draft unattended, then the interview spends owner time only on what the code couldn't answer.

/threat-model bootstrap-then-interview targets/drlibs/

The interview will focus on the bootstrap's open questions instead of starting cold. If the bootstrap already ran in an earlier session, seed the interview with its output instead of re-running it:

/threat-model interview targets/drlibs/ --seed targets/drlibs/THREAT_MODEL.md

Checkpointing and resume (bootstrap mode)

Bootstrap writes per-stage checkpoints to ./.threat-model-state/ in the current working directory (cwd-confined by checkpoint.py). If a run is interrupted, re-invoking /threat-model bootstrap <target-dir> from the same working directory resumes from the last completed stage — the research swarm is not re-spawned if Stage 1 already landed. Pass --fresh to start over. The state directory is scratch; add it to .gitignore.

Output

<target-dir>/THREAT_MODEL.md with seven sections: system context, assets, entry points & trust boundaries, threats (the table), deprioritized, open questions, provenance. See schema.md for the full contract; a worked example lives at targets/drlibs/THREAT_MODEL.md.

Notes

  • The skill is read-only — it does not build, run, or probe the target — and is safe to point at any local checkout.
  • The output is a starting point for human review, not a substitute for it.

References

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    The threat-model skill is a well-structured tool designed for static analysis of codebases. It facilitates the creation of threat models through two primary workflows: automated discovery from code and history (bootstrap) or conversational discovery with an application owner (interview). The skill adheres to best practices by being read-only and using localized checkpoints for state management. No security concerns were identified during the analysis.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: LOW · No issues

Signed by skilld at d3bea6b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Steadyupdated 6 months ago
What it can do
Reads files Runs commands Edits files
All 12 allowed tools
ReadGlobBash(python3 .claude/skills/_lib/checkpoint.py:*)GrepWriteBash(git:*)Bash(gh api:*)Bash(find:*)Bash(ls:*)Bash(cat:*)AskUserQuestionTask
Other metadata
argument-hint
[bootstrap-then-interview|bootstrap|interview] <target-dir> [--vulns <file>] [--design-doc <file>] [--seed <THREAT_MODEL.md>] [--fresh]

README badge

README badge for anthropics/defending-code-reference-harness/threat-model