go-hexagonal-grpc

Scaffolds Go backends using hexagonal architecture, gRPC contracts, Uber Fx, and Redis caching.

6|Updated May 18, 2026
One-click install
npx skills add https://github.com/mokhtarabadi/cognitive-lead-hq --skill go-hexagonal-grpc-mokhtarabadi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: go-hexagonal-grpc
Source: https://github.com/mokhtarabadi/cognitive-lead-hq/tree/main/skill-templates/go-hexagonal-grpc
Command: npx skills add https://github.com/mokhtarabadi/cognitive-lead-hq --skill go-hexagonal-grpc-mokhtarabadi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building low-latency Go backends often leads to tangled dependencies, runtime DI failures, and inconsistent API contracts. This Skill enforces a strict hexagonal architecture with compile-time dependency injection and proto-first contracts so backend services stay decoupled, testable, and predictable. ## Core Features & Use Cases - Hexagonal Architecture Enforcement: Separates domain logic from adapters (gRPC, PostgreSQL, Redis) with ports defined as interfaces in the core layer. - gRPC-First Contracts: Uses .proto files as the single source of truth, generated with buf and validated with protovalidate. - Compile-Time DI & Caching: Wires dependencies with Uber Fx or Google Wire and implements Redis caching via go-redis for low-latency lookups. - Use Case: Scaffold a sub-50ms latency caller ID service where spam number checks hit Redis, PostgreSQL stores records via pgx, and all APIs are defined in proto files. ## Quick Start Ask the AI to scaffold a new Go backend service using hexagonal architecture with gRPC, Uber Fx, PostgreSQL, and Redis following this skill's structure.

Frequently Asked Questions about go-hexagonal-grpc

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

FAQPage Schema
How do I structure a Go microservice with hexagonal architecture?▼

Place pure domain structs and port interfaces in internal/core, implement use cases in internal/application, and put gRPC, PostgreSQL, and Redis implementations in internal/adapters. The domain layer must have zero dependencies on external libraries.

Should I use Uber Fx or Google Wire for dependency injection in Go?▼

Both provide explicit dependency declaration with compile-time or startup feedback. This skill recommends Uber Fx with module providers in internal/di, prefixing constructor functions with New, such as NewPostgresRepository.

pgx vs GORM: which database library for Go backends?▼

Use pgx for raw high-performance PostgreSQL access or ent for a strongly-typed ORM. Avoid reflection-heavy ORMs like GORM because they cause unpredictable runtime behavior that complicates debugging.

How do I test hexagonal architecture Go services?▼

Write table-driven unit tests for application logic using testify and mockery-generated mocks for port interfaces. For adapters, use testcontainers-go to spin up real Redis and PostgreSQL instances in Docker for integration tests.

How should time be handled in Go gRPC services?▼

Store all time.Time fields in UTC and inject a Clock interface via Uber Fx instead of calling time.Now() directly. Use google.protobuf.Timestamp in proto files and epoch milliseconds as int64 in Redis cache values.