sql-generator

Generate PostgreSQL SQL queries from database schemas and application code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

DB-driven applications often require precise SQL queries that reflect evolving schemas and codebases. This skill analyzes database schemas and application code to generate PostgreSQL-compatible SQL queries that exactly meet user requests such as retrieving specific data, updating records, or generating reports.

Core Features & Use Cases

  • Analyze schema and code to derive precise SQL for a given task.
  • Support for SELECT, INSERT, UPDATE, DELETE, and aggregate queries with proper JOINs and constraints.
  • Use Case: A developer needs a report that lists total sales by month by querying the existing schema and code structure to generate fully-formed SQL.

Quick Start

Generate a PostgreSQL query that lists all users activated in the last 30 days.

Frequently Asked Questions about sql-generator

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

FAQPage Schema
How do I generate PostgreSQL queries from my database schema and application code?

Generate PostgreSQL queries by analyzing your database schema and application code to produce SQL statements that match user requests. This approach ensures the generated queries reflect evolving schemas and enforce PostgreSQL-specific syntax with explicit column listing.

Can I generate SQL aggregate queries with JOINs across multiple PostgreSQL tables?

Yes, you can generate SQL aggregate queries with proper JOINs across multiple PostgreSQL tables. The process supports SELECT, INSERT, UPDATE, and DELETE operations, applying constraints to retrieve, update, or aggregate data for tasks like generating sales reports.

Does this SQL query generation approach work with PostgreSQL projects only?

Yes, this SQL query generation approach is designed for PostgreSQL projects specifically. It enforces PostgreSQL-specific syntax and explicit column listing, ensuring the generated queries comply with the target database system's requirements.

What is the best way to ensure generated SQL queries match my evolving database schema?

The best way to ensure generated SQL queries match an evolving schema is to derive them by analyzing both the database schema and the application code structure. This guarantees the SQL precisely satisfies the data retrieval or updating request.

How does safe query generation handle validation and error handling for PostgreSQL?

Safe query generation handles validation and error checking by enforcing PostgreSQL-specific syntax and explicit column listing. This mechanism ensures the generated SQL queries are validated against the schema and codebase before execution.

When do I need to analyze application code to generate SQL instead of writing it manually?

You need to analyze application code to generate SQL when database-driven applications require precise queries reflecting evolving schemas and codebases. This is necessary for complex tasks like generating reports that aggregate data across multiple tables.