ac5tin/custom-agents/go-service-scaffold
Claude Code and agent skill by ac5tin/custom-agents
- community
Checking that the SKILL.md file is still in the repository.
Scaffolds new Go microservices from scratch with a production-ready layered architecture: Fiber HTTP, Bun ORM, Unit of Work, dual-interface services, domain packages, task queues, cron workers. Use when creating a new Go project, bootstrapping a Go service, or asked to scaffold a Go API.
Install
npx vskill@latest install ac5tin/custom-agents/go-service-scaffoldSKILL.md
The same SKILL.md was published earlier as ac5tin/skills/go-service-scaffold.
Go Service Scaffold
Scaffolds a complete Go microservice following a strict layered architecture with enforced import direction, dual-interface service pattern, domain-agnostic pkg/ layer, and production-ready tooling.
Read reference/templates.md for all boilerplate file templates before generating any code.
When to Use
- User asks to create a new Go project / microservice / API
- User asks to scaffold or bootstrap a Go backend
- User wants to start a new Go service following best practices
Architecture
Workflow
Step 1: Gather Requirements
Ask the user for:
- Project name (Go module name)
- Domain entities (e.g., users, orders, products)
- Workers needed? (asynq task queue, cron, or none)
- Auth model (API key, JWT, or custom)
- Additional config env vars
Step 2: Initialize and Install Dependencies
Install latest versions of: gofiber/fiber/v2, uptrace/bun (+ pgdialect, pgdriver), golang-migrate/migrate/v4, go-playground/validator/v10, uber.org/zap, caarlos0/env/v11, google/uuid, samber/lo, golang.org/x/crypto, stretchr/testify, uber.org/mock. Add hibiken/asynq and/or robfig/cron/v3 if workers are needed.
Step 3: Scaffold Directory Structure
Step 4: Create Files
Read reference/templates.md for exact file contents, then create all files following those templates.
Critical Rules
1. pkg/ Is Domain-Agnostic
- NEVER imports
internal/ - Contains only: DB connections, logger, HTTP server boilerplate, generic utilities
- Does NOT contain: models, business logic, domain structs, handlers
2. Domain Packages Own Definitions
internal/service/{domain}/service.go— interfaces (Service+WebService), option structs, constantsinternal/service/{domain}/errors.go— domain-specific errorsinternal/service/{domain}.go— implementation struct inpackage service- Constants and option structs live in
service.goalongside interfaces (NOT in a separatetypes.go)
3. Dual-Interface Pattern
Every domain defines TWO interfaces in its domain package:
- `Service` — internal-facing, uses
model.*and option structs. Used by other services and workers. - `WebService` — HTTP-facing, accepts request DTOs, returns response DTOs. Used by handlers.
- A single struct implements BOTH.
4. Handlers Depend on WebService Only
- Handlers depend on
{domain}.WebService, never{domain}.Service - Other services depend on
{domain}.Service
5. Soft Delete
- Repository
Deletesetsdeleted_at, never hard deletes - All queries filter
WHERE deleted_at IS NULL
6. UnitOfWork with Lazy Initialization
- All repositories accessed via UnitOfWork interface
- Repository getters use nil-check lazy initialization
7. One File Per Handler Endpoint
handler.go— struct, constructor,Registermethodrouter.go— route definitions only (NOTroutes.go){action}.go— one file per endpoint (e.g.,create.go,get.go,list.go)
8. Import Order (3 groups, blank-line separated)
- Standard library
- Project-local packages (
{project_name}/...) - External packages
9. Naming Conventions
- Interfaces:
Service,Repository,WebService(noIprefix) - Impl structs:
ExtensionService(exported),extensionRepository(unexported) - Constants:
StatusDraft,StatusActive(in domain package) - Errors:
ErrEntityNotFound(in domain package) - Options:
CreateOptions,UpdateOptions(in domain package)
10. Logger Pattern
11. Max Line Length: 120 chars (golines)
12. Testing
- Black-box:
package service_test - Testify:
require.NoError,assert.Equal - Arrange / Act / Assert
- Mocks:
go.uber.org/mock(mockgen)
Verification Checklist
After scaffolding, verify:
- [ ]
grep -r "internal/" pkg/returns NO results - [ ] All service interfaces in
internal/service/{domain}/, not implementation files - [ ] Both
ServiceandWebServiceinterfaces per domain - [ ] Handlers depend on
WebService - [ ] Repository
Deleteis soft delete - [ ] UnitOfWork repository getters use lazy init
- [ ] Router files named
router.go - [ ] Each endpoint in its own file
- [ ]
make lintpasses - [ ]
make buildsucceeds
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingopencode/skill/go-service-scaffold/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ac5tin/custom-agents/go-service-scaffold)