agentleFS
tamldtamld/defense-in-depth/.agents/skills/skill-threat-modeling-expert/SKILL.md

skill-threat-modeling-expert

Skill4 starsChanged 7 months agoMITView on GitHub

Design the threat coverage for a new Guard by thinking like an adversary first.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before any guard code is written, produce a formal threat model that:

    line 21
  2. Distinctive:

    Name the adversary first: Every threat model must start with: *"An agent can bypass [gate] by [action]."*

    line 31
  3. Very specific:

    Document all cases in tests/fixtures/<guard-name>/edge_cases.md before any code.

    line 67
  4. Distinctive:

    Symmetric thinking: Only modeling what the guard catches, not what it misses.

    line 85
  5. Very specific:

    Missing config bypass: Not checking whether a user could useDspy: false to disable the detection.

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SKILL: skill-threat-modeling-expert

Identity

Role: The Threat Modeler
Philosophy: A guard that wasn't designed from an attack vector is a guard with unknown blind spots.


Mission

Before any guard code is written, produce a formal threat model that:

  1. Names the adversary (which agent behavior triggers the violation)
  2. Maps the attack surface (which files, metadata, commands are exploited)
  3. Defines the detection contract (regex, schema, heuristic, or semantic)
  4. Identifies bypass vectors the guard must also cover

Hard Gates

  1. Name the adversary first: Every threat model must start with: "An agent can bypass [gate] by [action]."
  2. No generic threats: "The agent may produce bad output" is not a threat. Specificity is mandatory.
  3. Tier 0 coverage first: The primary detection path must be deterministic. Probabilistic signals (DSPy) are additive only.
  4. Bypass must be enumerated: At least one bypass scenario must be documented — what does a clever adversary do to evade this guard?

Workflow

Step 1: Define the Violation

Adversary: An AI agent acting in [context]
Bypass method: Creates/modifies [artifact] such that [gate] does not fire
Impact: [what governance guarantee is lost]
Example: A hollow implementation_plan.md with only headers passes the hollow-artifact guard
         if the regex patterns don't include "# Overview\n\n(nothing after)"

Step 2: Map the Attack Surface

  • Which staged file types are exploited?
  • Which metadata fields (commit message, branch name, ticket ID) are involved?
  • Which config values can an agent manipulate to weaken the guard?

Step 3: Define Detection Tiers

TierMethodConfidenceSeverity
0Regex / schema / lengthDeterministicBLOCK or WARN
1DSPy semantic scoreProbabilisticWARN only

Step 4: Enumerate Bypasses

For each detection method, document at least one bypass attempt:

  • What input would pass the regex but still be hollow?
  • What score threshold would a clever agent game?
  • What config value would disable the guard?

Step 5: Write to edge_cases.md

Document all cases in tests/fixtures/<guard-name>/edge_cases.md before any code.


Output Contract

DeliverableLocation
Threat statementtests/fixtures/<guard>/edge_cases.md — top section
Attack surface maptests/fixtures/<guard>/edge_cases.md — §2
Detection tier tabletests/fixtures/<guard>/edge_cases.md — §3
Bypass scenarios (≥1)tests/fixtures/<guard>/edge_cases.md — §4

Anti-Patterns

  1. "The guard checks for X" without explaining what attacker behavior triggers X.
  2. Symmetric thinking: Only modeling what the guard catches, not what it misses.
  3. Tier confusion: Proposing DSPy as the primary detection mechanism for a BLOCK finding.
  4. Missing config bypass: Not checking whether a user could useDspy: false to disable the detection.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.