Skip to content
aj-geddes avatar

Sql Injection Prevention

Prevention guide for SQL injection covering prepared statements, parameterized queries, ORM use, and input validation.

CCM score
40 of 100
skills.sh installs
538
GitHub stars
396
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers Node.js with PostgreSQL, Python with SQLAlchemy ORM, and Java JDBC prepared statements, plus input validation and sanitization
  • Includes a Quick Start SecureDatabase class using pg pooling with parameterized queries and environment-based connection settings
  • Enforces a do and don't list: no concatenated user input, no dynamic table or column names, and least-privilege database accounts
  • Designed for developers building database-driven applications or reviewing legacy code during a security audit

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill sql-injection-prevention -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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];

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Security, Databases
First seen
Jun 3, 2026

Questions

What does the sql-injection-prevention skill do?

The sql-injection-prevention skill guides an agent to prevent SQL injection attacks using prepared statements, parameterized queries, and input validation. It fits database-driven applications where user input reaches queries, and it covers Node.js with PostgreSQL, Python with SQLAlchemy ORM, and Java JDBC examples.

How do I install the sql-injection-prevention skill?

Run npx -y skills add aj-geddes/useful-ai-prompts --skill sql-injection-prevention -y in your project. That command installs the sql-injection-prevention skill into the project so the agent can apply its parameterized query and validation guidance.

Which skills does sql-injection-prevention sit alongside in the Security category?

sql-injection-prevention is listed in the Security category on Claude Marketplaces, alongside azure-compliance, entra-agent-id, firebase-security-rules-auditor, security-audit and cloudflare-one. It differs from those by focusing on query construction and input handling in database code.

Does sql-injection-prevention need database access or any keys?

The skill's example code reads its database host, name, user and password from environment variables, so your project needs those set for the Node.js example to connect. Its best practices also advise using least privilege database accounts.

More from aj-geddes/useful-ai-prompts

All 258

Similar to Sql Injection Prevention

More Security