MCPInstall

threat-model-generation

by factory-ai OfficialSecurity

Generate a STRIDE-based security threat model for a repository. Use when setting up security monitoring, after architecture changes, or for security audits.

Installs
141
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/factory-ai/factory-plugins --skill threat-model-generation
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads threat-model-generation automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Threat Model Generation

Generate a comprehensive security threat model for a repository using the STRIDE methodology. This skill analyzes the codebase architecture and produces an LLM-optimized threat model document that other security skills can reference.

When to Use This Skill

  • First-time setup - New repository needs initial threat model
  • Architecture changes - Significant changes to components, APIs, or data flows
  • Security audit - Periodic review or compliance requirement
  • Manual request - Security team requests updated threat model

Inputs

Before running this skill, gather or confirm:

InputDescriptionRequired
Repository pathRoot directory to analyzeYes (default: current directory)
Existing threat modelPath to existing .factory/threat-model.md if updatingNo
Compliance requirementsFrameworks to consider (SOC2, GDPR, HIPAA, etc.)No
Security contactsEmail addresses for security team notificationsNo

Instructions

Follow these steps in order:

Step 1: Analyze Repository Structure

Scan the codebase to understand the system:

  1. Identify languages and frameworks

    • Check package.json, requirements.txt, go.mod, Cargo.toml, etc.
    • Note the primary tech stack (e.g., Next.js, Django, Go microservices)
  2. Map components and services

    • Look for apps/, services/, packages/ directories
    • Identify entry points: API routes, CLI commands, web handlers
    • Note databases, caches, message queues
  3. Identify external interfaces

    • HTTP endpoints (REST, GraphQL)
    • File upload handlers
    • Webhook receivers
    • OAuth/SSO integrations
    • CLI commands that accept user input
  4. Trace data flows

    • How does user input enter the system?
    • Where is sensitive data stored?
    • What external services are called?

Step 2: Identify Trust Boundaries

Define security zones:

  1. Public Zone (untrusted)

    • All external HTTP endpoints
    • Public APIs without authentication
    • User-uploaded files
  2. Authenticated Zone (partially trusted)

    • Endpoints requiring valid session/token
    • User-specific data access
    • Rate-limited APIs
  3. Internal Zone (trusted)

    • Service-to-service communication
    • Admin-only endpoints
    • Database connections
    • Secrets management

Document where trust boundaries exist and what validates transitions between zones.

Step 3: Inventory Critical Assets

Classify data by sensitivity:

  1. PII (Personally Identifiable Information)

    • User emails, names, addresses, phone numbers
    • Document protection measures
  2. Credentials & Secrets

    • Password hashes, API keys, OAuth tokens
    • JWT signing keys, encryption keys
    • Document rotation policies
  3. Business-Critical Data

    • Transaction records, customer data
    • Proprietary algorithms, trade secrets
    • Document access controls

Step 4: Apply STRIDE Analysis

For each major component, analyze threats in all six categories:

S - Spoofing Identity

  • Can attackers impersonate users or services?
  • Are authentication mechanisms secure?
  • Look for: weak session handling, API key exposure, missing MFA

T - Tampering with Data

  • Can attackers modify data in transit or at rest?
  • Look for: SQL injection, XSS, mass assignment, missing input validation

R - Repudiation

  • Can users deny actions they performed?
  • Look for: missing audit logs, insufficient logging, no immutable trails

I - Information Disclosure

  • Can attackers access data they shouldn't?
  • Look for: IDOR, verbose errors, hardcoded secrets, data leaks in logs

D - Denial of Service

  • Can attackers disrupt service availability?
  • Look for: missing rate limits, resource exhaustion, algorithmic complexity

E - Elevation of Privilege

  • Can attackers gain unauthorized access levels?
  • Look for: missing authorization checks, role manipulation, privilege escalation

For each identified threat:

  • Describe the attack scenario
  • List vulnerable components
  • Show code patterns to look for
  • Note existing mitigations
  • Identify gaps
  • Assign severity (CRITICAL/HIGH/MEDIUM/LOW) and likelihood

Step 5: Document Vulnerability Patterns

Create a library of code patterns specific to this codebase's tech stack:

# Example: SQL Injection patterns for Python
# VULNERABLE
sql = f"SELECT * FROM users WHERE id = {user_id}"

# SAFE
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))

Include patterns for:

  • SQL injection
  • XSS (Cross-Site Scripting)
  • Command injection
  • Path traversal
  • Authentication bypass
  • IDOR (Insecure Direct Object Reference)

Step 6: Generate Output Files

Create two files:

1. .factory/threat-model.md

Use the template in stride-template.md to generate a comprehensive threat model with:

  • System overview with architecture description
  • Trust boundaries and security zones
  • Attack surface inventory
  • Critical assets classification
  • STRIDE threat analysis for each component
  • Vulnerability pattern library
  • Security testing strategy
  • Assumptions and accepted risks
  • Version changelog

The document should be written in natural language with code examples, optimized for LLM comprehension.

2. .factory/security-config.json

Generate configuration metadata:

{
  "threat_model_version": "1.0.0",
  "last_updated": "<ISO timestamp>",
  "security_team_contacts": [],
  "compliance_requirements": [],
  "scan_frequency": "on_commit",
  "severity_thresholds": {
    "block_merge": ["CRITICAL"],
    "require_review": ["HIGH", "CRITICAL"],
    "notify_security_team": ["CRITICAL"]
  },
  "vulnerability_patterns": {
    "enabled": [
      "sql_injection",
      "xss",
      "command_injection",
      "path_traversal",
      "auth_bypass",
      "idor"
    ],
    "custom_patterns_path": null
  }
}

