
Sql Injection Prevention
Covers the fundamentals of preventing SQL injection with prepared statements, parameterized queries, and input validation across multiple stacks. Includes working examples for Node.js with PostgreSQL, Python with SQLAlchemy, and Java JDBC, plus a dedicated guide on input sanitization. The do's and don'ts are straightforward: always use prepared statements, never concatenate user input into queries, whitelist dynamic values when you absolutely need them. If you're writing database code or reviewing legacy systems for vulnerabilities, this gives you the patterns to lock things down. The reference implementations are practical enough to adapt directly into your codebase.
- skills.sh installs
- 533
- GitHub stars
- 379
- last updated
- Aug 21, 2026
Install
$ npx -y skills add aj-geddes/useful-ai-prompts --skill sql-injection-prevention --agent claude-codeInstalls into .claude/skills of the current project.
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];
Sponsors
Details
- Repository
- github.com/aj-geddes/useful-ai-prompts
- Categories
- Backend & APIs, Security, AI & Agent Building, Databases
- First seen
- Jun 3, 2026
More from aj-geddes/useful-ai-prompts
All 258- Grpc Service Development532
- Gap Analysis531
- Network Debugging531
- Payment Gateway Integration529
- Progressive Web App529
- Kpi Dashboard Design528
- Microservices Architecture527
- Sql Query Optimization527
- Security Headers Configuration519
- Prometheus Monitoring516
- Frontend Testing514
- Api Error Handling513
- Interaction Design510
- Technical Debt Assessment509
- Webhook Development509
- Api Gateway Configuration508
- React Native App508
- Rate Limiting Implementation507
- Ssl Certificate Management505
- Stakeholder Communication505
- Database Migration Management504
- Test Automation Framework504
- Cicd Pipeline Setup503
- Form Validation503