К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot официальный · Anthropic

threat-model · anthropics — скилл для Claude Code: что делает и как установить

Собирает модель угроз для кодовой базы в трёх режимах и записывает её в THREAT_MODEL.md. Нужен для оценки поверхности атаки до поиска уязвимостей.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add anthropics/defending-code-reference-harness --skill threat-model -a claude-code
Открыть на GitHub

Что делает threat-model

Скилл анализирует кодовую базу и формирует модель угроз: что может пойти не так, кто атакует систему и какие меры нужны. Режим interview проводит владельца приложения через четыре вопроса. bootstrap строит черновик по коду, истории Git и прошлым уязвимостям, включая CVE и отчёты пентестов. bootstrap-then-interview объединяет оба подхода.

Результат всех режимов записывается в THREAT_MODEL.md по общей схеме. Скилл использует чтение файлов, поиск по коду, git, gh api, вопросы пользователю и отдельные задачи для исследования. Для режима bootstrap нужен локальный checkout, а при передаче URL с уязвимостями допускаются только публичные базы рекомендаций.

Анализ остаётся статическим: скилл читает исходники, историю и отчёты, но не собирает, не запускает и не модифицирует целевой проект. Это повод проверить границы задачи, если нужна проверка угрозы эксплуатацией: такой сценарий сюда не входит.

Какие задачи решает

  • составить модель угроз для кодовой базы
  • нанести поверхность атаки приложения
  • связать прошлые CVE с классами угроз
  • провести интервью с владельцем системы
  • сохранить модель в THREAT_MODEL.md

Примеры запросов агенту

  • `/threat-model bootstrap ./app` и учти историю Git и прошлые отчёты об уязвимостях
  • `/threat-model interview ./app` и проведи меня через вопросы о системе
  • `/threat-model bootstrap-then-interview ./app --design-doc design.md`

Как установить threat-model

1Через Skills CLI (Vercel)

npx skills add anthropics/defending-code-reference-harness --skill threat-model -a claude-code

2Вручную: положить файлы

~/.claude/skills/threat-model/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/threat-model/

Из того же набора6

Весь набор →
quickstart официальный anthropics Вводит в репозиторий по безопасности кода и ведёт от threat model до первой проверки canary-цели. Подходит для старта или точечных вопросов по документации. Claude Code CX Codex Cursor +1 1 100установок customize официальный anthropics Скилл для переноса уязвимостей-pipeline с C/C++ на другие языки, домены и типы целей. Превращает опциональный демо в шаблон: замени детектор, промпты и целевую среду — и pipeline начнёт искать то, что нужно тебе. Claude Code CX Codex Cursor +1 1 100установок patch официальный anthropics Скилл готовит патчи для подтверждённых уязвимостей без изменения кода в репозитории. Claude Code CX Codex Cursor +1 1 100установок triage официальный anthropics Скилл проверяет находки сканеров, убирает дубли и ранжирует уязвимости по эксплуатационной сложности. Нужен для разбора файла или каталога с результатами. Claude Code CX Codex Cursor +1 1 100установок vuln-scan официальный anthropics Статический сканер уязвимостей в исходном коде. Читает директорию, запускает параллельные субагенты для проверки разных областей и записывает находки в JSON и markdown для дальнейшего разбора. Claude Code CX Codex Cursor +1 1 100установок

Другие версии threat-model

Похожие

skill-inspector NVIDIA Проверяет скилл перед установкой на предмет уязвимостей, избыточных прав и скрытого поведения. Использует статический анализ NVIDIA SkillSpector и семантическую проверку агента. Claude Code CX Codex Cursor +1 900установок spring-boot-engineer https://github.com/Jeffallan Разворачивает архитектуру Spring Boot 3.x, контроллеры, репозитории Spring Data JPA и правила Spring Security 6. Пригодится при сборке REST API, реактивных сервисов и микросервисов на Java. Claude Code CX Codex Cursor +1 8 400установок case-review zhaoxuya520 Проверяет готовность пакета обратной разработки к передаче: отслеживает связи между доказательствами, находками и путями атаки, верифицирует хеши артефактов и генерирует отчёт без изменения кейса. Claude Code CX Codex Cursor +1 926установок block-no-verify-hook cskwork Скилл добавляет хук PreToolUse, который блокирует обход git-проверок через флаги вроде --no-verify. Пригодится проектам с обязательными pre-commit-проверками. Claude Code CX Codex Cursor 6 500установок ctf-reverse ljagiello Справочник по реверс-инжинирингу для CTF: помогает агенту разбирать скомпилированные бинарники, распаковывать протекторы и анализировать виртуальные машины. Claude Code CX Codex Cursor +1 10 100установок gke-workload-identity официальный google Диагностирует ошибки аутентификации Pod в Google Cloud через Workload Identity Federation for GKE. Подходит для проверки KSA, IAM и GKE metadata server. Claude Code Gemini CLI CX Codex 2 000установок git-guardrails-claude-code Matt Pocock Скилл ставит хук Claude Code, который останавливает опасные Git-команды до их запуска. Нужен, если агент не должен делать push или удалять изменения. Claude Code 499 069установок ponytail-review DietrichGebert Скилл проверяет изменения глубже обычного diff: читает связанный код, ищет ошибки, риски, проблемы нагрузки и недостающие тесты. Пригодится для ревью PR и коммитов. Claude Code CX Codex Cursor +1 56 300установок

