snyk-batch-fix

snyk-batch-fix is a command for Claude Code from snyk/studio-recipes. It costs 19 tokens per session (2,211 once invoked), scanned A, original, Apache-2.0.

An automated command that fixes batches of security weaknesses already found in source code by Snyk, a code-security tool. It receives each issue’s file, line, type, and description, then applies and checks fixes.

In plain words
What is it for?
Use it during development to group reported vulnerabilities, change the affected code, validate the changes, and run a software-component security check when needed.
Why use it?
It removes the need to rediscover the same problems and fix each reported issue manually.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it during development to group reported vulnerabilities, change the affected code, validate the changes, and run a software-component security check when needed.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/snyk/studio-recipes/snyk-batch-fix
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/snyk/studio-recipes

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for snyk-batch-fix

README.md
[![agentmods](https://agentmods.dev/badge/commands/snyk/studio-recipes/snyk-batch-fix.svg)](https://agentmods.dev/commands/snyk/studio-recipes/snyk-batch-fix)
Your own site
<a href="https://agentmods.dev/commands/snyk/studio-recipes/snyk-batch-fix"><img src="https://agentmods.dev/badge/commands/snyk/studio-recipes/snyk-batch-fix.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,211 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.02211
Opus 5 $0.00010 $0.01105
Sonnet 5 $0.00004 $0.00442
Haiku 4.5 $0.00002 $0.00221

Measured 8d ago against content hash 8d837624c993, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

snyk-batch-fix scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cursor/commands/snyk-batch-fix.md · 264 lines

How it starts

The opening of the file, as written. The whole thing — 264 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Snyk Batch Fix

Overview

Fixes a batch of code vulnerabilities that were pre-scanned by the Secure at Inception hook. No discovery scan is needed -- vulnerability data (file, line, type, description) is provided in the input. This command is designed for in-development code and does NOT prompt for a PR.

Workflow: Parse → Group → Fix → Validate → SCA (if applicable) → Summary

Invocation: This command is typically invoked automatically by the Secure at Inception stop hook via followup_message, not by the user directly. The stop hook passes a markdown table of pre-scanned vulnerabilities.


Phase 1: Parse Input

No scan is needed. The vulnerability data is already provided in the input table.

Step 1.1: Parse Vulnerability Table

Parse the markdown table from the input. Each row contains:

  • #: Row number
  • Severity: critical, high, medium, low
  • ID: Snyk vulnerability ID (e.g., javascript/PT, python/SQLi)
  • Title: Human-readable name (e.g., "Path Traversal")
  • CWE: CWE identifier (e.g., CWE-22) or - if unavailable
  • File: Relative path to the affected file
  • Line: Starting line number of the vulnerability
  • Description: Snyk's explanation of the issue

Step 1.2: Group Vulnerabilities

Group the parsed vulnerabilities for efficient fixing:

  1. Group by file -- fix all vulns in one file before moving to the next
  2. Within each file, group by vulnerability type (ID) -- same vuln type gets the same fix pattern
  3. Sort files by highest severity -- fix the most critical files first
  4. Within each file, sort by line number descending -- fix from bottom to top to avoid line shifts

Step 1.3: Document Targets

## Batch Fix Plan
- **Total vulnerabilities**: [count]
- **Files affected**: [count]
- **Vulnerability types**: [list of unique IDs]

| File | Vuln Types | Count | Highest Severity |
|------|-----------|-------|-----------------|
| [file1] | [IDs] | [n] | [severity] |
| [file2] | [IDs] | [n] | [severity] |

Read the full file on GitHub · 264 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 264 lines · 19 tokens per session scan A 8d837624c993

Subscribe to this mod's changes

snyk-batch-fix is a command published in the GitHub repository snyk/studio-recipes (62 stars, last pushed 4d ago), licensed Apache-2.0. It adds 19 tokens to every session and 2,211 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.