sqg

Generate type-safe database access code from annotated SQL files.

41|Updated Dec 1, 2025
One-click install
npx skills add https://github.com/sqg-dev/sqg --skill sqg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqg
Source: https://github.com/sqg-dev/sqg/tree/main/skill
Command: npx skills add https://github.com/sqg-dev/sqg --skill sqg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates the manual effort and runtime errors associated with writing database access code by automatically generating type-safe wrappers from annotated SQL files.

Core Features & Use Cases

  • Type-Safe Generation: Produces strongly-typed TypeScript, Java, or Python code that maps directly to your database schema.
  • Annotation-Driven: Uses standard SQL comments like -- QUERY and -- MIGRATE to define behavior, making your SQL files the single source of truth.
  • Use Case: When building a new feature, write your SQL query in a .sql file with a -- QUERY annotation, and let the skill generate the corresponding typed function for your application, ensuring your database interactions are always type-safe.

Quick Start

Use the sqg skill to generate type-safe database access code from the queries.sql file in the current directory.

Frequently Asked Questions about sqg

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

FAQPage Schema
How do I generate type-safe database code from SQL files?

To generate type-safe database code from SQL files, you annotate your queries with standard SQL comments like -- QUERY and run the sqg skill to produce strongly-typed TypeScript, Java, or Python application interfaces.

Can I use type-safe SQL code generation with PostgreSQL and DuckDB?

Yes, type-safe SQL code generation supports cross-engine introspection for PostgreSQL, DuckDB, and SQLite, allowing you to map database schemas to strongly-typed application interfaces across these engines.

What is the best way to manage schema migrations and bulk inserts in type-safe SQL?

The best way to manage schema migrations and bulk inserts in type-safe SQL is using annotation-driven SQL files with -- MIGRATE tags, which serve as the single source of truth for generating complex workflow wrappers.

Do I need a configuration file to map database schemas to typed application interfaces?

Yes, you need a valid sqg.yaml configuration file to correctly map your database schemas to strongly-typed application interfaces during the type-safe code generation process.

Does type-safe SQL code generation work for both TypeScript and Python applications?

Yes, type-safe SQL code generation produces strongly-typed wrappers for TypeScript, Java, and Python applications, ensuring your database interactions map directly to your schema without runtime errors.