一键导入
backend-architecture-go-hexagonal-grpc
Hexagonal Architecture (Ports and Adapters), gRPC, Uber Fx, and Redis caching for ultra-low latency Go backends.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Hexagonal Architecture (Ports and Adapters), gRPC, Uber Fx, and Redis caching for ultra-low latency Go backends.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Syncs Telegram supergroup topics into local task files and GitHub issues, using embedded Python scripts for deterministic JSON state management. Preserves raw bilingual messages verbatim, injects refactored prompts, and correlates codebase context.
100% Jetpack Compose, MVI (UDF), Hilt, and SQLDelight for token-efficient, zero-hallucination Android development.
NestJS, Prisma ORM, Vertical Slice Architecture, and Strict TypeScript for zero-hallucination backend development.
Expo Managed Workflow, Expo Router, NativeWind, and Strict TypeScript for zero-hallucination cross-platform apps.
Automatically generates decentralized task files based on manager instructions.
Idiomatic Go, Clean Architecture, and Gin routing best practices
| name | backend-architecture-go-hexagonal-grpc |
| description | Hexagonal Architecture (Ports and Adapters), gRPC, Uber Fx, and Redis caching for ultra-low latency Go backends. |
.proto files as the absolute contract. The AI uses these to perfectly align client/server interactions.pgx or ent. Reflection-heavy ORMs like GORM cause unpredictable runtime behaviors that confuse AI debugging workflows.When scaffolding a high-performance backend (such as a sub-50ms latency Caller ID system), enforce the following strict rules to maximize AI reasoning and eliminate runtime magic:
.proto) as the single source of truth for all API contracts. Generate Go interfaces from proto files.go-redis client for all read-heavy, low-latency lookups (e.g., spam number checks).pgx for raw, high-performance database interactions, or ent (by Facebook) if a strongly-typed ORM is required. Avoid reflection-heavy ORMs like GORM.project-root/
├── cmd/
│ └── server/
│ └── main.go # Entry point, initializes Uber Fx application
├── internal/
│ ├── core/
│ │ ├── domain/ # Pure Go structs (e.g., PhoneNumber.go)
│ │ └── ports/ # Interfaces (e.g., CacheRepository, CallService)
│ ├── application/ # Use cases implementing inbound ports
│ │ └── call_service.go
│ ├── adapters/
│ │ ├── inbound/
│ │ │ └── grpc/ # gRPC handlers implementing proto generated interfaces
│ │ └── outbound/
│ │ ├── postgres/ # PostgreSQL repository implementations
│ │ └── redis/ # Redis cache repository implementations
│ └── di/ # Uber Fx module providers
├── api/
│ └── proto/ # .proto definition files
├── pkg/ # Shared libraries (logging, metrics)
├── go.mod
└── Makefile # Protoc generation and build commands
| Artifact | Convention | Example |
|---|---|---|
| Interfaces (Ports) | Nouns ending in er | CallReader, CacheWriter |
| Structs | PascalCase | CallScreeningRequest |
| Files | snake_case.go | call_service.go |
| DI Providers | Prefix with New | NewPostgresRepository |
Use this for configuring complex structures (like external client adapters) cleanly:
type Server struct { ... }
type Option func(*Server)
func WithTimeout(t time.Duration) Option {
return func(s *Server) { s.timeout = t }
}
Never panic. Return errors explicitly. Wrap errors with context using %w so the AI agent reading the logs can trace the exact failure path:
return fmt.Errorf("redis cache miss for number %s: %w", number, err)
| Layer | Test Type | Framework / Tools |
|---|---|---|
| Application | Unit | testing + testify/assert + mockery (for ports) |
| Adapters | Integration | testcontainers-go (spin up real Redis/PG in Docker) |
internal/core/ports using mockery.[]struct) for all core business logic.