Вопросы о threat-model

Как установить `threat-model` в Claude Code?

Выполните npx skills add anthropics/defending-code-reference-harness --skill threat-model -a claude-code, затем повторите эту же команду: npx skills add anthropics/defending-code-reference-harness --skill threat-model -a claude-code. Файл скилла находится по пути ~/.claude/skills/threat-model/SKILL.md.

Что делает `threat-model`?

Скилл строит модель угроз для целевой кодовой базы в режимах interview, bootstrap или bootstrap-then-interview и записывает результат в THREAT_MODEL.md.

Нужен ли локальный проект для работы скилла?

Для режима bootstrap нужен локальный checkout, который можно прочитать. В режиме interview скилл собирает сведения у владельца приложения через вопросы.

Исходный текст

SKILL.md · Apache-2.0
---
name: threat-model
description: >-
  Build a threat model for a target codebase. Three modes: "interview" walks an
  application owner through the four-question framework and produces a threat
  model from their answers; "bootstrap" derives a threat model from the code
  plus past vulnerabilities (CVEs, git history, pentest reports) when no owner
  is available; "bootstrap-then-interview" chains the two when both owner and
  codebase are present. All write THREAT_MODEL.md in a shared schema. Use
  when asked to "threat
  model", "build a threat model", "map the attack surface", or "what should we
  be worried about in this codebase".
argument-hint: "[bootstrap-then-interview|bootstrap|interview] <target-dir> [--vulns <file>] [--design-doc <file>] [--seed <THREAT_MODEL.md>] [--fresh]"
allowed-tools:
  - Read
  - Glob
  - Bash(python3 .claude/skills/_lib/checkpoint.py:*)
  - Grep
  - Write
  - Bash(git:*)
  - Bash(gh api:*)
  - Bash(find:*)
  - Bash(ls:*)
  - Bash(cat:*)
  - AskUserQuestion
  - Task
---

# threat-model

A threat model answers **"what could go wrong with this system, who would do
it, and what should we do about it?"** independently of whether any specific
bug has been found yet. It is the map; vulnerability discovery is the metal
detector. A good threat model tells the pipeline where to look and tells triage
which findings matter.

