go-repository

Generate Go repository port interfaces and GORM implementations with CRUD, queries, pagination, and transactions.

Updated Jan 4, 2026
One-click install
npx skills add https://github.com/cristiano-pacheco/ai-tools --skill go-repository
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-repository
Source: https://github.com/cristiano-pacheco/ai-tools/tree/main/skills/go-repository
Command: npx skills add https://github.com/cristiano-pacheco/ai-tools --skill go-repository

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the creation of Go repository interfaces and GORM implementations, adhering to modular architecture conventions and reducing boilerplate code for data access layers.

Core Features & Use Cases

  • Boilerplate Reduction: Generates standard CRUD operations, custom queries, and transaction handling code.
  • Architectural Consistency: Enforces the two-file pattern (port interface and repository implementation) for maintainability.
  • Use Case: When building a new feature that requires storing and retrieving user data, use this Skill to quickly scaffold the necessary repository code, ensuring it integrates seamlessly with your existing GORM models and database layer.

Quick Start

Generate the repository code for a 'Product' entity within the 'inventory' module.

Frequently Asked Questions about go-repository

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

FAQPage Schema
How do I generate a Go repository pattern with GORM for my data access layer?

To generate a Go repository pattern with GORM, you scaffold port interfaces and GORM implementations following a two-file modular architecture pattern. This produces standard CRUD operations, custom queries, pagination, and transaction handling for your data access layer.

What is the two-file pattern for Go repository implementations and when do I need it?

The two-file pattern for Go repository implementations separates port interfaces from GORM implementations to enforce modular architecture consistency. You need this pattern when building features that require storing and retrieving data, ensuring maintainable data access layers.

Can I use this to scaffold repository code for custom queries and pagination in Go?

Yes, you can scaffold repository code for custom queries and pagination in Go. The generated GORM implementations include standard CRUD operations, custom query support, pagination, and transaction handling specifically for modular architecture data access layers.

Does this approach support transaction handling for GORM database interactions in Go?

Yes, this approach supports transaction handling for GORM database interactions in Go. The generated repository implementations include transaction management alongside CRUD operations and custom queries, utilizing GORM for database interactions and Bricks for error handling and tracing.

What's the best way to reduce boilerplate code for Go data access layers using GORM?

The best way to reduce boilerplate code for Go data access layers using GORM is automating the creation of repository interfaces and implementations. This enforces modular architecture conventions by generating a two-file pattern for standard CRUD operations and custom queries.

Why does my Go repository need a separate port interface and GORM implementation?

Your Go repository needs a separate port interface and GORM implementation to adhere to modular architecture conventions. This two-file pattern reduces boilerplate while maintaining architectural consistency, separating data access contracts from their GORM database implementations.