verify-sql-safety

Detect unsafe SQL patterns and enforce LIKE escaping, N+1, and RBAC joins.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/junnv93/equipment_management_system --skill verify-sql-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: verify-sql-safety
Source: https://github.com/junnv93/equipment_management_system/tree/main/.claude/skills/verify-sql-safety
Command: npx skills add https://github.com/junnv93/equipment_management_system --skill verify-sql-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The SQL safety verification process identifies unsafe SQL patterns and promotes consistent, secure query practices across backend services, improving data integrity and security.

Core Features & Use Cases

  • LIKE escaping enforcement for user input in SQL queries.
  • Detection of N+1 query patterns and promotion of JOIN/batch loading strategies.
  • RBAC-aware inner-join enforcement to prevent scope bypass and ensure proper access control.
  • Use case: After adding or updating search or list endpoints, run the verifier to catch unsafe LIKE usage and inefficient queries.

Quick Start

Run the SQL safety verifier after modifying backend search or list APIs to ensure LIKE escaping, N+1 detection, and RBAC enforcement.

Frequently Asked Questions about verify-sql-safety

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

FAQPage Schema
How do I enforce safe SQL usage in backend search endpoints?

To enforce safe SQL usage in backend search endpoints, you need to verify LIKE escaping for user input, detect N+1 query patterns, and ensure RBAC-compliant inner joins. This process applies to search or list endpoints building dynamic queries.

What is LIKE escaping and why is it needed for SQL queries?

LIKE escaping for SQL queries is the process of sanitizing user input to prevent unintended wildcard matching or injection. It uses SSOT like-escape utilities, such as likeContains and safeIlike, to ensure consistent and secure search operations across backend services.

How do I detect N+1 query patterns in dynamic backend queries?

Detecting N+1 query patterns in dynamic backend queries involves analyzing service-level query structures to identify inefficient loops and promoting JOIN or batch loading strategies. Proper COUNT(DISTINCT) handling in fan-out joins is also validated to prevent performance bottlenecks.

Does this SQL safety verification support RBAC-compliant inner joins?

Yes, this SQL safety verification supports RBAC-compliant inner joins by enforcing them to prevent scope bypass and ensure proper access control. It validates query structures to guarantee that data access is properly restricted according to Role-Based Access Control policies.

How do I validate safe ilike usage after modifying backend APIs?

To validate safe ilike usage after modifying backend APIs, run a SQL safety verifier to check for consistent use of SSOT like-escape utilities. It catches unsafe LIKE usage and inefficient queries, ensuring secure query practices across your updated search or list endpoints.

What are the limitations of using like-escape utilities for query safety?

A limitation of using like-escape utilities for query safety is the dependency on the project's common utilities like like-escape.ts. You must ensure consistent use of these SSOT utilities across all modules, as bypassing them in dynamic queries can leave search endpoints vulnerable to unsafe SQL patterns.