Agent skill

Detecting SQL Injection Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Scan a source tree for SQL-injection vulnerable patterns: string concatenation into queries, f-string interpolation in SQL, string-format substitution into raw queries, deprecated cursor methods…

MITAuto-check passedSecurity

Install Detecting SQL Injection Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-sql-injection-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace detecting-sql-injection-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/detecting-sql-injection-patterns .claude/skills/detecting-sql-injection-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
detecting-sql-injection-patterns
GitHub stars
2.8k
Token cost
~1.5k tokens
SKILL.md length
451 words
Files
4 (incl. scripts, references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Scan a source tree for SQL-injection vulnerable patterns: string concatenation into queries, f-string interpolation in SQL, string-format substitution into raw queries, deprecated cursor methods…

  • Works in 4 steps: Run the scanner → Interpret findings → Remediation → …
  • : pre-commit code review
  • SKILL.md covers Overview, When the skill produces findings, Prerequisites and Instructions, plus 4 more sections
  • Runs Python scripts from its folder; calls python3 and git

What it does

Detecting SQL Injection Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Scan a source tree for SQL-injection vulnerable patterns: string concatenation into queries, f-string interpolation in SQL, string-format substitution into raw queries, deprecated cursor methods (cursor.execute with % formatting), Knex / Sequelize raw() with template interpolation, sequelize.query with replacements. Use when: pre-commit code review, post-feature SQL-touching release, inheriting a legacy codebase that predates ORMs, or post-bug-report investigation. Threshold: any source line where SQL keywords…

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including scripts and reference files (for example `references/PLAYBOOK.md`, `references/THEORY.md` and `scripts/scan_sqli.py`). Compatibility notes: Designed for Claude Code

It sits in Security, covering Web application vulnerabilities, SQL and ORMs and data access. It works with SQL. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • : pre-commit code review
  • Post-feature SQL-touching release
  • Inheriting a legacy codebase that predates ORMs
  • Post-bug-report investigation

Example prompts

  • “scan for sqli”
  • “sql injection patterns”
  • “check raw queries”
  • “/detecting-sql-injection-patterns”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Bash(python3:*), Glob, Grep

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Run the scanner
  2. Interpret findings
  3. Remediation
  4. Cross-skill chaining

What it can do on your machine

Read from SKILL.md and the folder at commit 23ea8d4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Bash(python3:*)
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Detecting SQL Injection Patterns loads about 1.5k tokens when it runs, and up to ~5.2k if it reads all its reference files. Until then it costs about 203 tokens; SKILL.md has 451 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~203
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 23ea8d4, republished under its MIT licence (© jeremylongshore). 451 words, ~1,491 tokens.

Download SKILL.mdSave it as .claude/skills/detecting-sql-injection-patterns/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
detecting-sql-injection-patterns
description
Scan a source tree for SQL-injection vulnerable patterns: string concatenation into queries, f-string interpolation in SQL, string-format substitution into raw queries, deprecated cursor methods (cursor.execute with % formatting), Knex / Sequelize raw() with template interpolation, sequelize.query with replacements. Use when: pre-commit code review, post-feature SQL-touching release, inheriting a legacy codebase that predates ORMs, or post-bug-report investigation. Threshold: any source line where SQL keywords (SELECT / INSERT / UPDATE / DELETE / FROM / WHERE) appear in a string that's being built via concatenation, f-string, %-format, or .format() with variable input. Trigger with: "scan for sqli", "sql injection patterns", "check raw queries", "audit cursor.execute".
allowed-tools
Read, Bash(python3:*), Glob, Grep
compatibility
Designed for Claude Code
disallowed-tools
Bash(rm:*), Bash(curl:*)
version
3.30.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
security, static-analysis, sql-injection, pentest

Detecting SQL Injection Patterns

Overview

SQL injection (CWE-89, OWASP A03:2021) remains one of the highest- impact and most-easily-introduced vulnerability classes. The fix is near-universal: use parameterized queries. The cause when introduced: an engineer concatenates user input into a SQL string because the ORM's parameterization mechanism wasn't obvious, or because they "just need to add a quick condition."

The scanner reads source files and grades each apparent SQL-string construction against the threshold table.

When the skill produces findings

FindingSeverityThresholdAffected control
f-string with SQL keywords + user inputCRITICALf"SELECT * FROM users WHERE id = {user_id}"CWE-89
String concat into SQL keyword stringCRITICAL"SELECT ... " + var + " ..."CWE-89
%-format SQL stringHIGH"SELECT * FROM %s" % table_nameCWE-89
.format() into SQL stringHIGH"SELECT {} FROM users".format(col)CWE-89
cursor.execute(f"...")CRITICALf-string passed directly to cursor.executeCWE-89
sequelize.query with template literalHIGHsequelize.query(\SELECT * FROM ${table}`)`CWE-89
Knex / sequelize raw() with interpolationHIGHknex.raw('SELECT * FROM ' + table)CWE-89
Django .extra() with raw SQLMEDIUMModel.objects.extra(where=['col = ' + val])CWE-89
cursor.executemany with string-built queryCRITICALSame risk as executeCWE-89
JDBC Statement.execute with concatHIGHJava pattern: not PreparedStatementCWE-89
Rails where() with string interpolationHIGHUser.where("name = '#{name}'")CWE-89
Go db.Query with fmt.SprintfHIGHdb.Query(fmt.Sprintf("...", arg))CWE-89

Prerequisites

  • Python 3.9+
  • Target source tree on local filesystem

Instructions

Step 1 — Run the scanner
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-sql-injection-patterns/scripts/scan_sqli.py /path/to/repo

Options:

Usage: scan_sqli.py PATH [OPTIONS]

Options:
  --output FILE      Write findings to FILE
  --format FMT       json | jsonl | markdown (default: markdown)
  --min-severity SEV (default: info)
  --include-tests    Include test directories (default: excluded)
  --languages LIST   Comma-separated: python,javascript,typescript,java,
                     ruby,go,php,csharp (default: all)
Step 2 — Interpret findings

CRITICAL = direct user-input → query string construction. Fix the specific query AND audit nearby code for the same pattern.

HIGH = pattern suggests interpolation but might be a fixed identifier (table/column name). Verify by reading the code.

MEDIUM = framework-specific pattern that's safe ONLY with strict input validation (Django .extra(), Rails string where()).

Show full SKILL.md (184 more words)Show less
Step 3 — Remediation

For each finding, the fix is the same shape per language: use the language/library's parameterized-query API. See references/PLAYBOOK.md for per-language snippets.

Step 4 — Cross-skill chaining

Consider running scanning-for-hardcoded-secrets (#10) on the same target — same audit, different class of finding.

Examples

Example 1 — Pre-merge code review
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-sql-injection-patterns/scripts/scan_sqli.py \
    --min-severity high $(git diff --name-only main...HEAD | tr '\n' ' ')

Scans only files changed in the current branch — fast feedback for PR review.

Example 2 — Legacy codebase audit
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/detecting-sql-injection-patterns/scripts/scan_sqli.py \
    /path/to/legacy-app --format markdown > sqli-audit.md

Expect dozens to hundreds of findings on a pre-ORM Java/PHP codebase. Prioritize by reachability: the queries reached from public endpoints first.

Output

JSON / JSONL / Markdown. Exit codes: 0 clean, 1 high/critical, 2 error.

Error Handling

  • False positives on fixed-identifier interpolation (e.g., f"SELECT * FROM {tablename}" where tablename is hardcoded) → verify manually. The scanner can't reason about variable provenance without a full AST + control-flow pass.
  • String-built dynamic-table queries are sometimes legitimate (multi-tenant routing). Flag and review; the fix is usually allow-list validation + identifier quoting.

Resources

  • references/THEORY.md — Per-language interpolation patterns, ORM-specific safe vs unsafe APIs, why prepared statements work
  • references/PLAYBOOK.md — Per-language parameterization snippets (Python sqlite3 + psycopg + SQLAlchemy, Node mysql2 + pg + knex
    • sequelize, Ruby ActiveRecord, Go database/sql, Java JDBC PreparedStatement, PHP PDO)

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts, references) in skills/.curated/detecting-sql-injection-patterns of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/PLAYBOOK.md
  • references/THEORY.md
  • scripts/scan_sqli.py

Open the folder on GitHubat commit 23ea8d4

Compare with similar skills

Detecting SQL Injection Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Detecting SQL Injection Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Detecting SQL Injection Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.5kAutomated safety check: PassMIT
Php Thinkphp Audit0xShe/PHP-Code-Audit-Skill4021 repos~779Automated safety check: PassNone
Sast Sqliutkusen/sast-skills1.3k—~6kAutomated safety check: PassMIT
Query Builderthalysjuvenal/advpl-specialist186—~594Automated safety check: PassMIT
Frappe Syntax Query BuilderImpertio-Studio/Frappe_Claude_Skill_Package187—~1.7kAutomated safety check: PassMIT
Java Injection Auditwgpsec/AboutSecurity1.8k—~1.1kAutomated safety check: PassNone

Similar skills

  • Php Thinkphp Audit

    0xShe/PHP-Code-Audit-Skill

    ThinkPHP 框架特效安全审计工具。针对 ThinkPHP 常见的鉴权/CSRF/模板转义/ORM 写入(Mass Assignment)/调试与配置暴露等机制进行白盒静态审计,并映射到通用漏洞类型体系(AUTH/CSRF/TPL/XSS/LOGIC/CFG/SESS/SQL 等)。

    402 GitHub starsUsed in 1 repo~779 tokens
    SecurityAuto-check passed
  • Sast Sqli

    utkusen/sast-skills

    Detect SQL injection vulnerabilities in a codebase using a three-phase approach: recon (find unsafe SQL construction sites), batched verify (trace user input to those sites in parallel subagents, 3…

    1.3k GitHub stars~6k tokensUpdated 6 mo ago
    SecurityAuto-check passed
  • Query Builder

    thalysjuvenal/advpl-specialist

    A skill your agent uses when the user needs to build, choose the pattern for, or optimize a SQL query against Protheus ERP tables -- covering Workarea (DbSelectArea/DbSeek) vs Embedded SQL vs…

    186 GitHub stars~594 tokensUpdated 23 days ago
    DatabasesAuto-check passed
  • Frappe Syntax Query Builder

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when building database queries with frappe.qb in Frappe v14-v16.

    187 GitHub stars~1.7k tokensUpdated 20 days ago
    DatabasesAuto-check passed
  • Java Injection Audit

    wgpsec/AboutSecurity

    Java 源码注入类漏洞审计。当在 Java 白盒审计中需要检测注入类漏洞时触发. An agent skill from wgpsec/AboutSecurity.

    1.8k GitHub stars~1.1k tokensUpdated 4 days ago
    DatabasesAuto-check passed
  • Php Injection Audit

    wgpsec/AboutSecurity

    PHP 源码注入类漏洞审计。当在 PHP 白盒审计中需要检测注入类漏洞时触发. An agent skill from wgpsec/AboutSecurity.

    1.8k GitHub stars~965 tokensUpdated 4 days ago
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Analyzing Text With NLP

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to perform natural language processing and text analysis using the nlp-text-analyzer plugin.

    2.8k GitHub starsUsed in 1 repo~819 tokens
    Auto-check passed
  • Building Neural Networks

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill allows AI assistant to construct and configure neural network architectures using the neural-network-builder plugin.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Detecting Data Anomalies

    jeremylongshore/tons-of-skills-marketplace

    Process identify anomalies and outliers in datasets using machine learning algorithms.

    2.8k GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Explaining Machine Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill enables AI assistant to provide interpretability and explainability for machine learning models.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Optimizing Prompts

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill optimizes prompts for large language models (llms) to reduce token usage, lower costs, and improve performance.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Works with

Questions about Detecting SQL Injection Patterns

What does Detecting SQL Injection Patterns do?

Scan a source tree for SQL-injection vulnerable patterns: string concatenation into queries, f-string interpolation in SQL, string-format substitution into raw queries, deprecated cursor methods…. Detecting SQL Injection Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace.query with replacements.

When should I use Detecting SQL Injection Patterns?

Detecting SQL Injection Patterns fits situations like: : pre-commit code review; post-feature SQL-touching release; inheriting a legacy codebase that predates ORMs; post-bug-report investigation.

How do I install Detecting SQL Injection Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-sql-injection-patterns -a claude-code`. Or copy the skill folder (skills/.curated/detecting-sql-injection-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/detecting-sql-injection-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Detecting SQL Injection Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-sql-injection-patterns -a codex`. Or copy the skill folder (skills/.curated/detecting-sql-injection-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/detecting-sql-injection-patterns in your project. Codex loads it when a task matches its description.

Can I use Detecting SQL Injection Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill detecting-sql-injection-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/detecting-sql-injection-patterns, .gemini/skills/detecting-sql-injection-patterns, .github/skills/detecting-sql-injection-patterns and .opencode/skills/detecting-sql-injection-patterns in your project.

What does Detecting SQL Injection Patterns need to run?

Going by SKILL.md and its folder, Detecting SQL Injection Patterns needs Python for the scripts in its folder and the command-line tools its instructions call (python3 and git). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Bash(python3:*), Glob, Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Detecting SQL Injection Patterns access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Detecting SQL Injection Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Detecting SQL Injection Patterns use?

Detecting SQL Injection Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Detecting SQL Injection Patterns use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.7k tokens, read only when the agent opens those files.

What are the alternatives to Detecting SQL Injection Patterns?

Skills that share tags, products or a category with Detecting SQL Injection Patterns: Php Thinkphp Audit (0xShe/PHP-Code-Audit-Skill, 402 stars), Sast Sqli (utkusen/sast-skills, 1.3k stars), Query Builder (thalysjuvenal/advpl-specialist, 186 stars) and Frappe Syntax Query Builder (Impertio-Studio/Frappe_Claude_Skill_Package, 187 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Detecting SQL Injection Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,821 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 8, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.