query-go

Implements read-only Go query use cases using the Handler[I,O] primitive without UnitOfWork.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill query-go-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-go
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/query/go
Command: npx skills add https://github.com/gabriellst/codm --skill query-go-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Backend developers need a consistent pattern for writing read-only query use cases in Go that respect the polyglot ownership boundary, avoid unnecessary transactions, and never leak domain entities into API responses. ## Core Features & Use Cases - Query Handler Pattern: Implements the same types.Handler[I,O] interface as write use cases, but reads from repositories with plain ctx and no UnitOfWork or DomainEventRepository. - Ownership Boundary Enforcement: Ensures UI-shaped BFF queries (cross-context joins for frontend screens) stay in api-typescript, while Go handles only ctx-local reads like GetTranscodingJobStatus or ListPendingJobs. - Output Mapping & Pagination: Maps entities to primitive DTO fields with json/example/format tags, RFC3339 timestamps, and default page sizes for list queries. - Use Case: A worker needs to check whether a transcoding job finished before re-queuing it — implement a GetTranscodingJobStatus query handler that reads via the repository and returns a flat DTO. ## Quick Start Ask the AI to scaffold a Go query use case such as ListChannels with input validation, repository reads, paginated output DTOs, and fx wiring following this pattern.

Frequently Asked Questions about query-go

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

FAQPage Schema
How do I write a read-only query use case in Go with DDD?

Implement the same Handler[I,O] interface as write use cases, but inject only a repository and call it with the plain ctx from Execute. Skip UnitOfWork and DomainEventRepository entirely, then map the entity to a primitive output struct.

Where should BFF or UI-shaped queries live in a polyglot Go and TypeScript backend?

UI-shaped cross-context queries like GetVideoFeed or SearchVideos belong in api-typescript under src/ui/, not api-go. Go query use cases are restricted to ctx-local reads for workers, schedulers, and internal endpoints.

Should a Go query handler use a transaction or UnitOfWork?

No. Query handlers pass the plain ctx from Execute directly to repository calls without uow.Execute. The only exception is when composed inside a parent's uow.Execute closure, where the received ctx already carries the transaction.

How do I handle pagination defaults in a Go list query?

Check whether the input Limit is zero at the start of Execute and assign a default page size such as 20 before calling the repository. This prevents unbounded result sets when callers omit the limit.

Why should Go query handlers not return domain entities?

Returning domain entities exposes internal types through the API boundary. Instead, map fields to primitives in the output struct: ID.String() for UUIDs, time.RFC3339 for timestamps, and string(entity.Status) for enums, with json and example tags.