Customize based on:

  • Detected compliance requirements (from docs, configs, or user input)
  • Security team contacts (if provided)
  • Tech stack (enable relevant vulnerability patterns)

Success Criteria

The skill is complete when:

  • .factory/threat-model.md exists with all sections populated
  • .factory/security-config.json exists with valid JSON
  • All major components have STRIDE analysis
  • Vulnerability patterns match the tech stack
  • Document is written in natural language (LLM-readable)
  • No placeholder text remains

Verification

Run these checks before completing:

# Verify threat model exists and is non-empty
test -s .factory/threat-model.md && echo "✓ Threat model exists"

# Verify config is valid JSON
cat .factory/security-config.json | jq . > /dev/null && echo "✓ Config is valid JSON"

# Check threat model has key sections
grep -q "## 1. System Overview" .factory/threat-model.md && echo "✓ Has System Overview"
grep -q "## 5. Threat Analysis" .factory/threat-model.md && echo "✓ Has Threat Analysis"
grep -q "## 6. Vulnerability Pattern Library" .factory/threat-model.md && echo "✓ Has Pattern Library"

Example Invocations

Generate initial threat model:

Generate a threat model for this repository using the threat-model-generation skill.

Update existing threat model after architecture change:

Update the threat model - we added a new payments service in services/payments/.

Generate with compliance requirements:

Generate a threat model for this repository. We need to comply with SOC2 and GDPR.

References

FAQ

What does the threat-model-generation skill do?

Generate a STRIDE-based security threat model for a repository. Use when setting up security monitoring, after architecture changes, or for security audits.

How do I install threat-model-generation?

Run npx skills add https://github.com/factory-ai/factory-plugins --skill threat-model-generation in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/threat-model-generation/ (personal) or .claude/skills/threat-model-generation/ (project).

Which AI agents can use threat-model-generation?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is threat-model-generation safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains threat-model-generation?

It is published by factory-ai in factory-ai/factory-plugins, and it is an official skill from the maker of the technology it covers. It has 141 recorded installs.

More from factory-ai/factory-plugins

View all →

no-use-effect

factory-ai/factory-plugins

Enforce the no-useEffect rule when writing or reviewing React code. ACTIVATE when writing React components, refactoring existing useEffect calls, reviewing PRs with useEffect, or when an agent adds useEffect "just in case." Provides the five replacement patterns and the useMountEffect escape hatch.

OfficialFrontend & Design1K installs

human-writing

factory-ai/factory-plugins

Remove signs of AI-generated writing from text to make it sound more natural and human-written. Use when editing or reviewing any form of document including: markdown, technical docs, emails, blog posts, PRDs, or any dedicated writing content. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.

OfficialDocs & Writing600 installs

simplify

factory-ai/factory-plugins

Open the skill to read its SKILL.md instructions.

Official240 installs

frontend-design

factory-ai/factory-plugins

Open the skill to read its SKILL.md instructions.

OfficialFrontend & Design164 installs

visual-design

factory-ai/factory-plugins

Image generation and presentations. Use when: - User asks for images: logos, icons, app assets, diagrams, flowcharts, architecture diagrams, patterns, textures, photo edits, restorations - User needs a presentation or slide deck Covers nanobanana CLI for image generation and Slidev for presentations.

OfficialFrontend & Design160 installs

security-review

factory-ai/factory-plugins

Open the skill to read its SKILL.md instructions.

OfficialCode Quality & Workflow157 installs

Popular security skills

View category →

azure-compliance

microsoft/azure-skills

Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.

OfficialSecurity567K installs

minimal-run-and-audit

lllllllama/rigorpilot-skills

Rigor Run skill for README-first deep learning repo reproduction. Use when the task is specifically to capture or normalize evidence from the selected smoke test or documented inference or evaluation command and write standardized reprooutputs/ files, including patch notes when repository files changed. Do not use for training execution, initial repo intake, generic environment setup, paper lookup, target selection, hidden scientific-meaning changes, or end-to-end orchestration by itself.

Security477.4K installs

seo-audit

coreyhaines31/marketingskills

When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," "indexing issues," "stuck on page 2," "striking distance keywords," "title tag rewrite," "low CTR," "local SEO," "Google Business Profile," or "map pack." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema. For AI search optimization, see ai-seo.

Security238.7K installs

firebase-security-rules-auditor

firebase/agent-skills

Audits Firebase (Firestore, Cloud Storage) security rules for vulnerabilities, privilege escalation, role bypasses, create vs update inconsistencies, resource exhaustion, type safety, size limits, and hasOnly ownership checks. Use when auditing/reviewing rules, running red-team rule assessments, or scoring against auditor checklists. Don't use for Firebase CLI (login, deploy), Auth, Crashlytics, Remote Config, or database queries.

OfficialSecurity139.1K installs

audit

pbakaus/impeccable

Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review.

Security81.9K installs

competitors

coreyhaines31/marketingskills

When the user wants to create competitor comparison or alternative pages for SEO and buyer-facing use. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' 'competitive landing pages,' 'how do we compare to X,' 'competitor teardown,' 'audit our competitor pages,' 'are our comparison pages out of date,' or 'competitive asset audit.' Use this for any content that positions your product against competitors. Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. For auditing existing claims (not researching competitors from scratch, which is competitor-profiling; not technical SEO on these pages, which is seo-audit), use the asset audit here. For internal battle cards and sales-specific competitor docs, see sales-enablement.

Security79.3K installs