moai-lang-go

Implements Go 1.23+ applications using Fiber, Gin, GORM, and concurrency patterns.

Updated Jun 18, 2026
One-click install
npx skills add https://github.com/h102-log/pdfrag --skill moai-lang-go-h102-log
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: moai-lang-go
Source: https://github.com/h102-log/pdfrag/tree/main/.claude/skills/moai-lang-go
Command: npx skills add https://github.com/h102-log/pdfrag --skill moai-lang-go-h102-log

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Go developers building microservices, REST APIs, and CLI tools often need consistent, idiomatic patterns for web frameworks, database access, and concurrent programming. This Skill provides structured guidance and production-ready code patterns for Go 1.23+ development, reducing time spent searching documentation and avoiding common pitfalls in error handling, concurrency, and deployment. ## Core Features & Use Cases - Web Framework Patterns: Complete routing, middleware, and request-binding examples for Fiber v3, Gin, Echo, and Chi, including validation and error handling. - Database & ORM Guidance: GORM model definitions, query patterns, transactions, and raw SQL with pgx connection pooling for PostgreSQL. - Concurrency Patterns: Errgroup, worker pools, semaphores, and fan-out/fan-in implementations with context-based cancellation and timeouts. - Use Case: When building a high-performance REST API in Go, ask for a Fiber application scaffold and receive a complete structure with middleware, graceful shutdown, PostgreSQL integration, and a minimal multi-stage Dockerfile producing a 10-20MB container image. ## Quick Start Ask the assistant to create a Go REST API with Fiber and PostgreSQL including graceful shutdown and Docker deployment.

Frequently Asked Questions about moai-lang-go

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

FAQPage Schema
How do I build a REST API in Go with Fiber?▼

Create an app with fiber.New, add recover, logger, and cors middleware, then group routes under an API prefix with handlers for CRUD operations. Use c.BodyParser for request binding and c.JSON for responses, then call app.Listen on your port.

Fiber vs Gin: which Go web framework should I use?▼

Fiber offers higher throughput with its fasthttp foundation and a Prefork option, while Gin provides a mature ecosystem with standard net/http compatibility and built-in binding validation tags. Both support middleware, route groups, and graceful shutdown.

How do I handle concurrent tasks in Go with error propagation?▼

Use errgroup.WithContext to spawn goroutines that share a cancellable context and return errors. Call g.Go for each task and g.Wait to collect the first error, which automatically cancels remaining work through the derived context.

Does GORM support eager loading of associations?▼

Yes, GORM supports eager loading through Preload, which accepts association names and optional conditions. You can chain Preload calls and apply ordering or limits inside a callback function to control the loaded records.

How do I create a small Docker image for a Go application?▼

Use a multi-stage Dockerfile: build with golang:1.23-alpine using CGO_ENABLED=0 and ldflags -s -w, then copy the static binary into a scratch base image. This produces containers around 10-20MB.

Why does my Go module fail with dependency errors?▼

Module errors usually come from stale or inconsistent dependency graphs. Run go mod tidy to prune unused requirements and go mod verify to check integrity, then confirm your toolchain with go version and go env GOVERSION.