# threat-model-generation

threat-model-generation — a skill for Claude Code, Codex, Cursor, and other agents that builds a STRIDE threat model from a repository's codebase.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 151 installs · ★ 129 repo stars
- Author: Factory-AI
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Factory-AI/factory-plugins/tree/HEAD/plugins/security-engineer/skills/threat-model-generation/SKILL.md
- Updated: 2026-10-25
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/threat-model-generation

## What it does

The skill reads dependency manifests — `package.json`, `requirements.txt`, `go.mod`, `Cargo.toml` — maps services and entry points, and traces external interfaces: REST, GraphQL, webhooks, and OAuth integrations. Trust boundaries are separated into three zones: public (untrusted), authenticated (partially trusted), and internal (trusted).

Each major component goes through all six STRIDE categories — Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, and Elevation of Privilege. For every identified threat, the skill records the attack scenario, the vulnerable components, code patterns to watch for, existing mitigations, and a severity rating: CRITICAL, HIGH, MEDIUM, or LOW. The resulting `security-config.json` lets you define at which severity level merges get blocked or the security team gets notified.

Passing compliance requirements (SOC2, GDPR, HIPAA) folds them into the config. If `.factory/threat-model.md` already exists, the skill updates it rather than starting over — so it fits into post-architecture-change workflows without losing prior context.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/threat-model-generation/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/threat-model-generation/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/threat-model-generation/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/threat-model-generation/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Factory-AI/factory-plugins plugins/security-engineer/skills/threat-model-generation
```

2. **Manually: put the files in place**
- File: `.github/skills/threat-model-generation/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Factory-AI/factory-plugins --path plugins/security-engineer/skills/threat-model-generation
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/threat-model-generation/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Factory-AI/factory-plugins/tree/HEAD/plugins/security-engineer/skills/threat-model-generation/SKILL.md

## When to use it
- generate an initial STRIDE threat model for a new repository
- refresh the threat model after significant API or component changes
- produce documentation for a security audit or compliance review
- configure merge-blocking thresholds by threat severity level
- build a vulnerability pattern library tailored to the project's tech stack

## Example prompts
- Build a STRIDE threat model for this repository and save it to `.factory/threat-model.md`
- Update the existing threat model — a new microservice was added since the last version
- Generate `.factory/security-config.json` with GDPR compliance requirements and the security team email

## Similar
- [threat-model](https://affpapa.org/en/nevibecode/skills/anthropics-threat-model.md) — skill · 1300 installs
- [mantis-threat-model](https://affpapa.org/en/nevibecode/skills/mantis-threat-model.md) — skill · 1900 installs
- [security-threat-model](https://affpapa.org/en/nevibecode/skills/lyndonkl-security-threat-model.md) — skill · 109 installs
- [skill-security-model](https://affpapa.org/en/nevibecode/rules/skill-security-model.md) — rule · ★ 1627 repo stars
- [threat-model-analyst](https://affpapa.org/en/nevibecode/skills/threat-model-analyst.md) — skill · 1500 installs
- [threat-model-generator](https://affpapa.org/en/nevibecode/skills/threat-model-generator.md) — skill · 270 installs

From the same set: [factory-ai/factory-plugins](https://affpapa.org/en/nevibecode/by/factory-ai/factory-plugins.md) — 17 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
