Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Sql Injection Prevention

  • 476 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

sql-injection-prevention is a Claude Code skill that hardens database-backed APIs and forms against SQL injection for developers who need security review guidance before production release.

About

sql-injection-prevention is a security review skill from aj-geddes/useful-ai-prompts that guides developers through hardening database-backed APIs, ORM queries, and form inputs against SQL injection during pre-release security review. The skill applies parameterized query patterns, input validation strategies, and unsafe concatenation checks tailored to common web stack database access layers. Developers reach for sql-injection-prevention when shipping endpoints that accept user input and connect to SQL databases, especially before penetration testing or compliance audits.

  • Parameterized query patterns
  • Input validation checklists
  • ORM-safe query guidance
  • Legacy raw-SQL remediation
  • Pre-release security review prompts

Sql Injection Prevention by the numbers

  • 476 all-time installs (skills.sh)
  • Ranked #516 of 2,203 Security skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill sql-injection-prevention

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs476
repo stars305
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you prevent SQL injection in API endpoints?

Harden database-backed APIs and forms against SQL injection during security review before production release.

Who is it for?

Backend developers shipping REST or GraphQL APIs with SQL databases who need structured injection review before release.

Skip if: NoSQL-only applications or teams already running dedicated SAST/DAST pipelines with no manual review gap.

When should I use this skill?

A developer requests SQL injection review, parameterized query fixes, or input sanitization checks on database-backed forms and APIs.

What you get

Hardened query patterns, validated input handling, and documented injection fixes across database-backed endpoints.

  • Parameterized query refactors
  • Injection risk findings

Files

SKILL.mdMarkdownGitHub ↗

SQL Injection Prevention

Table of Contents

Overview

Implement comprehensive SQL injection prevention using prepared statements, parameterized queries, ORM best practices, and input validation.

When to Use

  • Database query development
  • Legacy code security review
  • Security audit remediation
  • API endpoint development
  • User input handling
  • Dynamic query generation

Quick Start

Minimal working example:

// secure-db.js
const { Pool } = require("pg");

class SecureDatabase {
  constructor() {
    this.pool = new Pool({
      host: process.env.DB_HOST,
      database: process.env.DB_NAME,
      user: process.env.DB_USER,
      password: process.env.DB_PASSWORD,
      max: 20,
      idleTimeoutMillis: 30000,
      connectionTimeoutMillis: 2000,
    });
  }

  /**
   * ✅ SECURE: Parameterized query
   */
  async getUserById(userId) {
    const query = "SELECT * FROM users WHERE id = $1";
    const values = [userId];

    try {
      const result = await this.pool.query(query, values);
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Node.js with PostgreSQLNode.js with PostgreSQL
Python with SQLAlchemy ORMPython with SQLAlchemy ORM
Java JDBC with Prepared StatementsJava JDBC with Prepared Statements
Input Validation & SanitizationInput Validation & Sanitization

Best Practices

✅ DO

  • Use prepared statements ALWAYS
  • Use ORM frameworks properly
  • Validate all user inputs
  • Whitelist dynamic values
  • Use least privilege DB accounts
  • Enable query logging
  • Regular security audits
  • Use parameterized queries

❌ DON'T

  • Concatenate user input
  • Trust client-side validation
  • Use string formatting for queries
  • Allow dynamic table/column names
  • Grant excessive DB permissions
  • Skip input validation

Related skills

How it compares

Use sql-injection-prevention for guided manual review of query construction; pair with automated SAST for continuous scanning.

FAQ

What does sql-injection-prevention review?

sql-injection-prevention reviews database-backed APIs and forms for unsafe SQL construction, guiding parameterized queries and input validation before production release.

When should sql-injection-prevention be invoked?

sql-injection-prevention fits pre-release security review when endpoints accept user input and execute SQL, especially before penetration tests or compliance audits.

Securityappsecauditcompliance

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.