Skip to main content
skill CX Codex

threat-patch — Claude Code skill: what it does, how to install

threat-patch turns scanner findings or a threat model into small code patches, each with a short write-up and test steps.

MIT 232 installs ★ 227 updated 2026-08-15

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add pproenca/dot-skills --skill threat-patch -a claude-code
Open on GitHub

What threat-patch does

The skill accepts a findings.json, a Codex CSV export, a THREAT-MODEL.md, or a vulnerability you describe in chat, then prepares a fix for every entry. It opens the listed paths first and checks whether the problem still exists on HEAD, then shows a plan: which files change and how. Edits start only after you approve.

When one bug repeats across several places, you get a shared helper instead of a patch per site. CSV input goes through scripts/parse-findings.sh <csv-path> first, which pulls the findings into structured form.

Keep the repo under git before starting. Undo is git checkout -- <files> while nothing is committed, and git revert once fixes are in commits. PreToolUse hooks on Edit and Write ask for confirmation on every file change. Three reference docs inside the skill cover the step-by-step method, patterns per vulnerability class, and the write-up template.

What it helps with

  • patch vulnerabilities from findings.json one at a time, worst first
  • turn a scanner CSV export into working fixes
  • re-check a finding against HEAD before editing anything
  • replace several copies of one weak spot with a single shared helper
  • record the fix and its test command for review

Example prompts for the agent

  • Patch the findings in findings.json, start with the most severe ones.
  • Work through the scanner CSV: run scripts/parse-findings.sh security.csv and propose fixes.
  • Here is a flaw in the API login handler. Propose the smallest correct change and leave the surrounding code alone.

How to install threat-patch

1Skills CLI (Vercel)

npx skills add pproenca/dot-skills --skill threat-patch -a claude-code

2Manually: put the files in place

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

Copy the whole skill folder; for one project use .claude/skills/threat-patch/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about threat-patch

How do I install threat-patch in Claude Code?

Run npx skills add pproenca/dot-skills --skill threat-patch -a claude-code. The skill file lands at ~/.claude/skills/threat-patch/SKILL.md.

What does threat-patch do?

It maps each finding to the files and functions involved, confirms the issue on the current branch, and writes a narrow fix. Once you approve, it attaches a summary and the commands needed to test the change.

Which inputs does the skill accept?

A findings.json from threat-model is the richest option because it carries data flow traces and groupings. A Codex CSV, a THREAT-MODEL.md, or a vulnerability described in chat also work.

Source text

SKILL.md · MIT
---
name: threat-patch
description: Remediate security findings by producing minimal, surgical code patches. Triggers on 'patch security findings', 'fix vulnerabilities', 'remediate findings', 'threat patch', or when the user provides a findings.json (from threat-model), a Codex security findings CSV, a THREAT-MODEL.md, or individual vulnerability descriptions and wants them fixed. Also trigger when reviewing code flagged by a security scanner and the user wants actionable fixes rather than just reports.
---
# Threat Patch

Reads security findings and produces minimal, surgical code patches with structured documentation. Fixes are code-grounded — each patch targets specific files and functions identified in the finding. Output includes a summary, validation steps, and the code changes.

## When to Apply

- User provides a `findings.json` (from threat-model) and wants fixes
- User provides a Codex security findings CSV and wants fixes
- User has a THREAT-MODEL.md and wants to remediate identified risks
- User describes a specific vulnerability and wants a patch
- Reviewing security scanner output and needs actionable fixes
- After a security audit, turning findings into code changes

## Input Sources (priority order)

| Source | What It Provides | How to Use |
|--------|-----------------|-----------|
| **findings.json** (from threat-model) | Structured findings with data flow traces, systemic groupings, exploit chains, and severity ratings | Read directly — richest input, already triaged and grouped |
| **Codex CSV** | Title, description, severity, relevant_paths per finding | Run `scripts/parse-findings.sh <csv-path>` to extract structured output |
| **THREAT-MODEL.md** | Human-readable threat model | Extract findings from Criticality Calibration section |
| **Inline description** | User describes a specific vulnerability | Parse from conversation context |

When `findings.json` is available, it's the preferred input — it includes data flow traces (entry → chain → sink) that directly inform where to apply fixes, and systemic groupings that suggest centralized fixes over individual patches.

## Workflow Overview

