threat-model
Skill1 starsChanged 3 months agoMITView on GitHub
Update Microsoft Threat Modeling Tool (.tm7) files to reflect design changes. Use when the user wants to update a threat model, add new elements/flows/threats to a .tm7 file, modify DFD diagrams, or apply STRIDE analysis. Triggers include: any mention of 'threat model', '.tm7', 'STRIDE', 'DFD', 'data flow diagram', 'threat modeling tool', or requests to add threats, trust boundaries, data flows, or external interactors to a threat model. Also use when user provides a design flowchart and wants to update the corresponding threat model.
62 other projects use a version of this.
Adopted by
Most recently taken up by
- anthropics/claude-plugins-officialtheir own version, first seen Nov 29, 2026
- navikt/copilottheir own version, first seen Nov 16, 2026
- Lucface/claude-skillstheir own version, first seen Nov 16, 2026
- MichaelRyanWood/claude-skillstheir own version, first seen Nov 16, 2026
- seancabalse/agentic-playbooktheir own version, first seen Nov 16, 2026
- Yomudogly/oh-my-agytheir own version, first seen Nov 16, 2026
Used with
Projects 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
shihwesleySkillorbit
This skill should be used when the user says '/orbit', '/orbit init', '/orbit status', '/orbit test', '/orbit staging', '/orbit use', '/orbit sidecars', '/orbit logs', '/orbit stop', '/orbit check', '/orbit templates', asks about environment status or switching, wants to run tests in Docker containers, needs to manage dev/test/staging environments, or asks about sidecar services like PostgreSQL or Redis for their project.
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
Other versions62 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 62
- anthropics/claude-plugins-official★ 49ksame name
- openai/codex-security★ 14ksame name
- openai/plugins★ 8.4ksame name
- anthropics/defending-code-reference-harness★ 7.5ksame name
- Q00/ouroboros★ 6.4ksame name
- me2resh/apexyard★ 542same name
- jmanico/grim-prompter★ 497same name
- Cosmian/kms★ 380same name
- mbwsims/claude-universe★ 71same name
- navikt/copilot★ 65same name
52 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.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- bug-reportSkill
- code-coverage-policySkill
- coding-agents-setupSkill
- repo-agents-setupSkill
- review-designSkill
- review-prSkill
- self-reviewSkill
- sync-skillsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. 0 are common, 11 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 56 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Update Microsoft Threat Modeling Tool (TMT) .tm7 files programmatically — adding DFD elements, data flows, trust boundaries, and STRIDE …
- Distinctive: line 35
Should arrow labels follow a specific naming convention?
- Distinctive: line 39
Read the .tm7 file and extract the current state.
- Very specific: line 73
Write a Python script that uses the builder functions from references/tm7_builders.py.
- Distinctive: line 150
All text arguments accept plain text — escaping is handled internally.
- Very specific: line 177
Check for double-escaped XML entities (&amp;)
- Distinctive: line 178
Verify new GUIDs are present
- Distinctive: line 179
Verify Out Of Scope flags are set correctly
- Distinctive: line 180
Verify trust boundary dimensions encompass intended elements
- Very specific: line 194
Avoid double-escaping: never pre-escape & as &.
- Very specific: line 199
When moving an element, update all connected data flow connectors — use move_element() + move_connector_endpoint() for each connector
- Distinctive: line 204
When inserting a new numbered flow between existing ones, rename in reverse order (highest number first) to avoid name collisions
- Very specific: line 210
Arrow labels: Use format N. Operation (Auth) — e.g., 5.
- Distinctive: line 212
Element names: Use clear, descriptive names matching the design diagram
- Distinctive: line 220
Write specific, actionable threat descriptions — not generic boilerplate
- Distinctive: line 223
Update InteractionString in threats when renaming data flows
- Distinctive: line 227
Update it whenever new flows are added
“Common” is measured: kept by at least 6 in 10 of the 56 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 Update Skill
Update Microsoft Threat Modeling Tool (TMT) .tm7 files programmatically — adding DFD elements, data flows, trust boundaries, and STRIDE threats to reflect new or changed system designs.
When to Use
- User provides a design change (flowchart, architecture diagram, description) and wants the threat model updated
- User wants to add new processes, external interactors, data stores, data flows, or trust boundaries
- User wants new STRIDE threats generated for new or modified data flows
- User wants to restructure trust boundaries or rename elements
- User wants to move elements in or out of trust boundaries
High-Level Workflow
Phase 1: Gather Inputs
Collect from the user:
- Design input: New/changed system design — flowchart, Mermaid diagram, architecture doc, or verbal description
- Target .tm7 file: Path to the existing threat model file to update
- Scope: Which parts of the design are new vs already modeled
Ask clarifying questions:
- Which elements are in-scope vs out-of-scope for threat analysis?
- Which trust boundaries should elements belong to?
- What authentication methods are used on each data flow? (e.g., MSI, OAuth, access token, GitHub App, user login)
- Should arrow labels follow a specific naming convention?
Phase 2: Analyze Existing .tm7
Read the .tm7 file and extract the current state. See references/tm7-format.md for the full format reference.
Extract and present to the user:
- All border elements (stencils): processes, external interactors, data stores — names, GUIDs, positions, out-of-scope flags
- All trust boundaries: names, GUIDs, positions, dimensions — which elements they contain
- All data flow connectors: names, source/target elements, authentication annotations
- All existing threats: count by STRIDE category, current ID range
- Annotations/notes: free-text boxes on the diagram
- z:Id sequence: the last used z:Id value (needed for adding new elements)
Key values to record for later use:
- Drawing Surface GUID: needed for all new threat instances
- Existing element GUIDs: needed as source/target references for new data flows
- Last threat ID: new threats continue from this number
- Last z:Id: new elements continue from this number
Phase 3: Plan Changes
Based on the design input and existing model state, produce a change plan:
| Change Type | Details |
| New border elements | Name, type (Process/EI/DataStore), position, in/out of scope |
| New data flows | Name, source, target, auth method |
| Modified elements | What changes (position, scope, name) |
| Trust boundary changes | New boundaries, expanded boundaries, elements to include |
| New threats | Which flows get threats, STRIDE categories to cover |
| Annotation updates | Updated step descriptions |
Present the plan to the user for approval before proceeding.
Phase 4: Generate Update Script
Write a Python script that uses the builder functions from references/tm7_builders.py. Copy the needed functions into the script — they handle all XML generation and escaping.
Script pattern:
import argparse
# Copy builder functions from references/tm7_builders.py:
# xml_escape, make_external_interactor, make_process,
# make_connector, make_threat,
# set_out_of_scope, resize_boundary, rename_data_flow
DRAWING_SURFACE_GUID = "..." # from Phase 2
# ... other existing GUIDs ...
# ... new deterministic GUIDs ...
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--input", required=True)
parser.add_argument("--output", default=None)
args = parser.parse_args()
with open(args.input, "r", encoding="utf-8") as f:
content = f.read()
# Note: .tm7 files produced by Microsoft Threat Modeling Tool contain a
# single DrawingSurfaceModel, so these closing tags appear exactly once.
# 1. Add new border elements before </Borders>
new_borders = []
new_borders.append(make_external_interactor(GUID, z_id, "Name", left, top))
new_borders.append(make_process(GUID, z_id, "Name", left, top))
content = content.replace("</Borders>", "".join(new_borders) + "</Borders>")
# 2. Add new data flows before </Lines>
new_lines = []
new_lines.append(make_connector(GUID, z_id, "N. Operation (Auth)",
source_guid, target_guid,
source_x, source_y, target_x, target_y, handle_x, handle_y))
content = content.replace("</Lines>", "".join(new_lines) + "</Lines>")
# 3. Add new threats before </ThreatInstances>
new_threats = []
new_threats.append(make_threat(threat_id, "TH7", DRAWING_SURFACE_GUID,
source_guid, flow_guid, target_guid,
"Threat title", "Spoofing", "Short desc",
"Full description", "Flow name", "Mitigations"))
content = content.replace("</ThreatInstances>",
"".join(new_threats) + "</ThreatInstances>")
# 4. Modify existing elements
content = set_out_of_scope(content, element_guid, "true")
content = resize_boundary(content, boundary_guid, left, top, width, height)
content = rename_data_flow(content, "old name", "new name")
with open(args.output or args.input, "w", encoding="utf-8") as f:
f.write(content)
if __name__ == "__main__":
main()Available builder functions (see references/tm7_builders.py):
| Function | Purpose |
xml_escape(text) | Escape &, <, > for XML values |
make_external_interactor(guid, z_id, name, left, top, ...) | Create External Interactor element |
make_process(guid, z_id, name, left, top, ...) | Create Process element |
make_connector(guid, z_id, name, source_guid, target_guid, ...) | Create data flow connector |
make_threat(threat_id, type_id, drawing_surface_guid, ...) | Create STRIDE threat instance |
set_out_of_scope(content, element_guid, value) | Set Out Of Scope flag on an element |
resize_boundary(content, boundary_guid, left, top, width, height) | Resize a trust boundary |
rename_data_flow(content, old_name, new_name) | Rename a flow + update threat references |
move_element(content, element_guid, new_left, new_top) | Move an element to a new position |
move_connector_endpoint(content, connector_guid, element_guid, new_x, new_y, ...) | Update connector Source/TargetX/Y after moving an element |
All text arguments accept plain text — escaping is handled internally.
STRIDE Threat Generation
For each new data flow, generate threats covering relevant categories:
| Category | When to Apply | Typical TypeId |
| Spoofing | Flow uses credentials/tokens | TH7, TH86 |
| Tampering | Flow carries modifiable data | TH96, TH108 |
| Repudiation | Automated actions without audit trail | TH30 |
| Information Disclosure | Flow could leak sensitive data | TH94, TH101 |
| Denial of Service | Flow to shared resource (apply selectively) | — |
| Elevation of Privileges | Automated entity has elevated permissions | TH110 |
Unauthenticated API flows deserve special threat attention:
- Spoofing via DNS hijacking / MITM (no client auth to verify identity)
- Tampering of response data in transit
- Information Disclosure of query patterns revealing internal structure
- API abuse / data poisoning if the service has any write surface
- EoP when untrusted response data flows into an automated fix pipeline
Phase 5: Run and Verify
- Run the script against the .tm7 file
- Verify changes programmatically:
- Count border elements, data flows, and threats before/after
- Check for double-escaped XML entities (
&amp;) - Verify new GUIDs are present
- Verify Out Of Scope flags are set correctly
- Verify trust boundary dimensions encompass intended elements
- Report results to the user with a summary table
Tell the user to open the .tm7 in Microsoft Threat Modeling Tool to visually verify:
- Element positions and layout
- Arrow label readability (no overlaps)
- Trust boundary coverage
- Threat list completeness
Best Practices
XML Manipulation
- Always use string-based manipulation (find/replace) — never DOM parsers for .tm7 files
- Pass plain text to builder functions — they handle XML escaping internally
- Avoid double-escaping: never pre-escape
&as&before passing to builders - Use deterministic GUIDs for reproducibility — hardcode them as constants
- Use large search regions (5000+ chars from GUID marker): TMT built-in stencils (
SE.P.TMCore.WebApp, etc.) have many more properties than generic elements, pushing positional fields (Left,Top,SourceX,TargetX) far from the<a:Key>marker. A 3000-char region will miss them.
Moving Elements
- When moving an element, update all connected data flow connectors — use
move_element()+move_connector_endpoint()for each connector - Find connected connectors by searching for the element's GUID in
<SourceGuid>and<TargetGuid>tags - Adjust
HandleX/HandleYproportionally to keep labels readable
Renumbering Flows
- When inserting a new numbered flow between existing ones, rename in reverse order (highest number first) to avoid name collisions
- Example: inserting new step 6 → rename 9→10, 8→9, 7→8, 6→7, then add step 6
rename_data_flow()updates both the connector name and all threatInteractionStringreferences automatically- Each renamed flow may have multiple threats — all are updated in one call
Naming Conventions
- Arrow labels: Use format
N. Operation (Auth)— e.g.,5. Create Issue (GitHub App) - Auth methods: MSI, GitHub App, GitHub Login, OAuth, Access Token, API Key, No Auth, etc.
- Element names: Use clear, descriptive names matching the design diagram
Positioning
- Spread arrow handle positions to avoid label overlap — vary HandleX/HandleY coordinates
- Expand trust boundaries with 50px padding around contained elements
- Keep elements within their trust boundaries — verify positions against boundary coordinates
Threat Quality
- Write specific, actionable threat descriptions — not generic boilerplate
- Include concrete mitigations relevant to the specific technology and auth method
- Set appropriate priority: High for credential theft, code injection, privilege escalation; Medium for audit/logging gaps
- Update InteractionString in threats when renaming data flows
Annotation
- Maintain a step-by-step annotation box describing the entire workflow
- Update it whenever new flows are added
- Expand the annotation box dimensions to fit additional text
Reference Files
| File | Purpose |
| references/tm7_builders.py | Reusable Python builder functions — copy into your script |
| references/tm7-format.md | .tm7 XML format specification, namespace reference, threat TypeIds |
Output Artifacts
When done, produce:
- Python update script — using builders from
tm7_builders.py, with--input/--outputargs - Changes summary (Markdown) — table of all elements, flows, and threats added
- Updated .tm7 file — ready to open in Microsoft Threat Modeling Tool
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.

