AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

threat-model-analyst

Full STRIDE-A threat model analysis and incremental update skill for repositories and systems. Supports two modes: (1) Single analysis — full STRIDE-A threat model of a repository, producing architecture overviews, DFD diagrams, STRIDE-A analysis, prioritized findings, and executive assessments. (2) Incremental analysis — takes a previous threat model report as baseline, compares the codebase at the latest (or a given commit), and produces an updated report with change tracking (new, resolved, still-present threats), STRIDE heatmap, findings diff, and an embedded HTML comparison. Only activate when the user explicitly requests a threat model analysis, incremental update, or invokes /threat-model-analyst directly.

Original source
github
License
MIT
Pinned revision
5269f7ea2d6c3a9bfda5ed878b6726cf509121fd

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read github--threat-model-analyst at revision 5269f7ea2d6c3a9bfda5ed878b6726cf509121fd, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 17

references/verification-checklist.md

Verification Checklist — Post-Analysis Quality Gates

This file is the single source of truth for all verification rules that must pass before a threat model report is finalized. It is designed to be handed to a verification sub-agent along with the output folder path.

Authority hierarchy: This file contains CHECKING rules (pass/fail criteria for quality gates). The AUTHORING rules that produce the content being checked are in orchestrator.md. Some rules appear in both files for visibility — if they ever conflict: orchestrator.md takes precedence for authoring decisions (how to write), this file takes precedence for pass/fail criteria (what constitutes a valid output). Do NOT remove rules from either file to "deduplicate" — the overlap is intentional for visibility.

When to use: After ALL output files are written (0.1-architecture.md through 0-assessment.md), run every check in this file. If any check fails, fix the issue before finalizing.

Sub-agent delegation: The orchestrator can delegate this entire file to a verification sub-agent with the prompt:

"Read verification-checklist.md. For each check, inspect the named output file(s) and report PASS/FAIL with evidence. Fix any failures."


Inline Quick-Checks (Run Immediately After Each File Write)

Purpose: These are lightweight self-checks the WRITING agent runs immediately after creating each file — NOT deferred to Step 10. Since the agent just wrote the file, the content is still in active context, making these checks highly effective.

How to use: Before writing each file, read the corresponding skeleton from skeletons/skeleton-*.md. After each create_file call, scan the content you just wrote for these patterns. If any check fails, fix the file immediately before proceeding to the next step.

Skeleton compliance rule: Every output file MUST follow its skeleton's section order, table column headers, and heading names. Do NOT add sections/tables not in the skeleton. Do NOT rename skeleton headings.

