Skip to main content
skill CX Codex

threat-model · pproenca — Claude Code skill: what it does, how to install

threat-model maps attack surfaces and trust boundaries across a codebase by tracing untrusted inputs directly to execution sinks.

MIT 243 installs ★ 227 updated 2026-08-15

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

What threat-model does

The skill constructs an evidence-based threat model by inspecting code paths rather than guessing vulnerabilities. It tracks untrusted data from network or file entry points to critical operations. Multiple related flaws get clustered by their root cause, while cross-language bridges like Swift and C or Rust and C are checked systematically.

Analysis runs in 10 phases. It uses helper scripts like scripts/trace-data-flows.sh <project-root> to map data sinks. Two modes are available: a full audit of the codebase or an incremental diff check focused on recent git commits.

Results land in two files: a readable report THREAT-MODEL.md and machine-readable findings.json. An existing findings.json allows the tool to trace vulnerability lifecycles and catch regressions after code changes.

What it helps with

  • trace untrusted input through code paths from entry points to sinks
  • construct multi-step exploit chains rated by terminal impact
  • run incremental security diff reviews on recent git commits or PRs
  • inspect cross-language boundaries across FFI bridges like Swift and C
  • cluster repetitive security findings by their common root cause

Example prompts for the agent

  • Run a full threat model on this codebase
  • Perform a diff analysis for recent commits to check for security regressions
  • Map attack surfaces and trust boundaries before building authentication

How to install threat-model

1Skills CLI (Vercel)

npx skills add pproenca/dot-skills --skill threat-model -a claude-code

2Manually: put the files in place

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

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

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

Questions about threat-model

How to install threat-model in Claude Code?

Run npx skills add pproenca/dot-skills --skill threat-model -a claude-code in your terminal.

What files does threat-model produce?

It outputs a machine-readable findings.json file and a human-readable THREAT-MODEL.md report structured into six sections.

When should you use diff mode instead of a full scan?

Use diff mode for regular reviews of specific commit ranges to spot newly introduced issues and regressions without rescanning the whole project.

Source text

SKILL.md · MIT
---
name: threat-model
description: Security threat modeling, attack surface mapping, and trust boundary analysis on a codebase. Triggers on 'threat model', 'security review', 'attack surface', 'trust boundaries', or when assessing a project's security posture. Also trigger when the user is about to build security-sensitive features (auth, crypto, file I/O, network services, native bridges) and needs to understand the threat landscape first — even if they don't explicitly say "threat model." Also triggers on 'what changed' or 'diff analysis' for incremental security review of recent commits.
---
# Threat Model

Produces structured, evidence-backed security threat models for any codebase. Goes beyond surface enumeration by tracing untrusted data through actual code paths, clustering findings by root cause, and constructing exploit chains that combine individual findings into higher-severity attack paths.

## When to Apply

- User asks to threat model, security review, or map attack surfaces for a codebase
- Starting work on security-sensitive features (auth, crypto, file I/O, networking, native bridges)
- Evaluating a new codebase or major architectural change for security implications
- Reviewing a PR or recent commits for security regressions (incremental/diff mode)
- After a security incident to reassess the threat landscape

## Workflow Overview

```
Phase 0 (conditional): Diff Analysis — if git range provided, scope to changed code
Phase 1:  Codebase Survey        → Understand what the project is and does
Phase 2:  Component Mapping      → Identify components, data flows, and language bridges
Phase 3:  Asset Identification   → Determine what needs protecting
Phase 4:  Trust Boundaries       → Classify inputs by trust level, inventory entry points
Phase 5:  Data Flow Tracing      → Follow untrusted values from entry to sink ← key technique
Phase 6:  Attack Surface Enum    → Document surfaces with traced evidence
Phase 7:  Pattern Clustering     → Group 3+ similar findings by root cause
Phase 8:  Exploit Chains         → Combine findings into multi-step attack paths
Phase 9:  Calibration            → Rate with chain-adjusted and systemic severity
Phase 10: Output                 → Write structured THREAT-MODEL.md
```

## How to Use

1. Read [methodology](references/methodology.md) for the detailed approach at each phase
2. Read [output format](references/output-format.md) for the document structure (6 sections)
3. Consult [attack patterns](references/attack-patterns.md) for technology-specific patterns
4. Run `scripts/trace-data-flows.sh <project-root>` to inventory entry points and sinks
5. Optionally run `scripts/scan-patterns.sh <project-root>` for security-relevant code patterns

## Analytical Techniques

These techniques are the skill's core value — they encode analytical methods that produce findings the model wouldn't generate from general knowledge alone.

| Technique | When to Read | What It Adds |
|-----------|-------------|-------------|
| [Data Flow Tracing](references/techniques/data-flow-tracing.md) | Phase 5 — always | Traces untrusted input from entry to sink through actual code. Produces evidence-backed findings instead of theoretical risks |
| [Pattern Clustering](references/techniques/pattern-clustering.md) | Phase 7 — after enumeration | Groups related findings by root cause. Recommends systemic fixes instead of individual patches |
| [Exploit Chains](references/techniques/exploit-chains.md) | Phase 8 — after clustering | Combines findings into multi-step attack paths rated by terminal impact |
| [Bridge Analysis](references/techniques/bridge-analysis.md) | Phase 6 — when FFI/bridges found | Systematic checklist for cross-language boundaries (Swift↔C, Rust↔C, Rails↔NGINX) |
| [Diff Analysis](references/techniques/diff-analysis.md) | Phase 0 — for incremental review | Scopes analysis to changed code, identifies regressions |

