# fr33d3m0n/threat-modeling architecture

> Architecture diagram of the GitHub repository fr33d3m0n/threat-modeling, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fr33d3m0n/threat-modeling
- Repository: https://github.com/fr33d3m0n/threat-modeling

## Overview

This repository is an AI-native threat-modeling skill, not a standalone scanning service: a user invokes it through Claude Code, which guides project analysis and produces security findings and reports. Its principal workflow covers eight documented phases, from understanding a project through mitigation and reporting. Distinct capabilities include code/module discovery, STRIDE analysis, tool-assisted vulnerability and binary analysis, and knowledge-base consultation. The excerpts show the discovery, phase-data, STRIDE, knowledge-query, and report-generation modules; workflow phase links and integrations are based on README documentation rather than inspected phase implementations.

Main entry points: [`SKILL.md`](https://github.com/fr33d3m0n/threat-modeling/blob/main/SKILL.md) (Threat Modeling Skill), [`phases/P1-PROJECT-UNDERSTANDING.md`](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P1-PROJECT-UNDERSTANDING.md) (Project Understanding), [`phases/P5-STRIDE-ANALYSIS.md`](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P5-STRIDE-ANALYSIS.md) (STRIDE Analysis), [`scripts/unified_kb_query.py`](https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/unified_kb_query.py) (Knowledge Query)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Threat Workflow"]
  node_skill["Threat Modeling Skill<br/>[SKILL.md]"]
  node_p1["Project Understanding"]
  node_p2["DFD Analysis<br/>[P2-DFD-ANALYSIS.md]"]
  node_p3["Trust Boundaries"]
  node_p4["Design Review"]
  node_p5["STRIDE Analysis"]
  node_p6["Risk Validation"]
  node_p7["Mitigation Planning"]
  node_p8["Report Generation"]
end

subgraph group_analysis["Analysis"]
  node_discovery["Module Discovery"]
  node_phase_data[("Phase Data Manager<br/>[phase_data.py]")]
  node_stride["STRIDE Calculator<br/>[stride_matrix.py]"]
  node_tooling{{"Analysis Tools"}}
end

subgraph group_knowledge["Knowledge"]
  node_kb_query["Knowledge Query"]
  node_kb_store[("Security Knowledge Base<br/>[security_kb.sqlite]")]
  node_curated_knowledge["Curated Security Data"]
end

subgraph group_reporting["Reporting"]
  node_report_renderer["Report Renderer"]
end

node_user(("Project Analyst"))

node_user -->|"invokes"| node_skill
node_skill -->|"starts workflow"| node_p1
node_p1 -->|"continues to"| node_p2
node_p2 -->|"continues to"| node_p3
node_p3 -->|"continues to"| node_p4
node_p4 -->|"continues to"| node_p5
node_p5 -->|"continues to"| node_p6
node_p6 -->|"continues to"| node_p7
node_p7 -->|"continues to"| node_p8
node_p1 -.->|"discovers modules"| node_discovery
node_skill -.->|"manages phase data"| node_phase_data
node_phase_data -.->|"validates coverage"| node_p6
node_p5 -.->|"calculates STRIDE"| node_stride
node_skill -.->|"queries knowledge"| node_kb_query
node_kb_query -.->|"reads"| node_kb_store
node_kb_query -.->|"reads"| node_curated_knowledge
node_p8 -.->|"renders reports"| node_report_renderer
node_skill -.->|"uses optionally"| node_tooling

click node_skill "https://github.com/fr33d3m0n/threat-modeling/blob/main/SKILL.md"
click node_p1 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P1-PROJECT-UNDERSTANDING.md"
click node_p2 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P2-DFD-ANALYSIS.md"
click node_p3 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P3-TRUST-BOUNDARY.md"
click node_p4 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P4-SECURITY-DESIGN-REVIEW.md"
click node_p5 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P5-STRIDE-ANALYSIS.md"
click node_p6 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P6-RISK-VALIDATION.md"
click node_p7 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P7-MITIGATION-PLANNING.md"
click node_p8 "https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P8-REPORT-GENERATION.md"
click node_discovery "https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/module_discovery.py"
click node_phase_data "https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/phase_data.py"
click node_stride "https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/stride_matrix.py"
click node_kb_query "https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/unified_kb_query.py"
click node_kb_store "https://github.com/fr33d3m0n/threat-modeling/blob/main/knowledge/security_kb.sqlite"
click node_curated_knowledge "https://github.com/fr33d3m0n/threat-modeling/tree/main/knowledge"
click node_report_renderer "https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/report_generator.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_skill,node_p1,node_p2,node_p3,node_p4,node_p5,node_p6,node_p7,node_p8 toneBlue
class node_discovery,node_phase_data,node_stride,node_tooling toneAmber
class node_kb_query,node_kb_store,node_curated_knowledge toneMint
class node_report_renderer toneRose
class node_user toneIndigo
```

## Components

### Threat Workflow

- [Threat Modeling Skill](https://github.com/fr33d3m0n/threat-modeling/blob/main/SKILL.md): `SKILL.md`
- [Project Understanding](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P1-PROJECT-UNDERSTANDING.md): `phases/P1-PROJECT-UNDERSTANDING.md`
- [DFD Analysis](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P2-DFD-ANALYSIS.md): `phases/P2-DFD-ANALYSIS.md`
- [Trust Boundaries](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P3-TRUST-BOUNDARY.md): `phases/P3-TRUST-BOUNDARY.md`
- [Design Review](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P4-SECURITY-DESIGN-REVIEW.md): `phases/P4-SECURITY-DESIGN-REVIEW.md`
- [STRIDE Analysis](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P5-STRIDE-ANALYSIS.md): `phases/P5-STRIDE-ANALYSIS.md`
- [Risk Validation](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P6-RISK-VALIDATION.md): `phases/P6-RISK-VALIDATION.md`
- [Mitigation Planning](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P7-MITIGATION-PLANNING.md): `phases/P7-MITIGATION-PLANNING.md`
- [Report Generation](https://github.com/fr33d3m0n/threat-modeling/blob/main/phases/P8-REPORT-GENERATION.md): `phases/P8-REPORT-GENERATION.md`

### Analysis

- [Module Discovery](https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/module_discovery.py): `scripts/module_discovery.py`
- [Phase Data Manager](https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/phase_data.py): `scripts/phase_data.py`
- [STRIDE Calculator](https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/stride_matrix.py): `scripts/stride_matrix.py`
- **Analysis Tools**

### Knowledge

- [Knowledge Query](https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/unified_kb_query.py): `scripts/unified_kb_query.py`
- [Security Knowledge Base](https://github.com/fr33d3m0n/threat-modeling/blob/main/knowledge/security_kb.sqlite): `knowledge/security_kb.sqlite`
- [Curated Security Data](https://github.com/fr33d3m0n/threat-modeling/tree/main/knowledge): `knowledge`

### Reporting

- [Report Renderer](https://github.com/fr33d3m0n/threat-modeling/blob/main/scripts/report_generator.py): `scripts/report_generator.py`

### Other components

- **Project Analyst**

## Connections

- Project Analyst → Threat Modeling Skill: invokes (evidence: `README.md`)
- Threat Modeling Skill → Project Understanding: starts workflow (evidence: `README.md`)
- Project Understanding → DFD Analysis: continues to (evidence: `README.md`)
- DFD Analysis → Trust Boundaries: continues to (evidence: `README.md`)
- Trust Boundaries → Design Review: continues to (evidence: `README.md`)
- Design Review → STRIDE Analysis: continues to (evidence: `README.md`)
- STRIDE Analysis → Risk Validation: continues to (evidence: `README.md`)
- Risk Validation → Mitigation Planning: continues to (evidence: `README.md`)
- Mitigation Planning → Report Generation: continues to (evidence: `README.md`)
- Project Understanding → Module Discovery: discovers modules
- Threat Modeling Skill → Phase Data Manager: manages phase data
- Phase Data Manager → Risk Validation: validates coverage
- STRIDE Analysis → STRIDE Calculator: calculates STRIDE
- Threat Modeling Skill → Knowledge Query: queries knowledge
- Knowledge Query → Security Knowledge Base: reads
- Knowledge Query → Curated Security Data: reads
- Report Generation → Report Renderer: renders reports
- Threat Modeling Skill → Analysis Tools: uses optionally (evidence: `README.md`)