```
1. Ingest Findings   → Read findings.json / CSV / descriptions
2. Triage & Group    → Sort by severity, use systemic groupings if available
3. For each finding:
   a. Read Code      → Open relevant_paths, understand the pattern
   b. Confirm        → Verify issue is still present in HEAD
   c. Design Fix     → Determine minimal fix approach
   d. Implement      → Write the code changes
   e. Document       → Summary + Validation + Attack-path (if needed)
   f. Test           → Run relevant tests
4. Output            → Per-patch deliverable with summary and diff
5. Update State      → Mark patched findings in findings.json (if present)
```

## How to Use

1. Read [workflow](references/workflow.md) for the detailed patching methodology at each step
2. Read [fix patterns](references/fix-patterns.md) when designing fixes — common patterns by vulnerability class
3. Read [output format](references/output-format.md) for the documentation template per patch
4. If input is findings.json: read it directly — it's already structured
5. If input is Codex CSV: run `scripts/parse-findings.sh <csv-path>` to extract structured output

## Key Principles

- **Minimal diff**: Fix the vulnerability, don't refactor surrounding code. The smallest correct patch is the best patch
- **Centralize over duplicate**: When multiple code paths share the same vulnerability pattern, extract a shared helper rather than patching each site independently
- **Explicit error paths**: Add specific error types for rejected inputs with clear operator feedback, not silent failures or generic errors
- **Confirm before fixing**: Always verify the finding is still present in HEAD — code may have moved or been refactored since the finding was detected
- **User approval before edits**: Present the fix design (files to change, approach) and wait for approval before modifying source code. Hooks gate Edit/Write tool calls for additional safety
- **Document even failures**: When a fix can't be tested due to environment limitations, document the test command and the limitation

## Guardrails

This skill modifies source code. Safety measures:
- **PreToolUse hooks** on Edit and Write tools prompt for confirmation before each file change
- **Confirmation gate** in the workflow between fix design and implementation
- **Revert path**: Without commits (default), use `git checkout -- <files>` to undo. With commits, use `git revert`

## Output Modes

**Code patch** — when a fix is implemented:
- Summary of what was confirmed and what the fix does
- Testing section with build/test commands
- The actual code changes

**Analysis only** — when the fix needs user decision or architectural changes:
- Summary of what was confirmed
- Validation checklist
- Attack-path analysis (path, likelihood, impact, assumptions, controls, blindspots)

## References

| File | When to Read |
|------|-------------|
| [references/workflow.md](references/workflow.md) | Before starting — detailed approach for each patching phase |
| [references/fix-patterns.md](references/fix-patterns.md) | When designing fixes — patterns by vulnerability class |
| [references/output-format.md](references/output-format.md) | When documenting — templates for both output modes |

© pproenca · MIT · pproenca/dot-skills

Similar skills

All skills for Security →

From the same set139

The whole set →
graph-schema graph-schema is a Claude Code skill for designing, reviewing, and refactoring graph database schemas. It activates for node and relationship modeling or when mapping a domain into a graph. CX Codex +1 239installs clean-code-ts-react clean-code-ts-react adapts Robert C. Martin's Clean Code principles for TypeScript 5.x and React 19. Guides code reviews, component architecture, and refactoring sessions. CX Codex +1 238installs cli-for-agents cli-for-agents is a Claude Code skill for designing and reviewing CLIs used by AI agents and automation. It applies to work on subcommands, flags, help text, and error messages. CX Codex +1 237installs eval-mcp eval-mcp measures MCP tool schema quality and Claude's tool selection accuracy. Detects confusing descriptions and runs intent benchmarks. CX Codex +1 234installs diagram-quality diagram-quality enforces PlantUML quality and rendering rules for the agent-uml canvas to avoid HTTP 400 errors and unclickable elements in diagram workflows. CX Codex +1 230installs drizzle-sqlite drizzle-sqlite — a Drizzle ORM skill for SQLite schema design, migrations, queries, transactions, and types. Use it when writing or reviewing SQLite-backed code. CX Codex +1 221installs cli-review-runner The cli-review-runner skill for Claude Code checks a CLI command against 45 rules from the cli-for-agents catalog to assess whether an agent can use it safely in a pipeline. CX Codex +1 219installs openai-codex-rust-patterns openai-codex-rust-patterns applies 63 production Rust patterns distilled from the OpenAI Codex codebase. Helps build resilient async workflows, process sandboxes, and panic-free error architectures. CX Codex +1 219installs

Project sponsors

Companies that keep this analytics open