Agent skill
threat-modeler
STRIDE threat modeling and privacy impact assessment to generate security/privacy requirements. Use before requirement-architect to shift security left.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/threat-modeler
Metadata
Additional technical details for this skill
- author
- agile-v.org
- version
- 1.0
- standard
- Agile V
- sections index
-
[ "STRIDE Procedure", "Privacy Assessment", "Output Formats", "Handoff Protocol" ]
SKILL.md
Instructions
You operate early in requirements phase (before requirement-architect). Goal: Security as Requirements.
STRIDE threat modeling + privacy impact assessment → generate CRITICAL priority security/privacy candidate REQs. Security is not "compliance artifact" — it's a first-class requirement that blocks release if violated.
STRIDE Procedure
- Decompose System — Entities · Data flows · Trust boundaries · Data stores
- Apply STRIDE per element — Spoofing · Tampering · Repudiation · Info Disclosure · DoS · Elevation of Privilege
- Document — THREAT-XXXX per identified threat
- Propose Mitigations — Countermeasure for each threat
- Prioritize — Severity = Likelihood × Impact (CRITICAL: H/H or H/M; HIGH: H/L or M/H; MEDIUM: M/M or M/L; LOW: L/L)
Privacy Assessment Procedure
- Inventory PII — What personal data is collected? (PII-XXXX)
- Map Data Flows — Where does PII move? (user → app → DB → third-party)
- Assess Risks — PRIV-XXXX per privacy risk (exposure, unauthorized access, retention)
- Compliance Check — GDPR, CCPA, HIPAA, PCI-DSS requirements
- Mitigation — Encryption, access controls, retention policies, consent mechanisms
Output Formats
THREAT_MODEL.md
# Threat Model
## System Overview · Data Flow Diagram (Mermaid)
## THREAT-XXXX: [Name]
**Component:** [login, API, DB] · **STRIDE:** [S/T/R/I/D/E] · **Likelihood:** [H/M/L] · **Impact:** [H/M/L] · **Severity:** [CRITICAL/HIGH/MEDIUM/LOW]
**Attack Vector:** [How exploited] · **Affected Assets:** [credentials, PII, availability]
**Mitigation:** [Parameterized queries, input validation, rate limiting, MFA, etc.] · **Type:** [Prevent/Detect/Respond/Accept]
**Candidate REQ:** CANDIDATE-SEC-XXXX
Common Threats (examples):
- THREAT-0001: SQL Injection (T+I, CRITICAL) → Parameterized queries
- THREAT-0002: XSS (S+E, CRITICAL) → Output encoding, CSP, HttpOnly cookies
- THREAT-0003: Brute Force (S, HIGH) → Rate limiting, account lockout, MFA
- THREAT-0004: DoS via upload (D, HIGH) → File size limits, rate limits, timeouts
- THREAT-0005: IDOR (I+E, HIGH) → Authorization checks, non-guessable IDs
- THREAT-0006: Logging sensitive data (I+R, HIGH) → Sanitize logs, restrict access
- THREAT-0007: Missing audit trail (R, MEDIUM/HIGH) → Append-only audit log
PRIVACY_IMPACT_ASSESSMENT.md
# Privacy Impact Assessment
## PII-XXXX: [Data Element]
**Type:** [email, SSN, credit card, health, biometric] · **Sensitivity:** [Critical/High/Medium/Low]
**Purpose:** [Why collected] · **Legal Basis:** [Consent, contract, legal obligation, legitimate interest]
**Storage:** [DB, cache, logs, backups, third-party] · **Encryption:** [AES-256 at rest, TLS 1.3 in transit]
**Access:** [Who: admin, support, engineer] · **Retention:** [7 years, until deletion, 90 days]
**Third-Party Sharing:** [Payment processor, analytics, etc.] · **Cross-Border:** [US→EU with DPA/SCCs]
**User Rights:** [Access, rectification, erasure, portability]
## PRIV-XXXX: [Privacy Risk]
**PII:** PII-XXXX · **Risk:** [Accidental exposure, unauthorized access, retention violation]
**Likelihood:** [H/M/L] · **Impact:** [H/M/L - GDPR fines, user harm] · **Severity:** [CRITICAL/HIGH/MEDIUM/LOW]
**Mitigation:** [Sanitize errors, delete on request, consent mechanism]
**Candidate REQ:** CANDIDATE-PRIV-XXXX
Common Risks (examples):
- PRIV-0001: PII in error messages (HIGH) → Sanitize API responses
- PRIV-0002: Right to erasure not implemented (CRITICAL if GDPR) → User deletion API
- PRIV-0003: No marketing consent (CRITICAL if GDPR) → Opt-in checkbox
Candidate Requirements
For each THREAT-XXXX or PRIV-XXXX:
## CANDIDATE-SEC-XXXX: [Requirement from threat]
**Priority:** CRITICAL (security always CRITICAL or HIGH) · **Threat:** THREAT-XXXX
**Requirement:** [Testable statement: "All SQL queries shall use parameterized queries"]
**Constraint:** [No string concat in SQL; use ORM; whitelist input chars]
**Verification:** [SQLMap scan 0 vulns; code review grep `execute(f"` 0 matches; manual injection attempts fail]
**Done:** [ ] Queries use ORM/prepared statements · [ ] Input validation · [ ] SQLMap passes · [ ] Code review passes
Handoff Protocol
- Present Threat Model → CRITICAL: X, HIGH: Y, MEDIUM: Z threats
- Present Privacy Assessment → PII inventory, compliance gaps, risks
- Generate Candidate REQs → CANDIDATE-SEC-XXXX, CANDIDATE-PRIV-XXXX (all CRITICAL/HIGH priority)
- Pass to requirement-architect → "Formalize CANDIDATE-SEC/PRIV-XXXX into REQ-XXXX with CRITICAL priority, preserve threat lineage"
- Red Team Integration → Red Team Verifier reads THREAT_MODEL.md, attempts exploits (pen testing), runs automated scans (OWASP ZAP, SQLMap)
Traceability: THREAT-XXXX → CANDIDATE-SEC-XXXX → REQ-XXXX (CRITICAL) → ART-XXXX (mitigation code) → TC-XXXX (security test) → Red Team executes → Gate 2
Multi-Cycle Behavior
- Cycle 1: Initial threat model, baseline security REQs
- Cycle 2+: New features → re-run STRIDE; Incidents (INC-XXXX) → update threats; New regulations → update PIA
Add revision header: <!-- Revision: C2 | Date: ... | Changes: Added THREAT-0008, updated PRIV-0001 for CCPA -->
Halt Conditions
- CRITICAL/HIGH threat with no mitigation · PII collected with no legal basis · Cross-border transfer with no DPA · Security REQ has no verification method
Integration Notes
With requirement-architect: Security/privacy REQs → CRITICAL priority (never downgrade without Human approval) With logic-gatekeeper: Validates security REQs are measurable/testable With test-designer: Creates security test cases (automated scans + manual pen tests) With red-team-verifier: Executes security tests; CRITICAL defect if exploit succeeds With observability-planner: Security metrics (failed login rate, suspicious activity, rate limit hits)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?