threat-model
Skill1 starsChanged 5 months agoMITView on GitHub
Repository-grounded threat modeling. Enumerates trust boundaries, assets, attacker capabilities, and abuse paths tied to actual code. Not generic OWASP checklists — evidence-backed claims with file/line references.
- Reads credentials
We split this skill into the rules it gives an agent
13 rules. 0 are common, 12 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 49 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Before deploying a new service or API to production
- Distinctive: line 15
When adding auth, payments, file uploads, or other security-sensitive features
- Distinctive: line 16
Before Procore or other external API integrations, or multi-tenant features
- Distinctive: line 17
When explicitly asked to threat model a codebase
- Distinctive: line 31
No args → Full model of entire repo
- Distinctive: line 37
Use Glob and Grep to enumerate actual components.
- Distinctive: line 80
Only list assets with evidence in the codebase.
- Distinctive: line 121
Do NOT list generic threats without code evidence.
- Distinctive: line 141
Ask the questions and wait for answers before writing the final report.
- Distinctive: line 154
Do NOT recommend generic "add input validation" without specifying what input, where, and what rule.
- Distinctive: line 158
Before emitting the report, verify:
- Very specific: line 213
If --save flag or user confirms, write the report to:
- Distinctive: line 218
Create the directory if it doesn't exist.
“Common” is measured: kept by at least 6 in 10 of the 49 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Threat Model (/threat-model)
Systematic threat modeling rooted in the actual codebase. Every claim references real code — no generic category dumps.
Time budget: 20 min total. Scope + recon ~5 min, analysis ~10 min, synthesis + questions ~5 min. Abort at 20 min with partial report.
When to Use
- Before deploying a new service or API to production
- When adding auth, payments, file uploads, or other security-sensitive features
- Before Procore or other external API integrations, or multi-tenant features
- When explicitly asked to threat model a codebase
When NOT to Use
- General code review (use
/grillinstead) - Architecture summaries without security focus
Arguments
Parse $ARGUMENTS string:
--scope "api,auth,db"→ Limit to named components/directories--attacker "external"→ Limit attacker model to external-only (skip insider/supply chain)--report-only→ Skip validation questions, emit report immediately--save→ Save output to<your-output-dir>/security/{project}-threat-model.md- No args → Full model of entire repo
Instructions
Step 1: Scope — Map the System from Code
Use Glob and Grep to enumerate actual components. Do NOT invent components.
Glob: **/*.{ts,tsx,js,py,go,rb,rs} (entrypoints, routers, handlers)
Glob: **/{schema,migration,model,entity}*
Glob: **/{auth,middleware,guard,policy}*
Glob: **/.env.example, **/docker-compose*, **/Dockerfile*
Grep: pattern="process\.env\." — find all env var refs
Grep: pattern="(fetch|axios|got|request)\(" — external HTTP calls
Grep: pattern="(sql|query|db\.|prisma\.|drizzle)" — DB accessBuild a component inventory:
- Entrypoints: HTTP routes, CLI commands, background jobs, webhooks, event listeners
- Data stores: databases, file storage, caches, queues
- External integrations: third-party APIs, OAuth providers, payment processors
- Configuration: env vars, secrets, feature flags
Note which are runtime vs CI/build/dev tooling only — threats differ.
Step 2: Trust Boundaries
For each boundary crossing, document:
- Protocol (HTTP/S, gRPC, WS, IPC)
- Authentication mechanism (JWT, session cookie, API key, mTLS, none)
- Encryption in transit (TLS version, self-signed, none)
- Input validation (schema validation, sanitization, none observed)
- Authorization model (RBAC, ABAC, owner-check, none observed)
Format each boundary as:
[Caller] → [Callee] | Protocol | Auth | Encrypted | ValidatedReference the file:line where auth/validation is (or is absent).
Step 3: Assets
List what drives risk. For each asset:
- Type: credentials/secrets, PII, financial data, integrity-critical state, IP/source code
- Location: where stored, how accessed (file:line)
- Sensitivity: what's the blast radius if compromised?
Only list assets with evidence in the codebase. Skip hypothetical assets.
Step 4: Attacker Model
Define realistic attacker capabilities based on actual exposure:
Assess exposure first:
- Is there a public API? (unauthenticated surface)
- Are there multi-tenant data boundaries?
- Does the app handle webhooks from external parties?
- Are there admin/privileged roles?
- Are there third-party dependencies with broad permissions?
Attacker tiers (include only relevant ones):
| Tier | Capabilities | Include if... |
| External unauthenticated | HTTP requests, no credentials | Any public endpoint exists |
| External authenticated | Valid account, standard permissions | Multi-user app |
| Malicious insider/tenant | Cross-tenant API access, valid JWT for own org | Multi-tenant data model |
| Supply chain | Compromised dependency, CI environment | npm/pip deps, GitHub Actions |
| Infrastructure | Cloud misconfiguration, leaked env vars | Deployed app with cloud resources |
Explicitly state non-capabilities — what the attacker cannot do (e.g., "cannot execute arbitrary code on host", "cannot read DB directly"). This prevents scope creep.
Step 5: Threats — Abuse Paths
Map attacker capabilities to assets via trust boundary weaknesses. Each threat must:
- Name the abuse path (not a category name — a specific action)
- Reference the vulnerable code location (file:line)
- Map to an asset and boundary
- Note any existing controls that partially mitigate
Format:
T-{n}: {Attacker tier} can {specific action} via {entry point / boundary}
affecting {asset} because {specific code observation}
Controls: {existing mitigations or "none observed"}
Evidence: {file:line}Do NOT list generic threats without code evidence.
Step 6: Prioritize
Score each threat: Likelihood × Impact, adjusted for existing controls.
Risk levels:
- HIGH — pre-auth RCE, authentication bypass, cross-tenant data access, credential/key theft, mass data exfiltration. Fix before ship.
- MEDIUM — targeted DoS, partial data exposure (own data only), rate-limit bypass enabling abuse, log injection enabling confusion. Fix soon.
- LOW — low-sensitivity info leaks (stack traces, version headers), noisy DoS requiring sustained effort with easy mitigation. Track.
Justify the rating with one sentence referencing the existing controls and blast radius.
Step 7: Validate Assumptions (skip if --report-only)
Generate 1-3 targeted questions to resolve the highest-uncertainty assumptions before finalizing. Examples:
- "Is endpoint X publicly reachable or behind a VPN/internal network?"
- "Does {table} contain real PII in production or only synthetic test data?"
- "Is {env var} ever committed to the repo or injected only at deploy time?"
Ask the questions and wait for answers before writing the final report. If the user doesn't respond, note the assumption made and proceed.
Step 8: Mitigations
For each HIGH and MEDIUM threat, provide:
Existing controls — cite with file:line evidence. Don't credit controls you can't locate.
Recommended mitigations — concrete, tied to specific locations:
- What to add/change and where (file:line or "new file at path/")
- Estimated effort: Quick (< 1 day) / Medium (1-3 days) / Heavy (> 3 days)
- Whether it blocks a specific attacker tier or reduces blast radius
Do NOT recommend generic "add input validation" without specifying what input, where, and what rule.
Step 9: Quality Check
Before emitting the report, verify:
- All entrypoints from Step 1 appear in at least one threat or are explicitly marked out-of-scope
- All trust boundaries from Step 2 are represented in at least one threat
- Every threat has a file:line reference
- Attacker non-capabilities are explicitly stated
- No threat is a generic OWASP category without code-specific evidence
- Runtime threats are distinguished from CI/build/dev-only risks
Flag any gaps in the report under "Coverage Gaps."
Output Format
## Threat Model — {project} — {date}
### System Scope
- Entrypoints: [list with paths]
- Data stores: [list with paths]
- External integrations: [list with paths]
- Runtime vs build-only: [distinction]
### Trust Boundaries
| Caller | Callee | Protocol | Auth | Encrypted | Validated |
|--------|--------|----------|------|-----------|-----------|
### Assets
| Asset | Type | Location | Blast Radius |
|-------|------|----------|--------------|
### Attacker Model
**In scope:** [tiers with rationale]
**Explicitly out of scope:** [with rationale]
### Threats
**HIGH**
- T-1: [abuse path] — [file:line] — [controls]
**MEDIUM**
- T-n: ...
**LOW**
- T-n: ...
### Mitigations
**T-1:** [existing controls (file:line)] → [recommended change at file:line] | {Quick/Medium/Heavy}
### Coverage Gaps
- [any entrypoints or boundaries not represented in threats]
### Assumptions Made
- [any unvalidated assumptions from Step 7]Save Output
If --save flag or user confirms, write the report to:
<your-output-dir>/security/{project-name}-threat-model.mdCreate the directory if it doesn't exist.
Other versions55 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 55
- openai/codex-security★ 11ksame name
- anthropics/defending-code-reference-harness★ 7.5ksame name
- openai/plugins★ 7.4ksame name
- Q00/ouroboros★ 6.3ksame name
- me2resh/apexyard★ 542same name
- Cosmian/kms★ 368same name
- jmanico/grim-prompter★ 316same name
- mbwsims/claude-universe★ 71same name
- navikt/copilot★ 60same name
- Codeminer42/skills★ 32same name
45 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use vuln-scan, supply-chain-review and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
AnthropicSkillvuln-scan
Static source-code vulnerability scan. Reads a target directory (and THREAT_MODEL.md if present), spawns parallel review subagents per focus area, and writes VULN-FINDINGS.json + .md for /triage to consume. Read-only — no building, running, or network. For execution-verified crashes, use vuln-pipeline instead. Use when asked to "scan for vulns", "review this code for security issues", "find bugs in <dir>", or as the step between /threat-model and /triage.
Also in 5 projects that use this
MesteriisSkillsupply-chain-review
Reviews lockfiles, installers, provenance, CI permissions, dependency confusion, artifacts, registries, and publishing.
Also in 3 projects that use this
AnthropicSkillpatch
Generate candidate fixes for verified security findings. Consumes
Also in 4 projects that use this
mbwsimsSkillorbit
Run for repo-wide or diff-wide readiness sweeps: "/orbit", "/orbit pr", "/orbit deep", "/orbit quick", "audit this project", "project-wide review", "is this PR ready overall", or "combined security, tests, codebase, evolution, and instruction review". Use this for broad multi-system assessment, not for a single-file review or a one-domain question.
Also in 3 projects that use this
mbwsimsSkilltest-plan
This skill should be used when the user asks to "plan tests", "what should I test", "what tests do I need", "test plan for", "testing strategy for", "test matrix for", "what cases should I cover", "help me plan tests", mentions "/test-plan", or wants to understand what tests are needed before writing any test code.
Also in 3 projects that use this
Sagargupta16Skilldependency-audit
Audit project dependencies for security vulnerabilities, licensing issues, maintenance health, and optimization opportunities. Use it during regular security audits (monthly or quarterly); before a major release when you want to ensure the dependency tree is clean; when evaluating whether to adopt or replace a dependency; after a security advisory affects one of your dependencies; when your install times or bundle sizes have grown noticeably.
Also in 4 projects that use this
In this repository54 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/deep-recon/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-researchSkill
- algorithmic-artSkill
- api-integrationSkill
- breakdownSkill
- c4-architectSkill
- canvas-designSkill
- coding-agentsSkill
- compound-engineeringSkill
- context-budgetSkill
- counterfactualSkill
- critiqueSkill
- d3js-visualizationSkill
- data-analyst-agentSkill
- database-migrationsSkill
- deep-reconSkill
- design-tasteSkill
- doc-coauthoringSkill
- e2b-sandboxSkill
- ecosystem-auditSkill
- excalidraw-diagramSkill
- executing-plansSkill
- frontend-designSkill
- fullstack-agentSkill
- grillSkill
- kickoffSkill
- mcp-builderSkill
- model-migrationSkill
- naming-the-machineSkill
- full-output-enforcementSkill
- package-researchSkill
- pdf-generationSkill
- pp2pSkill
- pp3pSkill
- prompt-engineerSkill
- prompt-groundingSkill
- redesignSkill
- requesting-code-reviewSkill
- reverse-engineer-to-learnSkill
- review-changesSkill
- scratchpadSkill
- shipSkill
- slack-gif-creatorSkill
- sprint-architectSkill
- techdebtSkill
- test-and-fixSkill
- verification-before-completionSkill
- visual-verdictSkill
- webapp-testingSkill
- web-asset-generatorSkill
- whatdidimissSkill
- writing-plansSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

