Threat Modelingのロゴ

Threat Modeling

コミュニティ
arozumenko
threat-modeling

Use when deriving a data-flow diagram and STRIDE threats from code, with a citation per element and mitigations recorded as claims a fresh reviewer can confirm or refute; provides the threat-model.json shape cite.mjs check validates.

概要

公開者arozumenko
リポジトリsdlc-skills
スキル名threat-modeling
スター
26
フォーク
10
同梱ファイル
4
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    arozumenkoがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Threat Modeling」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/arozumenko/sdlc-skills/tree/main/bundles/security-testing/skills/threat-modeling
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/arozumenko/sdlc-skills.git /tmp/sdlc-skills
mkdir -p .claude/skills
cp -r /tmp/sdlc-skills/bundles/security-testing/skills/threat-modeling .claude/skills/threat-modeling
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでThreat Modelingを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にThreat Modelingを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Threat Modelingは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Threat modeling

You write a code-derived DFD and STRIDE threats with citations; cite.mjs check <st>/threat-model.json re-reads every citation against the bytes at head and validates the disposition grammar — everything else is your judgement. Three rules hold everywhere:

  1. An element or a mitigation exists only because it is cited. Same citation shape as a finding's (references/dfd-elements.md), same FAILED <locus>.<i> <why> vocabulary.
  2. A mitigation is a claim, not a fact (references/mitigations-as-claims.md) — you never grade your own claim; a fresh security-reviewer's mitigation-review does, and even that never rewrites the model.
  3. You assign every element's, threat's and mitigation's own id (E-nnn/T-nnn/M-nnn) yourself; never write state, oid, snippet_redacted or check_stamp — check stamps those, and refuses a file carrying them from your hand (D10), the same rule as findings. id anywhere but element/threat/mitigation position is refused there too.

The shape

{ head?, elements: [{id, name, kind, citations}], threats: [{id, element_id, stride, title, mitigations, disposition}] }.

json
{
  "elements": [
    { "id": "E-001", "name": "HTTP handler", "kind": "process",
      "citations": [{ "path": "src/app.js", "lines": [1, 3], "snippet": "…" }] },
    { "id": "E-002", "name": "Orders table", "kind": "datastore",
      "citations": [{ "path": "src/orders.js", "lines": [40, 45], "snippet": "…" }] }
  ],
  "threats": [
    { "id": "T-001", "element_id": "E-002", "stride": "T",
      "title": "Order total tampered before it is charged",
      "mitigations": [
        { "id": "M-001", "claim": "createOrder recomputes the total from line items (lines 40-52)",
          "citations": [{ "path": "src/orders.js", "lines": [40, 52], "snippet": "…" }] }
      ],
      "disposition": "mitigated(M-001)" }
  ]
}
  • kind ∈ external | boundary | process | datastore | flow (references/dfd-elements.md — which letters apply to which kind is in references/stride.md).
  • stride ∈ S | T | R | I | D | E, one letter per threat.
  • disposition ∈ open | accepted(R-nnnn) | mitigated(M-nnn) | planned(TC-nnn) | out-of-scope(<reason>) — the full grammar, what each ref must name and the one-run sequence are in references/dispositions.md.
  • ids (E-nnn, T-nnn, M-nnn) are unique across the whole model, not just within their array.

Procedure

  1. Read engagement.md's scope_paths — what you may cite.
  2. Enumerate entry points — routers, handlers, consumers, schedulers.
  3. Elements, one citation each — external/process at entry points, boundary at trust changes, datastore/flow at sinks and moves (references/dfd-elements.md § Where to start).
  4. STRIDE per element — only the letters references/stride.md's table marks for that kind; one threat per effect.
  5. Mitigations as cited claims — a sentence a reviewer can confirm or refute from the citation alone (references/mitigations-as-claims.md).
  6. Dispositions — the one you can justify now; mitigated(M-nnn) only when the mitigation is already in the model under that threat.
  7. cite.mjs check <st>/threat-model.json.
  8. Fix TM-INVALID — the locus and the missing relationship name what to correct; edit threat-model.json and check again.
  9. Candidate passive cases — when a threat is worth an admitted test, draft it (never admit it yourself — that is the lead's cases.mjs admit) at .agents/security-testing/cases/TC-NNN_<slug>.md, id: TC-NNN, a # heading as its title. A planned(TC-nnn) disposition only validates once the lead has admitted it.

Result lines you will see

  • FAILED <locus>.<i> <why> — why ∈ bad-shape, path-not-in-scope, range-over-40, not-in-tree, snippet-not-found.
  • TM-INVALID <locus>: <why> — a structural or disposition defect, one per line, in document order (references/dispositions.md).
  • MODEL elements=<n> threats=<n> open=<n> then CHECK verified=<n> failed=<n> — printed on every run; exit 4 on any FAILED/TM-INVALID, else 0.
  • --md after those: the elements/threats/mitigations tables, then TABLES sha256=<hex>.

Your return line

cite.mjs check exits 0, no TM-INVALID lines ⇒ MODEL_WRITTEN elements=<n> threats=<n> open=<n> (the counts from the MODEL line). Anything else ⇒ the TM-INVALID lines verbatim — fix what they name and check again before you reply if you can.

Commands

node scripts/cite.mjs --help (from secure-code-review/scripts/, the only script this skill uses):

usage: cite <command> [options]

commands:
  init
  show
  check
  redact

show <path> [start end] [--at <oid>] for reading; check <threat-model.json> [--md [--no-snippets]] for validating; see secure-code-review/SKILL.md for init and redact. Every string printed or written is redacted (D9); the file is rewritten with check_stamp and, per citation, state, oid, snippet_redacted — never edit a stamped file by hand (REFUSED agent-written key <key>); fix the unstamped source and let the lead re-run check.

References

references/dfd-elements.md (the five kinds, the citation), references/stride.md (the six letters, which apply to which kind), references/mitigations-as-claims.md (the claim shape, the mitigation-review contract), references/dispositions.md (the five-value grammar, the failure format, the one-run sequence).

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Threat Modeling」では何ができますか?

Use when deriving a data-flow diagram and STRIDE threats from code, with a citation per element and mitigations recorded as claims a fresh reviewer can confirm or refute; provides the threat-model.json shape cite.mjs check validates.

TypingMindでThreat Modelingを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Threat Modelingはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにThreat Modelingをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/arozumenko/sdlc-skills/tree/main/bundles/security-testing/skills/threat-modelingを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Threat Modelingを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Threat Modelingで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもThreat Modelingを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Threat Modeling」は無料ですか?

はい。arozumenkoがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