After writing 3-findings.md:

  • [ ] First finding heading starts with ### FIND-01: (not F01, F-01, or Finding 1)
  • [ ] Every finding has these exact row labels: SDL Bugbar Severity, Remediation Effort, Mitigation Type, Exploitability Tier, Exploitation Prerequisites, Component
  • [ ] Every CVSS value contains CVSS:4.0/ prefix
  • [ ] Every Related Threats cell contains ](2-stride-analysis.md# (hyperlink, not plain text)
  • [ ] Every finding has #### Description, #### Evidence, #### Remediation, and #### Verification sub-headings (not Recommendation, not Impact, not Mitigation, not bold **Description:** paragraphs) — exactly 4 sub-headings, no extras
  • [ ] Every #### Description section has at least 2 sentences of technical detail (not single-sentence stubs)
  • [ ] Every #### Evidence section cites specific file paths, line numbers, or config keys (not generic statements like "found in codebase")
  • [ ] Every finding has ALL 10 mandatory attribute rows: SDL Bugbar Severity, CVSS 4.0, CWE, OWASP, Exploitation Prerequisites, Exploitability Tier, Remediation Effort, Mitigation Type, Component, Related Threats
  • [ ] Every CWE value is a hyperlink: contains ](https://cwe.mitre.org/ (not plain text like CWE-79)
  • [ ] Every OWASP value uses :2025 suffix (not :2021)
  • [ ] Findings organized by TIER (Tier 1/2/3 headings), NOT by severity (no ## Critical Findings)
  • [ ] Tier-Prerequisite consistency (inline): For each finding, use canonical mapping: None→T1; Authenticated User/Privileged User/Internal Network/Local Process Access→T2; Host/OS Access/Admin Credentials/Physical Access/{Component} Compromise/combos→T3. ⛔ Application Access and Host Access are FORBIDDEN.
  • [ ] Count finding headings — they must be sequential: FIND-01, FIND-02, FIND-03...
  • [ ] No time estimates: search for ~, Sprint, Phase, hour, day, week — must not appear
  • [ ] Threat Coverage Verification table present at end of file with columns Threat ID | Finding ID | Status
  • [ ] Coverage table status values use emoji prefixes: ✅ Covered (FIND-XX), ✅ Mitigated (FIND-XX), 🔄 Mitigated by Platform — NOT plain text like "Finding", "Mitigated", "Covered"
  • [ ] Coverage table column names are exactly Threat ID | Finding ID | Status — NOT Threat | Finding | Status

After writing 0-assessment.md:

  • [ ] First ## heading is ## Report Files
  • [ ] Count ## headings — exactly 7 with these exact names: Report Files, Executive Summary, Action Summary, Analysis Context & Assumptions, References Consulted, Report Metadata, Classification Reference
  • [ ] Heading contains & not and: search for Analysis Context & Assumptions
  • [ ] Count --- separator lines — at least 5
  • [ ] ### Quick Wins heading exists
  • [ ] ### Priority by Tier and CVSS Score heading exists under Action Summary, BEFORE Quick Wins
  • [ ] Priority table has max 10 rows: Count data rows in Priority by Tier and CVSS Score table — must be ≤ 10
  • [ ] Priority table sort order: All Tier 1 findings come first, then Tier 2, then Tier 3. Within each tier, higher CVSS scores come first. ❌ T2 finding appearing before a T1 finding → FAIL
  • [ ] Priority table Finding hyperlinks: Every Finding cell is a hyperlink [FIND-XX](3-findings.md#find-xx-title-slug). Search for ](3-findings.md# in every row — must be present. ❌ Plain text FIND-XX without link → FAIL
  • [ ] Priority table anchor resolution: For each hyperlink, verify the anchor slug matches the actual ### FIND-XX: heading in 3-findings.md AS WRITTEN. Compute the anchor from the heading text (lowercase, spaces to hyphens, strip special chars). ❌ If any heading contains status tags like [STILL PRESENT] or [NEW], that is a FAIL — status tags must NOT appear in headings (see Phase 2 check). Anchors should be computed from clean, tag-free heading text.
  • [ ] Action Summary tier hyperlinks: Tier 1, Tier 2, Tier 3 cells in the Action Summary table are hyperlinks to 3-findings.md#tier-N anchors
  • [ ] ### Needs Verification heading exists
  • [ ] ### Finding Overrides heading exists
  • [ ] Action Summary has exactly 4 data rows: Tier 1, Tier 2, Tier 3, Total. Search for | Mitigated | or | Platform | or | Fixed | in the Action Summary table — FAIL if found. These are NOT separate tiers.
  • [ ] Git Commit includes date: The | Git Commit | row must contain both the SHA and the commit date (e.g., f49298ff (2026-03-04)). If only the hash is shown without date → FAIL.
  • [ ] Baseline/Target Commits include dates (incremental mode): | Baseline Commit | and | Target Commit | rows must each include a date alongside the SHA.
  • [ ] ### Security Standards and ### Component Documentation headings exist (two Reference subsections)
  • [ ] | Model | row exists in Report Metadata table
  • [ ] | Analysis Started | row exists in Report Metadata table
  • [ ] | Analysis Completed | row exists in Report Metadata table
  • [ ] | Duration | row exists in Report Metadata table
  • [ ] Metadata values wrapped in backticks: check for ` in metadata value cells
  • [ ] Report Files table first row: 0-assessment.md is the FIRST data row (not 0.1-architecture.md)
  • [ ] Report Files completeness: Every generated .md and .mmd file in the output folder has a corresponding row in the Report Files table (threat-inventory.json is intentionally excluded)
  • [ ] Report Files conditional rows: 1.2-threatmodel-summary.mmd and incremental-comparison.html rows present ONLY if those files were actually generated
  • [ ] Note on threat counts blockquote: Executive Summary contains > **Note on threat counts:** paragraph
  • [ ] Boundary count: Boundary count in Executive Summary matches actual Trust Boundary Table row count in 1-threatmodel.md
  • [ ] Action Summary tier priorities: Tier 1 = 🔴 Critical Risk, Tier 2 = 🟠 Elevated Risk, Tier 3 = 🟡 Moderate Risk. These are FIXED — never modified based on counts.
  • [ ] Risk Rating heading has NO emojis: ### Risk Rating: Elevated not ### Risk Rating: 🟠 Elevated

After writing 0.1-architecture.md:

  • [ ] Count sequenceDiagram occurrences — at least 3
  • [ ] First 3 sequence diagrams have participant lines and ->> message arrows (not empty diagram blocks)
  • [ ] Key Components table row count matches Component Diagram node count
  • [ ] Every Key Components table row uses PascalCase name (not kebab-case my-component or snake_case my_component)
  • [ ] Every Key Components Type cell is one of: Process, Data Store, External Service, External Interactor — no ad-hoc types like Role, Function
  • [ ] Technology Stack table has all 5 rows filled: Languages, Frameworks, Data Stores, Infrastructure, Security
  • [ ] ## Security Infrastructure Inventory section exists (not missing)
  • [ ] ## Repository Structure section exists (not missing)

After writing 1.1-threatmodel.mmd:

  • [ ] Line 1 starts with %%{init:
  • [ ] Contains classDef process, classDef external, classDef datastore
  • [ ] No Chakra UI colors (#4299E1, #48BB78, #E53E3E)
  • [ ] linkStyle default stroke:#666666,stroke-width:2px present
  • [ ] DFD uses flowchart LR (NOT flowchart TB) — search for flowchart and verify direction is LR
  • [ ] Incremental DFD styling (incremental mode only): If new components exist, verify classDef newComponent fill:#d4edda,stroke:#28a745 is present AND new component nodes use :::newComponent (NOT :::process). If removed components exist, verify classDef removedComponent with gray dashed styling. ❌ newComponent fill:#6baed6 (same blue as process) → FAIL (visually invisible).

After writing 2-stride-analysis.md:

  • [ ] ## Summary appears BEFORE any ## ComponentName section (check line numbers)
  • [ ] Summary table has columns: | Component | Link | S | T | R | I | D | E | A | Total | T1 | T2 | T3 | Risk | — search for | S | T | R | I | D | E | A | to verify
  • [ ] Summary table S/T/R/I/D/E/A columns contain numeric values (0, 1, 2, 3...), NOT all identical 1s for every component
  • [ ] Every component has #### Tier 1, #### Tier 2, #### Tier 3 sub-headings
  • [ ] No &, /, (, ), : in ## headings
  • [ ] No status tags in headings (ANY file): Search ALL .md files for ^##.+\[Existing\], ^##.+\[Fixed\], ^##.+\[Partial\], ^##.+\[New\], ^##.+\[Removed\], and same for ### headings. Also check old-style: ^##.+\[STILL, ^##.+\[NEW, ^###.+\[STILL, ^###.+\[NEW CODE. ❌ Tags in headings break anchor links and pollute ToC. Status must be on first line of section body as a blockquote (> **[Tag]**), not in the heading.
  • [ ] CRITICAL — A = Abuse, NEVER Authorization: Search for | Authorization | in the file. If ANY match is a STRIDE category label (not inside a threat description sentence) → FIX IMMEDIATELY by replacing with | Abuse |. The "A" in STRIDE-A stands for "Abuse" (business logic abuse, workflow manipulation, feature misuse). This is the single most common error observed.
  • [ ] N/A entries not counted: If any component has N/A — {justification} for a STRIDE category, verify that category shows 0 (not 1) in the Summary table
  • [ ] STRIDE Status values: Every threat row's Status column uses exactly one of: Open, Mitigated, Platform. No Partial, N/A, Accepted, or ad-hoc values.
  • [ ] Platform ratio: Count threats with Platform status vs total threats. If >20% (standalone) or >35% (K8s operator) → re-examine each Platform entry.
  • [ ] STRIDE column arithmetic: For every Summary table row, verify S+T+R+I+D+E+A = Total AND T1+T2+T3 = Total
  • [ ] Full category names in threat tables: Category column uses full names (Spoofing, Tampering, Information Disclosure, Denial of Service, Elevation of Privilege, Abuse) — NOT abbreviations (S, T, DoS, EoP)
  • [ ] N/A table present: Every component section has a | Category | Justification | table listing STRIDE categories with no threats — NOT prose/bullet-point format
  • [ ] Link column is separate: Summary table 2nd column is Link with [Link](#anchor) values — component names do NOT contain embedded hyperlinks
  • [ ] Exploitability Tiers 4th column: The tier definition table must have 4th column named Assignment Rule (NOT Example, Description, Criteria)

After writing incremental-comparison.html (incremental mode only):

  • [ ] HTML contains Trust Boundaries or Boundaries in the metrics bar — search for the text "Boundaries"
  • [ ] STRIDE heatmap has 13 columns: Component, S, T, R, I, D, E, A, Total, divider, T1, T2, T3 — search for T1 and T2 and T3 in the HTML
  • [ ] Fixed/New/Previously Unidentified status information appears ONLY in colored status cards, NOT also as small inline badges in the metrics bar
  • [ ] No | Authorization | as a STRIDE category label in the heatmap — search for "Authorization" in heatmap rows
  • [ ] HTML counts match markdown counts: The Total threats in the HTML heatmap must equal the Totals row from 2-stride-analysis.md. If they differ, regenerate the HTML heatmap from the STRIDE summary data. T1+T2+T3 totals in HTML must also match.
  • [ ] Comparison cards present: HTML contains comparison-cards div with 3 cards: baseline (hash + date + rating), target (hash + date + rating), trend (direction + duration)
  • [ ] Commit dates from git log: Baseline and target dates in comparison cards must match actual commit dates (NOT today's date, NOT analysis run date)
  • [ ] Code Changes box: 5th metrics box shows commit count and PR count (NOT "Time Between")
  • [ ] No Time Between box: Search for "Time Between" — must NOT appear in metrics bar
  • [ ] Status cards are concise: Each status card's card-items div must contain only a short summary sentence. ❌ Threat IDs (T06.S, T02.E), finding IDs (FIND-14), or component names listed in cards → FAIL. Search for T\d+\. and FIND-\d+ inside card-items divs. Detailed item breakdowns belong in the Threat/Finding Status Breakdown section, not in the summary cards.

After writing any incremental report file (incremental mode — inline check):

  • [ ] Simplified display tags only: Search ALL .md files for old-style tags: [STILL PRESENT], [NEW CODE], [NEW IN MODIFIED], [PREVIOUSLY UNIDENTIFIED], [PARTIALLY MITIGATED], [REMOVED WITH COMPONENT], [MODIFIED]. ❌ Any match → FAIL. Replace with simplified tags: [Existing], [Fixed], [Partial], [New], [Removed].
  • [ ] Valid display tags: Every finding/threat annotation uses exactly one of the 5 simplified tags: [Existing], [Fixed], [Partial], [New], [Removed]. Tags must appear as blockquote on first line of body: > **[Tag]**.
  • [ ] Component status simplified: Component status column uses only: Unchanged, Modified, New, Removed. ❌ Restructured → FAIL (use Modified instead).
  • [ ] Change Summary tables use simplified tags: Threat Status table has 4 rows (Existing/Fixed/New/Removed). Finding Status table has 5 rows (Existing/Fixed/Partial/New/Removed). ❌ Old-style rows like Still Present, New (Code), Partially Mitigated → FAIL.

After writing threat-inventory.json (inline check):

  • [ ] JSON threat count matches STRIDE file: Count unique threat IDs in 2-stride-analysis.md (grep ^\| T\d+\.). This count MUST equal threats array length in the JSON. If STRIDE has MORE threats than JSON → threats were dropped during serialization. Rebuild the JSON.
  • [ ] JSON metrics internally consistent: metrics.total_threats must equal threats array length. metrics.total_findings must equal findings array length.

After writing 0-assessment.md (count validation):

  • [ ] Element count in Executive Summary matches actual Element Table row count (re-read 1-threatmodel.md if needed)
  • [ ] Finding count matches actual ### FIND- heading count in 3-findings.md
  • [ ] Threat count matches Total from summary table in 2-stride-analysis.md

Phase 0 — Common Deviation Scan

These are the most frequently observed deviations across all previous runs. After output is generated, scan every output file for these specific patterns. Each check has a WRONG pattern to search for and a CORRECT expected pattern.

How to use: For each check, grep/scan the output files for the WRONG pattern. If found → FAIL. Then verify the CORRECT pattern is present. This phase catches recurring mistakes that the generating model tends to make despite instructions.

0.1 Structural Deviations

  • [ ] Findings organized by severity instead of tier — Search for ## Critical Findings, ## Important Findings, ## High Findings. These must NOT exist. ❌ ## Critical Findings → ✅ ## Tier 1 — Direct Exposure (No Prerequisites)
  • [ ] Flat STRIDE tables (no tier sub-sections) — Each component in 2-stride-analysis.md must have #### Tier 1, #### Tier 2, #### Tier 3 sub-headings. ❌ Single flat table per component → ✅ Three separate tier sub-sections
  • [ ] Missing Exploitability Tier or Remediation Effort on findings — Every ### FIND- block in 3-findings.md must contain both Exploitability Tier and Remediation Effort rows. ❌ Missing either field → ✅ Both MANDATORY
  • [ ] STRIDE summary missing tier columns — Summary table in 2-stride-analysis.md must include T1, T2, T3 columns. ❌ Only S/T/R/I/D/E/A/Total → ✅ Must also have T1/T2/T3/Risk columns
  • [ ] STRIDE Summary at bottom — Search for the line number of ## Summary vs first ## Component. ❌ Summary after components → ✅ Summary BEFORE all component sections, immediately after ## Exploitability Tiers
  • [ ] Exploitability Tiers table columns — The tier definition table in 2-stride-analysis.md must have exactly these 4 columns: Tier | Label | Prerequisites | Assignment Rule. ❌ Example, Description, Criteria as 4th column → ✅ Assignment Rule only. The Assignment Rule cells must contain the rigid rule text, NOT deployment-specific examples.

0.2 File Format Deviations

  • [ ] .md wrapped in code fences — Check if any .md file starts with ```markdown or ````markdown. ❌ ```markdown\n# Title → ✅ # Title on line 1
  • [ ] .mmd wrapped in code fences — Check if .mmd file starts with ```plaintext or ```mermaid. ❌ ```mermaid\n%%{init: → ✅ %%{init: on line 1
  • [ ] Leaked skill directives in output — Search ALL .md files for ⛔, RIGID TIER, Do NOT use subjective, MANDATORY, CRITICAL —, decision procedure. These are internal skill instructions that must NOT appear in report output. ❌ Any match → ✅ Zero matches. Remove any leaked directive lines.
  • [ ] Nested duplicate output folder — Check if the output folder contains a subfolder with the same name (e.g., threat-model-20260307-081613/threat-model-20260307-081613/). ❌ Subfolder exists → ✅ Delete the nested duplicate. The output folder should contain only files, no subfolders.
  • [ ] STRIDE-A "Authorization" instead of "Abuse" — Search 2-stride-analysis.md for | Authorization | or **Authorization** used as a STRIDE category name. The A in STRIDE-A is ALWAYS "Abuse", never "Authorization". ❌ Any match where Authorization is used as a STRIDE category → ✅ Replace with "Abuse". Note: do NOT replace "Authorization" when it appears inside threat descriptions (e.g., "Authorization header", "lacks authorization checks").

0.3 Assessment Section Deviations

  • [ ] Wrong section name for Action Summary — Search for Priority Remediation Roadmap, Top Recommendations, Key Recommendations, Risk Profile. ❌ Any of those names → ✅ ## Action Summary only
  • [ ] Separate recommendations section — Search for ### Key Recommendations or ### Top Recommendations as standalone sections. ❌ Separate section → ✅ Action Summary IS the recommendations
  • [ ] Missing Quick Wins subsection — Search for ### Quick Wins under Action Summary. ❌ Missing → ✅ Present (with note if no low-effort T1 findings)
  • [ ] Missing threat count context — Search for > **Note on threat counts:** blockquote in Executive Summary. ❌ Missing → ✅ Present
  • [ ] Missing Analysis Context & Assumptions — Search for ## Analysis Context & Assumptions. ❌ Missing → ✅ Present with ### Needs Verification and ### Finding Overrides sub-sections
  • [ ] Missing mandatory assessment sections — Verify ALL 7 exist: Report Files, Executive Summary, Action Summary, Analysis Context & Assumptions, References Consulted, Report Metadata, Classification Reference. ❌ Any missing → ✅ All 7 present

0.4 References & Metadata Deviations

  • [ ] References Consulted as flat table — Search for | Reference | Usage | pattern. ❌ Two-column flat table → ✅ Two subsections: ### Security Standards with | Standard | URL | How Used | and ### Component Documentation with | Component | Documentation URL | Relevant Section |
  • [ ] References missing URLs — Every row in References Consulted tables must have a full https:// URL. ❌ Missing URL column or empty URLs → ✅ Full URLs in every row
  • [ ] Report Metadata missing Model — Search for | **Model** | or | Model | row. ❌ Missing → ✅ Present with actual model name
  • [ ] Report Metadata missing timestamps — Search for Analysis Started, Analysis Completed, Duration rows. ❌ Any missing → ✅ All three present with computed values

0.5 Finding Quality Deviations

  • [ ] CVSS score without vector or missing prefix — Grep each finding's CVSS field. The value MUST match pattern: \d+\.\d+ \(CVSS:4\.0/AV:. Specifically check for the CVSS:4.0/ prefix — the most common deviation is outputting the vector without this prefix (bare AV:N/AC:L/...). ❌ 9.3 (score only) → ❌ 9.3 (AV:N/AC:L/...) (no prefix) → ✅ 9.3 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N)
  • [ ] CWE without hyperlink — Grep for CWE-\d+ without preceding [. ❌ CWE-78: OS Command Injection → ✅ [CWE-78](https://cwe.mitre.org/data/definitions/78.html): OS Command Injection
  • [ ] OWASP :2021 suffix — Grep for :2021. ❌ A01:2021 → ✅ A01:2025
  • [ ] Related Threats as plain text — Grep Related Threats rows for pattern without ](. ❌ T-02, T-17, T-23 → ✅ [T02.S](2-stride-analysis.md#component-name), [T17.I](2-stride-analysis.md#other-component)
  • [ ] Finding IDs out of order — Check that FIND-NN IDs are sequential: FIND-01, FIND-02, FIND-03... ❌ FIND-06 appearing before FIND-04 → ✅ Sequential numbering top-to-bottom
  • [ ] CVSS AV:L or PR:H with Tier 1 — Grep every Tier 1 finding's CVSS vector for AV:L or PR:H. ❌ Tier 1 with local-only access → ✅ Downgrade to T2/T3
  • [ ] Localhost-only or admin-only finding in Tier 1 — Check deployment context: air-gapped, localhost, single-admin services should NOT be Tier 1. ❌ Tier 1 for admin-only → ✅ T2/T3
  • [ ] Time estimates in output — Grep for ~1 hour, Sprint, Phase 1, (hours), (days), (weeks), Immediate. ❌ Any scheduling language → ✅ Only Low/Medium/High effort labels
  • [ ] "Accepted Risk" in Coverage table — Grep 3-findings.md for Accepted Risk. ❌ Any match → FAIL. The tool does NOT have authority to accept risks. Every Open threat MUST have a finding. Replace all ⚠️ Accepted Risk with ✅ Covered and create corresponding findings.

0.6 Diagram Deviations

  • [ ] Wrong color palette — Grep all #[0-9a-fA-F]{6} in .mmd files and Mermaid blocks. ❌ #4299E1, #48BB78, #E53E3E, #2B6CB0, #2D3748, #2F855A, #C53030 (Chakra UI) → ✅ Only allowed: #6baed6, #2171b5, #fdae61, #d94701, #74c476, #238b45, #e31a1c, #666666, #ffffff, #000000
  • [ ] Custom themeVariables colors — Search