threat-model-generation — Claude Code skill
threat-model-generation — a skill for Claude Code, Codex, Cursor, and other agents that builds a STRIDE threat model from a repository's codebase.
no license 151 installs ★ 129 updated 2026-10-25
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a claude-codeWhat threat-model-generation 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.
What it helps with
- 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 for the agent
- 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.jsonwith GDPR compliance requirements and the security team email
How to install threat-model-generation
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a claude-code2Manually: put the files in place
~/.claude/skills/threat-model-generation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/threat-model-generation/
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a codex2Manually: put the files in place
.agents/skills/threat-model-generation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a cursor2Manually: put the files in place
.cursor/skills/threat-model-generation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Factory-AI/factory-plugins plugins/security-engineer/skills/threat-model-generation2Manually: put the files in place
.github/skills/threat-model-generation/SKILL.md1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a gemini-cli2Platform CLI
gemini skills install https://github.com/Factory-AI/factory-plugins --path plugins/security-engineer/skills/threat-model-generationManually: put the files in place
.devin/skills/threat-model-generation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about threat-model-generation
How do I install threat-model-generation in Claude Code?
Run npx skills add Factory-AI/factory-plugins --skill threat-model-generation -a claude-code. The skill file will be placed at ~/.claude/skills/threat-model-generation/SKILL.md.
What does the threat-model-generation skill do?
It scans the repository and produces two files: .factory/threat-model.md with a full STRIDE analysis per component, and .factory/security-config.json with severity thresholds for blocking merges and alerting the security team.
Does it work with an existing threat model file?
Yes. If .factory/threat-model.md already exists, the skill updates it in place. Compliance frameworks and security team contacts are optional inputs that get written into the config.