sql-best-practices

Enforce SQL quality standards for readable, safe, and performant queries.

44|9|Updated May 7, 2026
One-click install
npx skills add https://github.com/Omar-Obando/qwen-orchestrator --skill sql-best-practices-omar-obando
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-best-practices
Source: https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/sql-best-practices
Command: npx skills add https://github.com/Omar-Obando/qwen-orchestrator --skill sql-best-practices-omar-obando

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps you avoid slow and insecure SQL by enforcing consistent query formatting, parameterization, and performance patterns like N+1 prevention and index-friendly predicates.

Core Features & Use Cases

  • SQL indentation standard: Enforces readable, clause-by-clause formatting so queries are maintainable in teams.
  • N+1 prevention patterns: Recommends eager loading via JOINs, batching with IN clauses, and aggregate subqueries to reduce query explosion.
  • Security rules: Requires parameterized queries and prevents unsafe string interpolation, while also supporting tenant/user access filtering and soft-delete conventions.
  • Performance rules: Improves query speed by encouraging explicit column selection and sargable predicates that align with indexes.

Quick Start

Use the sql-best-practices skill to review and rewrite my SQL to ensure proper indentation, avoid N+1 patterns, select explicit columns, and use parameterized queries.

Frequently Asked Questions about sql-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent N+1 query problems in my SQL database access?

To prevent N+1 query problems, implement eager loading via JOINs, batch fetching with IN clauses, or aggregate subqueries to consolidate database access and avoid query explosion.

How do I format SQL queries for team readability and maintenance?

Format SQL queries by using uppercase keywords with consistent, clause-by-clause indentation to ensure queries remain readable and maintainable across team collaborations.

What are sargable predicates and how do they improve query optimization?

Sargable predicates are search conditions written to align with database indexes, improving query optimization by enabling the database engine to efficiently utilize indexes for faster data retrieval.

How do I secure SQL queries against injection vulnerabilities?

Secure SQL queries against injection vulnerabilities by using fully parameterized queries instead of unsafe string interpolation, which safely separates code from user-supplied data.

Does query optimization require explicit column selection for soft-delete conventions?

Query optimization requires explicit column selection to avoid fetching unnecessary data, and it supports soft-delete conventions by ensuring queries properly filter records marked as deleted.