model-queries

Build dynamic database queries with type-safe Options API helpers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

All database queries use a generated Options struct and column helpers for type-safe query building. The approach centralizes query logic and ensures consistent parameter binding across models.

Core Features & Use Cases

  • Simple lookups by ID, email, or other fields using WithCondition and WithParam.
  • Complex queries with multiple conditions, IN lists, joins, and ordered results.
  • Clear separation of query definitions in a queries.go file and enforcement of mocker context for testability.

Quick Start

Create a GetByEmail function that fetches a user by email using the Options API.

Frequently Asked Questions about model-queries

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

FAQPage Schema
How do I build type-safe database queries with dynamic filtering?

Type-safe database queries are built using an Options API with generated column helpers, applying WithCondition and WithParam to ensure consistent parameter binding and dynamic filtering.

What is the best way to centralize query logic across multiple backend models?

Centralizing query logic in a dedicated queries.go file ensures consistent parameter binding across models, using an Options struct to enforce strict mocker context for testability and safe data access.

Can I perform database joins and ordered results using the Options API?

Yes, the Options API supports complex database queries with multiple conditions, IN lists, joins, and ordered results using the WithOrder helper to manage sorting across your data models.

How do I fetch a user by email using type-safe query helpers?

You can fetch a user by email by creating a GetByEmail function that utilizes WithCondition and WithParam to execute simple lookups against the generated Columns struct for type safety.

Does this query building approach require a specific testing context?

Yes, the approach enforces strict mocker usage for testability, ensuring your backend data access layers remain isolated and verifiable when executing flexible filtering and parameterized conditions.