AI-native automated software risk analysis skill. LLM-driven, Code-First approach for comprehensive security risk assessment, threat modeling, security analysis, security audit, and penetration testing.
$ npx -y skills add fr33d3m0n/threat-modeling --agent claude-code
What's inside
AI-native automated software risk analysis skill. LLM-driven, Code-First approach for comprehensive security risk assessment, threat modeling, security analysis, security audit, and penetration testing.
--phase-end callsknowledge/tool-capabilities.yaml for runtime tool discoveryreferences/ for on-demand tool guidanceSee CHANGELOG.md for full version history.
See CHANGELOG.md for full version history.
# Clone to global skills directory
git clone https://github.com/fr33d3m0n/threat-modeling.git \
~/.claude/skills/threat-modeling
# Clone to project's .claude/skills directory
mkdir -p .claude/skills
git clone https://github.com/fr33d3m0n/threat-modeling.git \
.claude/skills/threat-modeling
Start Claude Code in your target project directory:
cd /path/to/your/project
claude
Invoke the skill with a simple prompt:
/threat-modeling Perform a complete threat model analysis on @.
Follow the 8-phase workflow - Claude will guide you through each phase.
The skill supports 6 flexible application modes beyond the standard 8-phase workflow:
Full 8-phase threat modeling for codebases.
/threat-modeling Perform a complete threat model analysis on @/path/to/project
Project context:
- This is an e-commerce platform backend API service
- Built with Django REST Framework
- User data includes PII and payment information
Focus areas: Authentication mechanisms, payment flow, API security
Use as security consulting resource without executing complete workflow.
Query complete information for CWE-89 (SQL Injection),
including attack patterns, testing methods, and mitigations
Response includes: CWE overview, related CAPEC patterns, WSTG testing steps, ASVS requirements, mitigation examples.
In-depth analysis of specific vulnerabilities or code snippets.
Analyze SSRF risk in this code, construct attack path and design POC
[Code snippet]
Response includes: Vulnerability mechanism, attack path, POC design, CWE/CAPEC/ATT&CK mapping.
Generate test cases based on security standards.
Generate WSTG-based security test cases for this API endpoint
Response includes: Authentication, authorization, input validation, session management test cases with payloads.
Pre-emptive threat modeling during design without waiting for code.
Conduct STRIDE threat analysis based on this API specification
[OpenAPI specification]
Response includes: DFD from API endpoints, trust boundaries, STRIDE enumeration, design recommendations.
Attack path and POC design support for pentesting.
I found JWT signature verification bypass in the target system,
help construct complete attack chain
Response includes: Vulnerability confirmation, attack chain, POC payload, ATT&CK mapping, report template.
| Mode | Input | Output | When to Use |
|---|---|---|---|
| Complete Workflow | Codebase | Full threat report | Development / Pre-release |
| KB Consultation | Question | Knowledge response | Any stage |
| Vulnerability Analysis | Code / Description | Attack path + POC | Code review / Pentest |
| Test Generation | Target description | Test checklist | Testing phase |
| Forward Integration | Design docs | Design-phase analysis | Design phase |
| Backward Integration | Found vulnerability | Attack chain + Plan | Penetration testing |
| Flag | Description |
|---|---|
--debug | Publish internal YAML data files and evaluation reports |
--lang=xx | Set output language (en, zh, ja, ko, es, fr, de, pt, ru) |
Examples:
/threat-model @my-project # Default mode
/threat-model @my-project --debug # With internal data
/threat-model @my-project --lang=zh --debug # Chinese output with debug
Beyond the standard 8-phase workflow, use these extended prompts for deeper security analysis:
Comprehensive discovery and risk analysis of all system interfaces.
/threat-modeling @/path/to/project
Perform complete interface and data flow discovery analysis:
1. Comprehensive discovery of all system interfaces:
- User interaction interfaces (Web UI, CLI, Mobile)
- External APIs (REST, GraphQL, gRPC, WebSocket)
- System interfaces (File system, Database, Message queue)
- Internal services (Microservice calls, RPC, Event bus)
2. Build complete data flow diagram:
- Annotate all data entry and exit points
- Identify sensitive data flow paths
- Mark trust boundary crossing points
3. Risk analysis for each interface:
- Input validation risks
- Authentication/authorization risks
- Data leakage risks
- Injection attack risks
Output format: Complete interface inventory sorted by risk level, with CWE mapping and CVSS scores
Deep attack chain analysis with exploit POC generation and penetration testing plan.
/threat-modeling @/path/to/project --debug
Based on discovered security issues, perform deep attack analysis:
1. Attack tree construction:
- Build attack tree for each high-risk threat
- Analyze attack prerequisites and dependencies
- Calculate attack success probability and impact scope
2. Attack chain analysis:
- Identify multi-step attack paths (Initial Access โ Execution โ Persistence โ Exfiltration)
- Map to MITRE ATT&CK tactics and techniques
- Mark critical pivot points in attack chain
3. Exploit POC generation:
- Generate POC code for each exploitable vulnerability
- Include payload construction, trigger conditions, expected results
- Provide safe testing methods (avoid destructive operations)
4. Penetration testing plan:
| Issue ID | Vulnerability | Test Case | Test Steps | POC | Recommended Tools |
|----------|---------------|-----------|------------|-----|-------------------|
Output: Complete penetration testing plan document, ready for security testing execution
Set up isolated test environment and execute penetration testing plan.
/threat-modeling @/path/to/project
Set up test environment and execute penetration test verification:
1. Environment analysis:
- Parse project's docker-compose.yml / Dockerfile
- Identify required service dependencies (database, cache, message queue)
- Analyze default configuration and environment variables
2. Docker test environment construction:
- Generate isolated test environment docker-compose.test.yml
- Configure network isolation and port mapping
- Prepare test data and initialization scripts
- Integrate security testing tool containers (OWASP ZAP, Nuclei, SQLMap)
3. Automated test execution:
- Execute generated penetration testing plan
- Collect test results and evidence screenshots
- Verify vulnerability exploitability
4. Test report:
- Vulnerability confirmation status (Confirmed / Not Exploitable / False Positive)
- Actual risk assessment adjustment
- Reproduction steps and evidence chain
Output: Test environment config files + Automated test scripts + Test results report
Comprehensive attack chain analysis with visualization and optimized exploitation.
/threat-modeling @/path/to/project --debug
Complete attack chain analysis and visualization:
1. Attack graph construction:
- Build complete system attack graph
- Nodes: Assets, vulnerabilities, attack techniques
- Edges: Attack paths, prerequisites, success probability
2. Critical path analysis:
- Identify shortest attack path (from entry to core assets)
- Identify highest success rate path
- Identify attack chain with maximum impact scope
3. POC optimization combination:
- Tool chain optimization (Recon โ Exploit โ Post-Exploit)
- Automated attack script generation
- One-click vulnerability verification workflow
4. Visualization output:
- Mermaid format attack tree diagram
- Attack path heatmap
- Risk-impact matrix diagram
- ATT&CK Navigator mapping
Output format:
- Attack graph Markdown (with Mermaid diagrams)
- Optimized POC toolkit
- Risk visualization dashboard data
| Scenario | Focus | Key Output |
|---|---|---|
| Interface Discovery | All interfaces + Data flows | Risk-ranked interface inventory |
| Attack Tree & POC | Attack chains + Exploits | Pentest plan with POC code |
| Docker Test Env | Isolated testing | Test environment + Auto scripts |
| Attack Visualization | Visual analysis | Attack graphs + Heatmaps |
{PROJECT_ROOT}/
โโโ Risk_Assessment_Report/ # Final reports (P8)
โ โโโ {PROJECT}-RISK-ASSESSMENT-REPORT.md
โ โโโ {PROJECT}-RISK-INVENTORY.md
โ โโโ {PROJECT}-PENETRATION-TEST-PLAN.md
โ โโโ ...
โโโ .phase_working/{SESSION_ID}/ # Working data
โโโ data/ # YAML phase data
โ โโโ P1_project_context.yaml
โ โโโ P2_dfd_elements.yaml
โ โโโ ...
โโโ reports/ # Markdown reports
โโโ P1-PROJECT-UNDERSTANDING.md
โโโ ...
# STRIDE threat patterns
python scripts/unified_kb_query.py --stride spoofing
# Security controls
python scripts/unified_kb_query.py --control AUTHN
# CWE information with full chain
python scripts/unified_kb_query.py --cwe CWE-89 --full-chain
# CAPEC attack patterns
python scripts/unified_kb_query.py --capec CAPEC-66 --attack-chain
# AI/LLM specific threats
python scripts/unified_kb_query.py --all-llm
python scripts/module_discovery.py /path/to/project --p1-discovery
# Query previous phase data
python scripts/phase_data.py --query --phase 1 --root /path/to/project
# Validate phase output
python scripts/phase_data.py --validate --phase 2 --root /path/to/project
# Initialize new session
python scripts/phase_data.py --init --project "PROJECT-NAME" --path /path/to/project
P1 โ P2 โ P3 โ P4 โ P5 โ P6 โ P7 โ P8
โ โ โ โ โ โ โ โโโ Report Generation
โ โ โ โ โ โ โโโ Mitigation Planning
โ โ โ โ โ โโโ Risk Validation (POC, attack paths)
โ โ โ โ โโโ STRIDE Threat Analysis (threat matrix)
โ โ โ โโโ Security Design Review (16 domains)
โ โ โโโ Trust Boundary Evaluation
โ โโโ Call Flow & DFD Analysis (data flows, call flows)
โโโ Project Understanding (modules, entry points)
| Category | Coverage |
|---|---|
| Security Controls | 16 domains, 107 controls |
| Threat Patterns | CWE/CAPEC/ATT&CK (1,900+ patterns) |
| AI/LLM Threats | 350+ threats |
| Compliance | OWASP ASVS, WSTG, MASTG |
| SQLite Index | ~8 MB searchable |
| Type | Example Technologies | Special Focus |
|---|---|---|
| Web API | Django, FastAPI, Express | Authentication, API Security |
| Microservices | K8s, Istio, Kafka | Service Mesh, Zero Trust |
| AI/LLM Application | Claude API, RAG, Vector DB | Prompt Injection, Model Security |
| Mobile Backend | JWT, OAuth, Firebase | Token Security, Data Privacy |
| Legacy System | Monolith, SOAP | Technical Debt, Migration Risks |
BSD-3-Clause
agents/
openai.yaml
assets/
contracts/
data-model.yaml
CHANGELOG.md
docs/
ARCHITECTURE-WORKFLOW-GUIDE-cn.md
ARCHITECTURE-WORKFLOW-GUIDE.md
KNOWLEDGE-ARCHITECTURE-v5.2-cn.md
KNOWLEDGE-ARCHITECTURE-v5.2.md
REPORT-DESIGN.md
SKILL-ARCHITECTURE-DESIGN-cn.md
SKILL-ARCHITECTURE-DESIGN.md
Skillset-threat-modeling-tour-cn-v5.md
Skillset-threat-modeling-tour-v5.md
kb
knowledge/
agentic-threats.yaml
capec-mappings.yaml
cloud-services.yaml
compliance-mappings.yaml
comprehensive-mappings.yaml
cwe-mappings.yaml
llm-threats.yaml
owasp_cwe_mapping.json
phase2/
completeness-rules.yaml
data-store-patterns.yaml
framework-routing-patterns.yaml
security-checkpoint-patterns.yaml
sast-rules.yaml
secure-coding-rules.yaml
security_kb.sqlite
security-controls/
control-set-01-authentication.md
control-set-02-authorization.md
control-set-03-input-validation.md
control-set-04-output-encoding.md
control-set-05-client-side.md
control-set-06-cryptography.md
control-set-07-logging.md
control-set-08-error-handling.md
control-set-09-api-security.md
control-set-10-data-protection.md
control-set-ext-01_02-auth-patterns.md
control-set-ext-10-hardcoded-credentials.md
control-set-ext-11-infrastructure.md
control-set-ext-12-supply-chain.md
control-set-ext-13-ai-llm.md
control-set-ext-14-mobile.md
control-set-ext-15-cloud.md
control-set-ext-16-agentic.md
references/
reference-set-01-authentication.md
reference-set-01-cookie-theft-mitigation.md
reference-set-01-credential-stuffing-prevention.md
reference-set-01-forgot-password.md
reference-set-01-jaas.md
reference-set-01-jwt-java.md
reference-set-01-multifactor-authentication.md
reference-set-01-password-storage.md
reference-set-01-saml-security.md
reference-set-01-security-questions.md
reference-set-01-session-management.md
reference-set-02-access-control.md
reference-set-02-authorization.md
reference-set-02-idor-prevention.md
reference-set-02-transaction-authorization.md
reference-set-03-bean-validation.md
reference-set-03-deserialization.md
reference-set-03-file-upload.md
reference-set-03-injection-prevention-java.md
reference-set-03-injection-prevention.md
reference-set-03-input-validation.md
reference-set-03-ldap-injection-prevention.md
reference-set-03-mass-assignment.md
reference-set-03-os-command-injection-defense.md
reference-set-03-query-parameterization.md
reference-set-03-sql-injection-prevention.md
reference-set-03-ssrf-prevention.md
reference-set-03-unvalidated-redirects.md
reference-set-05-clickjacking-defense.md
reference-set-05-csp.md
reference-set-05-csrf-prevention.md
reference-set-05-css-security.md
reference-set-05-dom-clobbering-prevention.md
reference-set-05-dom-xss-prevention.md
reference-set-05-hsts.md
reference-set-05-html5-security.md
reference-set-05-http-headers.md
reference-set-05-prototype-pollution-prevention.md
reference-set-05-third-party-javascript.md
reference-set-05-xss-filter-evasion.md
reference-set-05-xss-prevention.md
reference-set-06-certificate-pinning.md
reference-set-06-cryptographic-storage.md
reference-set-06-key-management.md
reference-set-06-tls-cipher-string.md
reference-set-06-tls.md
reference-set-06-transport-layer-protection.md
reference-set-07-logging-vocabulary.md
reference-set-07-logging.md
reference-set-08-error-handling.md
reference-set-08-xs-leaks.md
reference-set-09-ajax-security.md
reference-set-09-dos-prevention.md
reference-set-09-graphql.md
reference-set-09-microservices-security.md
reference-set-09-rest-assessment.md
reference-set-09-rest-security.md
reference-set-09-web-service-security.md
reference-set-10-database-security.md
reference-set-10-secrets-management.md
reference-set-10-user-privacy.md
reference-set-ext-11-docker-security.md
reference-set-ext-11-iac-security.md
reference-set-ext-11-kubernetes-security.md
reference-set-ext-11-nodejs-docker.md
reference-set-ext-12-cicd-security.md
reference-set-ext-12-dependency-management.md
reference-set-ext-12-npm-security.md
reference-set-ext-12-supply-chain-security.md
reference-set-ext-13-ai-agent-security.md
reference-set-ext-14-automotive-security.md
reference-set-ext-14-mobile-security.md
reference-set-ext-15-cloud-architecture.md
reference-set-ext-16-agentic-security.md
security-design.yaml
security-principles.yaml
stride_cwe_mapping.json
stride-controls-mapping.yaml
stride-library.yaml
tool-capabilities.yaml
verification-mappings.yaml
LICENSE
phases/
P1-PROJECT-UNDERSTANDING.md
P2-DFD-ANALYSIS.md
P3-TRUST-BOUNDARY.md
P4-SECURITY-DESIGN-REVIEW.md
P5-STRIDE-ANALYSIS.md
P6-RISK-VALIDATION.md
P7-MITIGATION-PLANNING.md
P8-REPORT-GENERATION.md
P8R-DETAILED-REPORT.md
README-cn.md
README.md
references/
binary-analysis.md
complex-system-analysis.md
tool-integration-guide.md
scripts/
module_discovery.py
phase_data.py
report_generator.py
stride_matrix.py
unified_kb_query.py
skill_path.sh
SKILL.md
VERSION
WORKFLOW.mdFAQ
threat-modeling is a Claude Code plugin with 1 hand-picked skill for security work, indexed on Flowy. Install it with the command on its page. It includes threat-modeling. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.