sql-guardrails

Enforce SQL parameter binding, date objects, enum normalization, and v2 API compliance.

2|1|Updated Dec 15, 2025
One-click install
npx skills add https://github.com/sgpropertyanalytics/sg-property-analytics --skill sql-guardrails
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-guardrails
Source: https://github.com/sgpropertyanalytics/sg-property-analytics/tree/main/.claude/skills/sql-guardrails
Command: npx skills add https://github.com/sgpropertyanalytics/sg-property-analytics --skill sql-guardrails

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Backend SQL and data-access guardrails are essential to prevent common mistakes when writing or modifying SQL queries, service functions, or route handlers. This guardrail helps enforce best practices that reduce bugs, security risks, and contract drift.

Core Features & Use Cases

  • Parameter style enforcement using only :param bind syntax to prevent psycopg2-style placeholders
  • Date handling with Python objects to avoid string dates and type casting issues
  • Enum normalization via contract_schema.py to ensure consistent DB values
  • Outlier filtering with COALESCE to safely ignore missing booleans
  • v2 API compliance checks to support dual-mode or camelCase responses

Quick Start

Install or enable the sql-guardrails guard before backend changes to automatically validate and enforce SQL patterns and API contracts.

Frequently Asked Questions about sql-guardrails

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

FAQPage Schema
How do I enforce safe parameter binding in backend SQL queries?

Safe parameter binding in backend SQL is enforced by using the :param bind syntax to prevent psycopg2-style placeholders and passing Python date objects to avoid type casting issues.

What is the best way to normalize enums in backend SQL service functions?

Enum normalization in backend SQL is handled via contract_schema.py to ensure consistent database values and prevent contract drift across service functions and route handlers.

How do I safely filter missing booleans in SQL without breaking route handlers?

Missing booleans in SQL are safely filtered using COALESCE-based outlier filtering, allowing route handlers to ignore missing values without triggering execution errors.

Can I use backend SQL guardrails to check v2 API compliance?

Yes, backend SQL guardrails enforce v2 API compliance checks to support dual-mode or camelCase responses, ensuring route handlers meet the required API contract.

When do I need to apply SQL guardrails during backend development?

SQL guardrails must be applied before backend changes reach production, validating all SQL queries, service functions, and route handlers to ensure compliance and prevent bugs.