/threat-modeling-toolkit:tm-initfrom threat-modeling-toolkit
Initializes a threat model by analyzing architecture documentation. Discovers assets, data flows, trust boundaries, and attack surface using STRIDE or PASTA frameworks.
Ships in threat-modeling-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Initialize a comprehensive threat model by analyzing your system's architecture documentation. This skill discovers and catalogs:
/tm-init [--docs <path>] [--scope <pattern>] [--framework stride|pasta]
Arguments (parsed from $ARGUMENTS):
--docs <path>: Path to architecture documentation (default: ./docs)--scope <pattern>: Limit analysis to matching components--framework: Threat framework to use (default: stride)Scan the documentation directory for architecture artifacts:
Glob patterns to search:
- **/*.md (Markdown documentation)
- **/README* (Project readmes)
- **/openapi.yaml, **/openapi.json (API specs)
- **/swagger.* (Swagger specs)
- **/*.mmd, **/*.puml (Diagrams)
- **/docker-compose.* (Infrastructure)
- **/Dockerfile* (Containerization)
- **/*.tf (Terraform)
- **/k8s/**, **/kubernetes/** (Kubernetes)
For each component found, identify and classify:
Asset Types:
| Type | Description | Look For |
|---|---|---|
data-store | Persists data | PostgreSQL, MySQL, MongoDB, Redis, S3, etc. |
service | Backend logic | API servers, microservices, workers |
client | User interfaces | Web apps, mobile apps, CLIs |
integration | External systems | Payment gateways, email services, third-party APIs |
infrastructure | Platform components | Load balancers, CDN, DNS, queues |
identity | Auth systems | IdP, OAuth providers, SSO |
secret | Sensitive material | API keys, certificates, credentials |
Data Classifications:
public: Publicly available informationinternal: Internal business dataconfidential: Sensitive business datarestricted: PII, PHI, financial data, credentialsIdentify how data moves between components:
Identify where security context changes:
Trust Boundary Types:
network: Public/DMZ/Internal network segmentationprocess: Process/container isolationprivilege: User/admin/system privilege changesenvironment: Dev/staging/prod boundariesorganizational: Third-party/vendor boundariesdata-classification: Sensitivity level changesDocument all entry points:
Attack Surface Types:
api: REST, GraphQL, gRPC endpointsweb-ui: Web application interfacesmobile: Mobile application entry pointscli: Command-line interfacesadmin: Administrative interfacesintegration: Webhooks, callbacksfile-upload: File upload functionalitymessage-queue: Message queue consumersCreate Mermaid diagrams for visualization.
Create the following directory structure:
.threatmodel/
├── config.yaml
├── state/
│ ├── assets.json
│ ├── dataflows.json
│ ├── trust-boundaries.json
│ ├── attack-surface.json
│ └── sequences.json
├── diagrams/
│ ├── architecture.mmd
│ ├── dataflow.mmd
│ └── trust-boundaries.mmd
├── reports/
├── baseline/
└── policies/
Create .threatmodel/config.yaml:
project:
name: "[Project Name]"
version: "1.0.0"
description: "[Description]"
analysis:
framework: "stride"
depth: "standard"
documentation:
paths:
- "./docs"
patterns:
- "**/*.md"
- "**/openapi.yaml"
verification:
code_paths:
- "./src"
exclude_paths:
- "./node_modules"
- "./**/*.test.*"
compliance:
frameworks:
- owasp
{
"version": "1.0",
"generated": "ISO-8601 timestamp",
"assets": [
{
"id": "asset-001",
"name": "User Database",
"type": "data-store",
"classification": "restricted",
"description": "PostgreSQL database storing user data",
"owner": "platform-team",
"data_types": ["pii", "credentials"],
"code_references": ["src/db/connection.ts"]
}
]
}
{
"version": "1.0",
"generated": "ISO-8601 timestamp",
"dataflows": [
{
"id": "flow-001",
"name": "User Login",
"source": {"asset_id": "asset-001", "component": "LoginPage"},
"destination": {"asset_id": "asset-002", "component": "AuthService"},
"data_types": ["credentials"],
"protocol": "HTTPS",
"encryption": {"in_transit": true},
"crosses_trust_boundary": true,
"trust_boundary_id": "tb-001"
}
]
}
When executing this skill:
Ask for documentation path if not provided in arguments
Explore the documentation:
Build understanding of the system:
Create the threat model structure:
.threatmodel/ directoryValidate completeness:
Write visual discovery report (.threatmodel/reports/discovery-report.md):
# Discovery Report
**Project**: [Name]
**Generated**: [Date]
## System Overview
DISCOVERY SUMMARY ═══════════════════════════════════════════════════════════
ASSETS DISCOVERED: 14 ───────────────────────────────────────────────────────── Services │████████████████░░░░░░░░░░░░░░░░░░░░░░░░│ 4 Data Stores │████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░│ 3 Clients │████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│ 2 Integrations │████████████████████░░░░░░░░░░░░░░░░░░░░│ 5
DATA FLOWS: 22 (8 cross trust boundaries) TRUST BOUNDARIES: 5 ATTACK SURFACE ENTRIES: 12
## Assets by Classification
| Asset | Type | Classification |
|-------|------|----------------|
| User Database | data-store | Restricted |
| API Gateway | service | Internal |
...
Console summary (also display to user):
Threat Model Initialized
========================
Project: [Name]
Framework: STRIDE
Discovered:
- X assets (breakdown by type)
- Y data flows (Z cross trust boundaries)
- N trust boundaries
- M attack surface entries
Created:
.threatmodel/config.yaml
.threatmodel/state/assets.json
.threatmodel/state/dataflows.json
.threatmodel/state/trust-boundaries.json
.threatmodel/state/attack-surface.json
.threatmodel/reports/discovery-report.md
.threatmodel/diagrams/architecture.mmd
.threatmodel/diagrams/dataflow.mmd
Next Steps:
Run /tm-threats to analyze threats
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub josemlopez/threat-modeling-toolkit --plugin threat-modeling-toolkit9 skills in this plugin
/tm-complianceMap threats and controls to compliance frameworks like OWASP Top 10, SOC2, PCI-DSS, HIPAA, GDPR. Generates compliance reports with coverage percentages and gaps. Use when checking compliance status, mapping to security frameworks, or generating audit documentation./tm-driftDetect changes in the threat model since the last baseline snapshot. Identifies new assets, changed flows, new threats, and control status changes. Use when comparing threat model versions, tracking security drift, monitoring for new risks, or validating changes after updates./tm-fullRun the complete threat modeling workflow from initialization through reporting. Orchestrates all other skills in sequence. Use when performing full threat model analysis, running complete security assessment, or generating comprehensive threat documentation./tm-reportGenerate comprehensive prioritized risk reports with executive summaries, threat details, gap analysis, and recommendations. Use when creating security reports, generating executive summaries, documenting risk assessments, or preparing audit documentation./tm-statusShow current threat model status including asset counts, threat distribution, control verification status, and compliance coverage. Use when checking threat model status, getting overview of security posture, or reviewing current state./tm-testsGenerate security test cases from the threat model. Creates test scenarios for each threat and control verification tests. Use when creating security tests, generating penetration test cases, building security regression tests, or validating threat mitigations.