go-sqlc-repo

Generate type-safe Go repository layers from SQL schemas using sqlc.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-sqlc-repo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-sqlc-repo
Source: https://github.com/saddam-eng-tech/ai-agent-skills/tree/main/go-sqlc-repo
Command: npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-sqlc-repo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of writing boilerplate repository code in Go, which is often repetitive, error-prone, and lacks compile-time safety when interacting with SQL databases. It aims to provide a robust, type-safe data access layer without the overhead of an ORM.

Core Features & Use Cases

  • SQL Schema to Repository: Generates a complete repository layer directly from your SQL schema definitions.
  • Type Safety: Ensures compile-time checks for all database interactions, reducing runtime errors.
  • Includes: sqlc.yaml configuration, SQL query files, a repository interface, a concrete pgx implementation, and a testify mock for testing.
  • Use Case: When starting a new Go microservice that requires database interaction, use this skill to quickly scaffold a production-ready, type-safe repository layer, allowing developers to focus on business logic rather than data access plumbing.

Quick Start

Use the go-sqlc-repo skill to generate a repository for a 'users' table from the provided SQL schema.

Frequently Asked Questions about go-sqlc-repo

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

FAQPage Schema
How do I generate a type-safe repository layer in Go from an SQL schema?

This skill generates a type-safe repository layer in Go from an SQL schema by automating sqlc configuration, SQL query files, and repository interfaces to eliminate repetitive boilerplate code.

What is the best way to avoid writing boilerplate database code in Go microservices?

The best way to avoid boilerplate database code in Go microservices is using sqlc to generate compile-time checked repository implementations, ensuring type safety without the overhead of an ORM.

Can I generate testify mocks for my Go repository layer using sqlc?

Yes, you can generate testify mocks for your Go repository layer. The generated output includes concrete pgx or sqlx implementations alongside testify mocks for unit testing.

Does this Go repository generator support both pgx and sqlx implementations?

Yes, this Go repository generator supports both pgx and sqlx implementations. It creates concrete database implementations from your SQL schema based on your configured preference.

How do I configure sqlc for a new Go microservice interacting with a PostgreSQL database?

To configure sqlc for a new Go microservice, this skill outputs a ready-to-use sqlc.yaml file alongside SQL query files and repository interfaces mapped directly from your provided SQL schema.