/quality-gates:threat-modelfrom quality-gates
Maps attack surfaces and entry points before shipping features, infrastructure changes, or launches. Guides threat modeling, attack surface review, and penetration test scoping.
Ships in quality-gates. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Find where someone could break in before it ships, decide what to do about each way in, and prove it with tests. Three jobs: map the ways in, plan before launch, test like an attacker. When planning, follow the rules. When asked for a review or a launch check, run Review.
Related: security-code-audit checks a diff line by line; login-and-access covers sign-in and permissions; personal-data covers what data is at stake and breach duties. This skill decides where to look; those skills check the code.
Start from what is worth stealing or breaking, then who wants it, then how they get in.
Assets. Personal and payment data, accounts (especially admin), secrets and keys, money flows, the ability to send email or SMS as you, compute and cloud bills, the brand and domain.
Attackers. Anonymous internet user, signed-in user going after other users, a malicious or careless insider, a compromised vendor or dependency, a bot farm, and untrusted text reaching an AI agent (prompt injection).
Entry points. List every one, including the forgotten ones:
.git or backup files on the web server.pull_request_target, untrusted input in run:), secrets in workflows, third-party actions not pinned to a commit SHA, deploy keys.Trust boundaries. Draw where data crosses from less trusted to more trusted: browser to server, server to database, your service to a vendor, user text to a model with tools. Every crossing needs a check.
Threats per boundary. Walk STRIDE at each crossing:
| Letter | Threat | Typical defence |
|---|---|---|
| S | Spoofing someone | Authentication, signed webhooks |
| T | Tampering with data | Server-side validation, integrity checks |
| R | Denying an action | Audit logs |
| I | Information disclosure | Authorisation, encryption, field selection |
| D | Denial of service, including denial of wallet | Rate limits, quotas, size limits, billing alerts |
| E | Elevation of privilege | Least privilege, deny by default |
Abuse cases. Next to each user story, write the misuse story: "As an attacker I change the orgId in the request to read another company's invoices." Each one becomes a test.
Decide each threat: mitigate (name the control and where it lives), transfer (vendor, insurance), or accept (named owner and reason). Rate likelihood and impact as low, medium or high; fix high and high first. Accepting is the user's decision, not yours.
Keep the threat model next to the code: in the repo's existing security doc or ADRs if there is one. If there is none, ask where it should live before creating a file. Update it whenever an entry point, trust boundary or vendor is added.
Check each item, and mark it done, not needed (with the reason), or open:
X-Content-Type-Options: nosniff, frame-ancestors (or X-Frame-Options), and a Referrer-Policy. CORS lists exact origins.personal-data for breach deadlines), and where the runbook lives./.well-known/security.txt with a contact address and a policy for people who report bugs.Automated, on every change (add only what the repo lacks, and ask before adding a tool or CI step):
npm audit, pip-audit, osv-scanner), secret scanning (gitleaks, GitHub secret scanning with push protection), container and infrastructure scanning (Trivy, Checkov).Manual penetration test before launch, and again after big changes (new auth, payments, a public API, a new tenant model). For high-risk data or customer contracts, use an independent tester. Prepare:
Later, once the basics hold: a bug bounty or a private disclosure programme, and a red-team exercise.
What Claude may run itself:
localhost.## Verdict: READY | FIX BEFORE LAUNCH | BLOCK
Scope: <feature, service or release>
Tools: `<command>` -> <result>
### Entry points
| Entry point | Who can reach it | Trust boundary | Notes |
### Threats
| # | Threat | STRIDE | Entry point | Likelihood | Impact | Decision | Control or owner |
|---|---|---|---|---|---|---|---|
| 1 | Forged Stripe webhook marks order paid | S, T | `POST /webhooks/stripe` | M | H | mitigate | verify signature on raw body (`app/webhooks/stripe.ts:12`) |
### Launch checklist (open items only)
### Missing tests and scans
### Pen test scope (when asked)
### Questions for the user (accepted risks, owners, deadlines)
### Not checked
Use the severity scale from security-code-audit for any concrete vulnerability found along the way, in its finding format.
After the report, offer the follow-up in one AskUserQuestion, listing only skills present in this session: Audit the flagged code (security-code-audit) / Check sign-in and roles (login-and-access) / Map the personal data (personal-data) / Stop. Mark (Recommended) on the one that covers the highest-impact open threat.
.env, key files or dumps. Never sign in to production or test against it.AskUserQuestion, one question per decision (Fix before launch (Recommended) / Accept the risk, with owner and date), without that tool as text.Key decisions in this skill: whether a high-impact threat is real, accepting a risk, launching with an open item, the pen test scope, and a BLOCK verdict.
Before acting on one, get a second opinion: call the Agent tool with model: "opus" (subagent_type Plan, read-only). Give it the decision, each option in one line, the evidence (file:line, measurements, the diff) and the constraints. Ask for a pick, the main risk of that pick, and what would change its mind. Do not send secrets or .env contents.
Advisor: <decision> -> <pick> (<agreed | overruled because ...>).Spend the strong models on judgment and the cheap ones on volume. When this skill spawns subagents with the Agent tool, set model by role:
| Role | Model | Use for |
|---|---|---|
| Think | fable (Fable 5.2), or opus when limits are tight | Plan, decompose, pick an approach. One call, read-only (subagent_type: "Plan"). |
| Execute | sonnet (Sonnet 5.5) | Write and edit code, run checks, produce the deliverable. |
| Review | opus (Opus 5.5) | Check the finished work before reporting: correctness, security, money, data loss. |
| Swarm | haiku (Haiku 5.5) | Many small parallel jobs: search, read, extract, classify, per-file scans. |
mcp__ccd_session_mgmt__get_usage (load it with ToolSearch if deferred). Use fable only when every window has room: 5-hour limit under 70% used, "Weekly · all models" under 80%, and "Weekly · Fable" (if listed) under 80%. Otherwise use opus. If the tool is missing, or its status is unavailable or not_applicable (API key, Bedrock, Vertex), use opus. Say the pick in one line: Think: <model> (5h <n>%, weekly <n>%, Fable <n>%).Lessons from earlier runs live in two files: ~/.claude/skill-lessons/threat-model.md (any repo) and .claude/skill-lessons/threat-model.md at the repo root (this repo only).
- <YYYY-MM-DD>: <do or avoid X> because <Y>. (seen: 1). When a line already says the same thing, raise its seen count and date instead of adding one. Facts about this repo go in the repo file, everything else in the user file. Keep each file under 30 lines by merging or dropping stale lessons.seen: 3: if the ashish-claude-skills source repo is open, propose the edit to plugins/quality-gates/skills/threat-model/SKILL.md as a diff and wait for a yes, then delete the lesson once it lands; otherwise say Lesson ready to promote: <line> in the report.Learned: <the line written | nothing>.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ashishyd/ashish-claude-skills --plugin quality-gates10 skills in this plugin
/claude-md-syncUse after changing business logic, domain rules, data models, APIs, architecture, commands, config or dependencies, before calling the work done, to keep CLAUDE.md true to the code. Also when the user says "update CLAUDE.md", "sync the docs" or "is CLAUDE.md still right"./design-auditUse when a UI component, page or stylesheet has just been built or changed and its visual quality needs checking, when the user asks whether a screen looks right, consistent or polished, or before shipping front-end work./login-and-accessUse when writing, changing or reviewing sign-in, sign-up, logout, password reset, magic links, OAuth or SSO, MFA, sessions, cookies, JWTs, refresh tokens, roles, permissions, admin areas, multi-tenant data or any route that must know who the caller is and what they may see./personal-dataUse when writing, changing or reviewing code that stores, reads, sends, logs, exports or deletes information about people (users, customers, clients, patients, children, employees), including new database columns or tables, migrations, forms, analytics or tracking events, error reporting, third-party APIs, AI prompts, data exports, account deletion, consent, cookie banners, retention jobs, or questions about GDPR, CCPA, LGPD, DPDP or other privacy laws./playwright-testsUse when writing, generating or fixing Playwright end-to-end tests, covering a user journey in a real browser, choosing locators, handling login state or test data, or when an e2e test is flaky, slow or times out./security-code-auditUse when writing, changing or reviewing code that handles user input, forms, auth, passwords, sessions, tokens, API keys, secrets, env vars, permissions, database queries, file uploads, webhooks, payments or a new API route, or when the user asks for a security review of a diff, a file or a feature.Other plugins' skills for the same job