**Litmus test:** If patching one line of code makes an entry disappear, it was
a vulnerability, not a threat. A threat ("attacker achieves RCE via untrusted
media parsing") still stands after every known bug is fixed; a vulnerability
("`dr_wav.h:412` doesn't bounds-check `chunk_size`") does not. This skill
produces threats. Vulnerabilities appear only as **evidence** that raises a
threat's likelihood score.

**Invocation:** `/threat-model [bootstrap-then-interview|bootstrap|interview] <target-dir> [flags]`

---

## Step 0 — Safety preamble (always runs first)

This skill performs **static analysis only**. It reads source, git history,
and any vulnerability reports the user supplies, and writes a single output
file (`<target-dir>/THREAT_MODEL.md`). It does not build, execute, fuzz, or
modify the target, and does not make network requests against the target's
infrastructure.

Before proceeding, confirm and state in your first response:

1. The target directory exists and is a local checkout you can read.
2. You will not execute any code from the target directory.
3. If `--vulns` points at a URL or you are asked to "fetch CVEs", you will
   query only public advisory databases (NVD, GitHub Security Advisories, the
   project's own issue tracker) and never the target's live deployment.

If the user asks you to validate a threat by running an exploit, decline and
point them at the `vuln-pipeline` (README Step 2) instead.

---

## Step 1 — Route to a mode

Parse `$ARGUMENTS`:

| First token | Route to |
|---|---|
| `interview` | Read `interview.md` in this directory and follow it. |
| `bootstrap` | Read `bootstrap.md` in this directory and follow it. |
| `bootstrap-then-interview` | Bootstrap first, then interview seeded from the draft. See below. |
| anything else, or empty | Ask the user: **"Is someone who owns or built this system available to answer questions in this session?"** Yes and the codebase is checked out → recommend `bootstrap-then-interview`. Yes but no codebase → `interview.md`. No → `bootstrap.md`. |

All modes write the same artifact (`THREAT_MODEL.md`, schema in `schema.md`)
so downstream consumers (pipeline `recon`/`judge`, verifier agents) do not need
to know which mode produced it.

| | `interview` | `bootstrap` |
|---|---|---|
| **Needs** | An application owner present in the session | A local checkout; optionally past vulns |
| **Method** | Four-question framework: conversational walk through *what are we working on → what can go wrong → what are we going to do about it → did we do a good job* | Five stages: parallel research swarm → synthesize sections 1-3 + vuln table → generalize vulns into threat classes → STRIDE gap-fill → emit |
| **Best for** | New systems, design reviews, systems where the risk lives in business logic the code doesn't show | Inherited systems, third-party code, OSS dependencies, anything with a CVE history |
| **Provenance tag** | `interview` | `bootstrap` |

**Context durability.** Interview mode is multi-turn; tool results from early
reads may be evicted before you need them. To stay resilient:

- Do **not** read `interview.md` or `bootstrap.md` in full up front. Read the
  mode file (or the relevant section of it) **at the point you need it**, one
  question or stage at a time.
- If a re-read via the Read tool is refused as "file unchanged", the prior
  result was evicted; reload with `cat <path>` via Bash instead.

**Interview backbone** (so you can proceed even if `interview.md` is
unavailable mid-session):

| Q | Question | Fills schema sections |
|---|---|---|
| Q1 | What are we working on? | section 1 context, section 2 assets, section 3 entry points |
| Q2 | What can go wrong? | section 4 threat rows (id, threat, actor, surface, asset) |
| Q3 | What are we going to do about it? | section 4 impact/likelihood/status/controls; section 5 deprioritized; section 8 recommended mitigations |
| Q4 | Did we do a good job? | validate ranking, coverage check, section 6 open questions |

### `bootstrap-then-interview` mode

When the owner is available *and* the codebase is checked out, this is the
recommended path: the owner's time goes to refining a code-grounded draft
instead of describing the system from scratch.

1. Tell the owner: "I'll read the code first and come back with a draft
   (about 5-10 min), then we'll walk it together. Want that, or would you
   rather start cold?" Only proceed if they opt in; otherwise fall back to
   `interview.md`.
2. Read `bootstrap.md` and follow it end-to-end. Write
   `<target-dir>/THREAT_MODEL.md`.
3. Immediately continue into interview mode: read `interview.md` and follow
   it with `--seed <target-dir>/THREAT_MODEL.md` in effect. The section 6 open
   questions from bootstrap become your Q1-Q4 prompts; the owner confirms,
   corrects, and adds rather than starting from nothing.
4. Overwrite `<target-dir>/THREAT_MODEL.md` with the refined model. Set
   provenance `mode: bootstrap-then-interview`.

The same flow is available manually: run `bootstrap` first, then
`interview --seed <THREAT_MODEL.md>` in a later session.

---

## Step 2 — Shared output contract

All modes MUST emit `<target-dir>/THREAT_MODEL.md` conforming to `schema.md`
in this directory. **Read `schema.md` immediately before you write the file**,
not at routing time; in interview mode the gap between routing and emit can be
many turns, and an early read will be evicted before it's used.

After writing the file, print to the user:

1. The path to `THREAT_MODEL.md`.
2. The top 5 threats by likelihood × impact (id, one-line description, L×I).
3. For `bootstrap`: any open questions the code could not answer (these seed a
   later `interview` pass).
4. For `interview`: any owner statements that could not be verified in code
   (these seed follow-up code review).

---

## References

- [docs/security.md](../../../docs/security.md) and
  [docs/prompting.md](../../../docs/prompting.md) for the engagement-context
  and authorization framing this skill inherits.

© anthropics · Apache-2.0 · anthropics/defending-code-reference-harness

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой