sql-query

Enforce parameterized, index-friendly T-SQL and Oracle SQL query composition.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/CloudyWing/ai-dotfiles --skill sql-query-cloudywing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-query
Source: https://github.com/CloudyWing/ai-dotfiles/tree/main/skills/sql-query
Command: npx skills add https://github.com/CloudyWing/ai-dotfiles --skill sql-query-cloudywing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents SQL injection, avoids common performance pitfalls, and enforces readable, maintainable query style across SQL Server (T-SQL) and Oracle SQL so application and reporting queries are secure and performant.

Core Features & Use Cases

  • Injection Prevention: Emphasizes parameterized queries and safe dynamic SQL patterns to eliminate string concatenation vulnerabilities.
  • Index-Friendly Patterns: Advises avoiding functions on indexed columns, preventing implicit type conversions, and preferring range predicates to preserve index usage.
  • Readability & Correctness: Provides formatting, aliasing, explicit column selection, pagination, NULL handling, and bulk operation recommendations for production-ready queries.
  • Use Case: Review and refactor application queries and reporting SQL to improve performance and eliminate injection risks prior to deployment.

Quick Start

Generate a parameterized, index-friendly T-SQL query that selects explicit columns for orders between @StartDate and @EndDate with proper pagination and NULL-safe comparisons.

Frequently Asked Questions about sql-query

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

FAQPage Schema
How do I write parameterized SQL queries to prevent SQL injection in T-SQL and Oracle?

To prevent SQL injection in T-SQL and Oracle SQL, you must use parameterized queries and avoid string concatenation for dynamic SQL. This approach separates query logic from user data inputs, effectively eliminating injection vulnerabilities and ensuring secure application reporting contexts.

Why does applying a function on an indexed column cause SQL query performance regressions?

Applying a function on an indexed column causes SQL query performance regressions because it prevents the database optimizer from using the index. To maintain index-friendly patterns, use range predicates and avoid implicit type conversions in your T-SQL and Oracle queries.

What is the best way to implement modern SQL pagination for T-SQL and Oracle reporting queries?

The best way to implement modern SQL pagination is to use explicit column lists and modern pagination techniques like OFFSET-FETCH in T-SQL or equivalent row limiting in Oracle SQL. This ensures readable, maintainable, and performant application queries without scanning unnecessary rows.

How do I handle NULL values safely when writing explicit column lists in SQL Server and Oracle?

To handle NULL values safely in SQL Server and Oracle, you must use correct NULL handling and NULL-safe comparisons within your explicit column lists. This prevents missing data and unexpected logic errors during application and reporting query execution.

Can I use this approach to review and refactor existing application queries for SQL Server and Oracle?

Yes, you can review and refactor existing application queries for SQL Server and Oracle SQL. The approach enforces readable formatting, index-friendly patterns, and safe dynamic SQL practices to eliminate injection risks and improve performance prior to deployment.