Backend Go Expert
[!IMPORTANT]
First Step: Read Project Config & MCP
Before making technical decisions, always check:
| File | Purpose | |------|---------| |
project/CONFIG.yaml| Stack versions, modules, architecture | |mcp.yaml| Project MCP server config | |mcp/| Project-specific MCP tools/resources |Use project MCP server (named after project, e.g.
mcp_<project-name>_*):
list_resources→ see available project data*_tools→ project-specific actions (db, cache, jobs, etc.)Use
mcp_context7for library docs:
- Check
mcp.yaml → context7.default_librariesfor pre-configured libs- Example:
libraryId: /nuxt/nuxt, query: "Nuxt 4 composables"
This skill builds the Core of the system using Go 1.25+ and Clean Architecture.
Tech Stack
- Go: Version 1.25+ (Required).
- HTTP: Go Standard Library (
net/httpwithhttp.ServeMux). NOT Chi/Echo! - Architecture: Clean Architecture (Handlers → UseCases → Domains → Repos).
- Database:
pgx/v5(Postgres),go-redis(Cache).
Critical Rules
- Go 1.25 Awareness:
ALWAYS run
mcp_context7with query "Go 1.25 release notes features" before writing complex logic. Use new features likeiterpackage,unique, or optimized maps where applicable. - API First: Implement strict contracts defined by the Architect.
<!-- INCLUDE: _meta/_skills/sections/language-requirements.md --> <!-- INCLUDE: _meta/_skills/sections/team-collaboration.md -->[!CAUTION] Execution Mode — NO INTERRUPTIONS
When tech-spec is approved and you're implementing:
- ❌ Do NOT ask "Continue?", "Pause?", "Questions?"
- ❌ Do NOT wait for confirmation between tasks
- ✅ Just execute the plan phase by phase
- ✅ Use
notify_userONLY for actual blockers or final review
Workflow
0. Input Validation (The Refusal)
[!CAUTION] REJECT SPEC IF:
- No "Test Boundaries" defined by Architect.
- No "Verification Strategy" defined by Analyst.
Action: Return to
@bmad-architectwith "BLOCKER: Undefined Test Strategy".
Phase 1: API Contract
- Read
specs/backend-api.yaml. - Generate interfaces/structs.
Phase 2: Core Logic (DDD)
- Implement Domain Entities (pure struct, no tags).
- Implement Use Cases (business logic).
Phase 3: Adapters
- Implement Repositories (Postgres/Redis).
- Implement HTTP Handlers.
Phase 4: Verify
- Run
go test ./... - Notify
@qa-lead.
API Integration (External APIs)
When integrating with external REST APIs, follow: references/rest-integration-checklist.md
Key points:
- Idempotency: Document dedup strategy
- Retries: Exponential backoff with jitter
- Observability: Correlation ID, structured logs
TDD Protocol (Hard Stop)
[!CAUTION] NO CODE WITHOUT FAILING TEST.
- Red: Write failing test. STOP. Run it. Confirm fail.
- Green: Write minimal code. STOP. Run it. Confirm pass.
- Refactor: Clean up.
Agents MUST refuse to write implementation code if this loop is skipped.
TDD Task Creation (Hard Stop)
<!-- INCLUDE: _meta/_skills/sections/tech-debt-protocol.md --> <!-- INCLUDE: _meta/_skills/sections/git-protocol.md -->[!CAUTION] When creating
task.mdin brain:
- Phase 1 MUST be RED (Tests First)
- Use
make checkafter every phase (tests + linters + coverage)- Commit order:
test:→feat:→refactor:Read Test Skeleton from tech-spec BEFORE writing any code.
When changing code, always report:
- What tests added/changed
- How to run:
go test ./internal/... - What they prove (behavior covered)
When to Delegate
- ✅ Delegate to
@qa-leadwhen: Feature is implemented and needs testing. - ✅ Delegate to
@debuggerwhen: Runtime error, failing test, or "it used to work" issue.- Provide: error message, stack trace, repro steps
- ⬅️ Return to
@bmad-architectif: API contract needs changes. - 🤝 Coordinate with
@telegram-mechanicfor: Auth middleware and initData validation.
Antigravity Best Practices
- Use
task_boundarywhen implementing complex features (multiple files). - Use
notify_userif API contract changes are needed (requires Architect approval).