## Key Principles

- **Evidence over speculation**: Every finding should include a data flow trace showing how untrusted input reaches the vulnerable operation. "XSS is possible" is speculation. "RFC markdown → marked.parse() → innerHTML at line 917 with no sanitizer" is evidence.
- **Systemic over individual**: When 3+ findings share a root cause, the systemic finding is more important than any individual finding. Fix the root cause, not the symptoms.
- **Chains over singletons**: Rate combined attack paths by their terminal impact. Three medium findings that chain into critical impact are a critical finding.
- **Existing mitigations matter**: Document what's already protected, not just what's missing.
- **Context-aware calibration**: Severity depends on deployment context. Always include scope notes.

## Output

Produces **two files** (configurable via config.json):

- **`findings.json`** — Structured, machine-readable findings. Source of truth. Consumed by `threat-patch` for automated remediation. Tracks finding state across runs (open → patched → verified → closed).
- **`THREAT-MODEL.md`** — Human-readable view generated from findings.json. 6 sections: Overview, Trust Boundaries, Attack Surfaces, Systemic Findings, Exploit Chains, Criticality Calibration.

### Pipeline Integration

```
threat-model → findings.json → threat-patch (consumes findings, generates fixes)
     ↑                                          ↓
     └── threat-model --diff (re-analyzes, updates finding status) ←── git commits
```

When `findings.json` exists from a prior run, the skill reads it to:
- Track which findings are still open vs patched
- Calibrate severity against prior ratings
- Detect regressions (fixed findings that reappeared)

## Two Modes

| Mode | Trigger | What It Does |
|------|---------|-------------|
| **Full analysis** | "threat model this codebase" | Analyzes entire codebase, produces fresh findings.json + THREAT-MODEL.md |
| **Diff analysis** | "what changed since last review" / git range provided | Scopes to changed code, updates existing findings.json with new/resolved/regressed findings |

Diff mode is the daily driver for ongoing projects. Full mode runs once (or periodically).

## References

| File | When to Read |
|------|-------------|
| [references/methodology.md](references/methodology.md) | Before starting — the 10-phase workflow |
| [references/output-format.md](references/output-format.md) | When writing output — 6-section template |
| [references/findings-schema.md](references/findings-schema.md) | When writing findings.json — structured schema |
| [references/attack-patterns.md](references/attack-patterns.md) | When enumerating surfaces — technology patterns |
| [references/techniques/](references/techniques/) | During specific phases — analytical techniques |

© pproenca · MIT · pproenca/dot-skills

Similar skills

All skills for Security →

threat-model by other authors comes first.

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 official OpenAI The threat-model skill for Codex creates an architectural threat model for your repository. It triggers by calling $threat-model or during the security scan phase. CX Codex GP ChatGPT +1 32installs threat-model jmanico threat-model is a Claude Code skill that maps repository threats and writes reports to threat-model/. It responds to requests for STRIDE, PASTA, LINDDUN, privacy reviews, and change impact checks. CX Codex +1 ★ 640repo stars threat-model haabe Runs STRIDE threat modeling for features and system architectures. Evaluates data flows, trust boundaries, and AI vulnerabilities before code ships. CX Codex +1 ★ 54repo stars 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-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 tm7-threat-model official github tm7-threat-model — a GitHub Copilot skill that generates .tm7 files for Microsoft Threat Modeling Tool v7.3+. Triggers when you need to create or modify a STRIDE threat model. CX Codex +1 29installs create_stride_threat_model danielmiessler create_stride_threat_model analyzes system design documents and builds a STRIDE-per-element threat model with trust boundaries, data flows, and prioritized mitigations. GP ChatGPT ★ 44,690repo stars 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 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

From the same set139

The whole set →
rails-application-ui-blocks rails-application-ui-blocks is a Claude Code skill that assembles UI blocks in Ruby on Rails ERB views while preserving Turbo, Stimulus, and accessibility hooks. CX Codex +1 257installs rust-implement rust-implement enforces a four-pass discipline for Rust development, moving from strict type design to implementation, simplification, and automated linting. CX Codex +1 254installs domain-architect domain-architect identifies business domains in a Swift codebase by tracing user capabilities, not folder names. Maps each domain's vertical slice from types to UI. CX Codex +1 249installs app-planner app-planner creates a structured Markdown design plan using Apple Design DNA patterns before coding starts. Organizes screens into buildable milestones for ios-taste. CX Codex +1 244installs opencode-ts The opencode-ts skill guides TypeScript implementation, tests, and refactoring in Effect-based projects. It gives the agent a workflow tied to the project’s architecture and conventions. CX Codex +1 240installs exec-plan exec-plan manages self-contained Markdown execution plans across agent sessions for tasks touching more than three files or taking over an hour. CX Codex +1 239installs graph-schema graph-schema is a Claude Code skill for designing, reviewing, and refactoring graph database schemas. It activates for node and relationship modeling or when mapping a domain into a graph. CX Codex +1 239installs clean-code-ts-react clean-code-ts-react adapts Robert C. Martin's Clean Code principles for TypeScript 5.x and React 19. Guides code reviews, component architecture, and refactoring sessions. CX Codex +1 238installs

Project sponsors

Companies that keep this analytics open