Skip to content
Skillpedia
Security40k · #5396

tm7-threat-model

Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.

What it does

This agent creates threat model files (.tm7) for the Microsoft tool. It transforms system descriptions into diagrams and security threats, in the exact format the tool understands.

When to use it

  • ✓When you need to create a threat model file (.tm7).
  • ✓When performing STRIDE threat modeling and needing a .tm7 file.
  • ✓If you want to generate or modify a .tm7 file for the Microsoft Threat Modeling Tool.

Example of what to ask your AI

“Create a .tm7 file for a system with a user, a web app, and a database.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/github/awesome-copilot/blob/main/skills/tm7-threat-model/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/tm7-threat-model/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

It identifies your system's components (like processes and databases), assigns unique identifiers, and organizes everything into an XML file with a specific structure. The file is formatted precisely to be read by the Microsoft Threat Modeling Tool.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add github/awesome-copilot --skill tm7-threat-model

Or download just the file:

curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/tm7-threat-model/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Microsoft Threat Modeling Tool (.tm7) Generator

You generate valid .tm7 files for the Microsoft Threat Modeling Tool (v7.3+). A .tm7 file is not generic XML — it is a WCF DataContractSerializer document with an exact namespace and element structure. If the structure is wrong, the tool refuses to open the file with:

"File is not an actual threat model or the threat model may be corrupted."

Your job is to translate a described system (components, data stores, external actors, data flows, trust boundaries) into a diagram plus STRIDE threats, serialized in the exact .tm7 format described below.

Workflow

When asked to produce a .tm7 file:

  1. Model the system. Identify the elements:
    • Processes (web apps, services, functions) → StencilEllipse, GE.P
    • Data stores (databases, caches, queues, blobs) → StencilParallelLines, GE.DS
    • External interactors (users, browsers, third-party systems) → StencilRectangle, GE.EI
    • Trust boundaries → BorderBoundary, GE.TB
    • Data flows connecting the above → Connector, GE.DF
  2. Assign a unique lowercase UUID (e.g. 148ade68-5c80-40f3-8e1f-4e2cabdb5991) to every stencil and every flow. Never use human-readable ids like users-browser.
  3. Lay out coordinates (Left/Top/Width/Height) so stencils don't overlap.
  4. Generate STRIDE threats per interaction and place them in <ThreatInstances>.
  5. Serialize using the structure in this guide, mirroring assets/example-minimal.tm7.
  6. Validate against the "Common Mistakes" checklist before returning the file.
  7. Write the file with no XML declaration and no pretty-print indentation (a single continuous XML stream is what the serializer emits).

Always open assets/example-minimal.tm7 first and adapt it — reuse its exact serialization skeleton and only change stencil types, names, coordinates, flows, and threats.

CRITICAL: Serialization format

TM7 files use WCF DataContractSerializer XML, not standard XML.

The file MUST start with this exact root element — no <?xml?> declaration:

<ThreatModel xmlns="http://schemas.datacontract.org/2004/07/ThreatModeling.Model" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

NEVER use:

  • <?xml version="1.0" encoding="utf-8"?> — causes deserialization failure.
  • xmlns:xsi / xmlns:xsd — these are standard XML namespaces, not DataContract namespaces.
  • Invented elements such as <SecurityGaps> or <Mitigations> — they do not exist in the TM7 schema.

Note: <MetaInformation> (with children like <Owner>, <Contributors>, <Reviewer>, <Assumptions>, <ExternalDependencies>, <HighLevelSystemDescription>, <ThreatModelName>), <Notes>, and <KnowledgeBase> are part of the real schema and are emitted by the tool — keep them (see the structure below and assets/example-minimal.tm7). Just don't invent elements that the tool never produces.

Required namespace prefixes

Prefix URI Used for
(default) http://schemas.datacontract.org/2004/07/ThreatModeling.Model Root ThreatModel
xmlns:i http://www.w3.org/2001/XMLSchema-instance Type attributes
xmlns:z http://schemas.microsoft.com/2003/10/Serialization/ Reference ids (z:Id)
xmlns:a http://schemas.microsoft.com/2003/10/Serialization/Arrays Arrays / collections
xmlns:b http://schemas.datacontract.org/2004/07/ThreatModeling.KnowledgeBase Stencil properties
xmlns:c http://www.w3.org/2001/XMLSchema Primitive type values

File structure (correct order)

A full tool export contains, in this order: DrawingSurfaceList, MetaInformation, Notes, ThreatInstances, ThreatMetaData (often empty/self-closing), then the large generic KnowledgeBase as a top-level sibling (not nested inside ThreatMetaData), and finally Profile.

<ThreatModel xmlns="..." xmlns:i="...">
  <DrawingSurfaceList>
    <DrawingSurfaceModel z:Id="i1" xmlns:z="...">
      <GenericTypeId xmlns="...Abstracts">DRAWINGSURFACE</GenericTypeId>
      <Guid xmlns="...Abstracts">{guid}</Guid>
      <Properties xmlns="...Abstracts" xmlns:a="...Arrays">...</Properties>
      <TypeId xmlns="...Abstracts">DRAWINGSURFACE</TypeId>
      <Borders xmlns:a="...Arrays">
        <!-- Stencil elements: processes, data stores, external entities, boundaries -->

…
FAQ

What is a .tm7 file?

It's a file used by the Microsoft Threat Modeling Tool to save and share system security models.

What is STRIDE?

STRIDE is a method for identifying security threats in systems, focusing on Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, and Elevation of Privilege.

Why is the file format so important?

The .tm7 file has a very specific XML structure. If it's incorrect, the Microsoft Threat Modeling Tool won't be able to open the file, showing an error message.

Details

Original description by the author

Creates valid Microsoft Threat Modeling Tool (.tm7) files compatible with the Microsoft Threat Modeling Tool v7.3+. Use this skill whenever asked to create, generate, or modify a .tm7 threat model file, or when performing STRIDE threat modeling that should output a .tm7 file that opens cleanly in the Microsoft Threat Modeling Tool.

repo: github/awesome-copilot

Popularity

GitHub stars
40k
Ranking position
#5396
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills