rc-sql

Reviews SQL queries, indexes, and schema design with read-only database access.

19|1|Updated Jun 27, 2026
One-click install
npx skills add https://github.com/rodolfochicone/rc-project --skill rc-sql-rodolfochicone
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rc-sql
Source: https://github.com/rodolfochicone/rc-project/tree/main/skills/promoted/rc-sql
Command: npx skills add https://github.com/rodolfochicone/rc-project --skill rc-sql-rodolfochicone

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Slow queries, missing indexes, N+1 patterns, and weak schema constraints are hard to diagnose without a disciplined process. This Skill provides structured, task-routed guides for relational database work so every recommendation is grounded in the real execution plan and actual schema rather than guesswork. ## Core Features & Use Cases - Query Optimization: Diagnose slow queries with EXPLAIN (ANALYZE, BUFFERS), fix Seq Scans with the right B-tree, composite, partial, or covering index, enforce sargable predicates, eliminate N+1 with joins or batched IN queries, and replace high-OFFSET pagination with keyset cursors. - Schema Design: Apply normalization, correct types (numeric for money, timestamptz for time), constraints as executable documentation (FK, UNIQUE, CHECK, NOT NULL), surrogate vs natural key selection, and consistent naming conventions. - Safety-First Execution: Read-only by default — only SELECT and EXPLAIN run; all writes, DDL, and migrations (CONCURRENTLY indexes, batched backfills, expand/contract) are delivered as ready-to-run recommendations requiring explicit user authorization. - Use Case: A developer notices an endpoint slowing down as order volume grows. The Skill reads the real schema and indexes, runs EXPLAIN ANALYZE on the query, identifies a missing composite index and an N+1 loop in the ORM code, and delivers the corrected query plus a CREATE INDEX CONCURRENTLY statement for the user to approve. ## Quick Start Ask the assistant to review a slow SQL query or database schema using the rc-sql skill, providing the query text and any available DDL or table definitions.

Frequently Asked Questions about rc-sql

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

FAQPage Schema
How do I optimize a slow SQL query with indexes?▼

Start by running EXPLAIN (ANALYZE, BUFFERS) on the real query to see the execution plan. Look for Seq Scans on large tables with selective filters, then add a B-tree, composite, partial, or covering index matching the WHERE and JOIN columns before rewriting the query.

How do I fix N+1 query problems in my application?▼

Detect N+1 by spotting repeated identical queries with varying parameters in logs, often from ORM loops. Replace them with a single JOIN or one batched query using WHERE id = ANY($1::int[]) so N queries become one.

Does this skill work with databases other than PostgreSQL?▼

The examples use PostgreSQL syntax such as EXPLAIN (ANALYZE, BUFFERS) and CREATE INDEX CONCURRENTLY, but the underlying principles of indexing, sargability, normalization, and transaction safety apply to any relational database.

Can the skill execute migrations or write queries directly?▼

No. Access is read-only by default: only SELECT and EXPLAIN are executed. All INSERT, UPDATE, DELETE, and DDL statements are delivered as ready-to-run recommendations that require explicit user authorization before execution.

Why is OFFSET pagination slow on large tables?▼

OFFSET forces the database to scan and discard all preceding rows, so cost grows with page number. Keyset (cursor) pagination uses WHERE id > $last_id ORDER BY id LIMIT n, which uses the index and keeps cost constant per page.

What happens if there is no live database connection available?▼

The skill falls back to static analysis of the schema, DDL, and queries found in the repository. It explicitly reports that the real EXPLAIN plan and index verification remain pending.