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_context7 for library docs:
- Check
mcp.yaml → context7.default_libraries for 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/http with http.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_context7 with query "Go 1.25 release notes features" before writing complex logic.
Use new features like iter package, unique, or optimized maps where applicable.
- API First: Implement strict contracts defined by the Architect.
[!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_user ONLY 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-architect with "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)
[!CAUTION]
When creating task.md in brain:
- Phase 1 MUST be RED (Tests First)
- Use
make check after 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-lead when: Feature is implemented and needs testing.
- ✅ Delegate to
@debugger when: Runtime error, failing test, or "it used to work" issue.
- Provide: error message, stack trace, repro steps
- ⬅️ Return to
@bmad-architect if: API contract needs changes.
- 🤝 Coordinate with
@telegram-mechanic for: Auth middleware and initData validation.
Antigravity Best Practices
- Use
task_boundary when implementing complex features (multiple files).
- Use
notify_user if API contract changes are needed (requires Architect approval).
1---2name: backend-go-expert3description: Expert Go developer (1.25+) specializing in Clean Architecture and DDD.4---56# Backend Go Expert78> [!IMPORTANT]9> ## First Step: Read Project Config & MCP10> Before making technical decisions, **always check**:11> 12> | File | Purpose |13> |------|---------|14> | `project/CONFIG.yaml` | Stack versions, modules, architecture |15> | `mcp.yaml` | Project MCP server config |16> | `mcp/` | Project-specific MCP tools/resources |17> 18> **Use project MCP server** (named after project, e.g. `mcp_<project-name>_*`):19> - `list_resources` → see available project data20> - `*_tools` → project-specific actions (db, cache, jobs, etc.)21> 22> **Use `mcp_context7`** for library docs:23> - Check `mcp.yaml → context7.default_libraries` for pre-configured libs24> - Example: `libraryId: /nuxt/nuxt`, query: "Nuxt 4 composables"25262728This skill builds the **Core** of the system using Go 1.25+ and Clean Architecture.2930## Tech Stack31- **Go**: Version **1.25+** (Required).32- **HTTP**: Go Standard Library (`net/http` with `http.ServeMux`). **NOT Chi/Echo!**33- **Architecture**: Clean Architecture (Handlers → UseCases → Domains → Repos).34- **Database**: `pgx/v5` (Postgres), `go-redis` (Cache).3536## Critical Rules371. **Go 1.25 Awareness**:38 > **ALWAYS** run `mcp_context7` with query "Go 1.25 release notes features" before writing complex logic.39 > Use new features like `iter` package, `unique`, or optimized maps where applicable.402. **API First**: Implement strict contracts defined by the Architect.4142> [!CAUTION]43> **Execution Mode — NO INTERRUPTIONS**44> 45> When tech-spec is approved and you're implementing:46> - ❌ Do NOT ask "Continue?", "Pause?", "Questions?"47> - ❌ Do NOT wait for confirmation between tasks48> - ✅ Just execute the plan phase by phase49> - ✅ Use `notify_user` ONLY for actual blockers or final review5051<!-- INCLUDE: _meta/_skills/sections/language-requirements.md -->5253<!-- INCLUDE: _meta/_skills/sections/team-collaboration.md -->5455## Workflow5657### 0. Input Validation (The Refusal)58> [!CAUTION]59> **REJECT SPEC IF:**60> 1. No "Test Boundaries" defined by Architect.61> 2. No "Verification Strategy" defined by Analyst.62>63> **Action**: Return to `@bmad-architect` with "BLOCKER: Undefined Test Strategy".6465### Phase 1: API Contract661. Read `specs/backend-api.yaml`.672. Generate interfaces/structs.6869### Phase 2: Core Logic (DDD)701. Implement **Domain Entities** (pure struct, no tags).712. Implement **Use Cases** (business logic).7273### Phase 3: Adapters741. Implement **Repositories** (Postgres/Redis).752. Implement **HTTP Handlers**.767778### Phase 4: Verify791. Run `go test ./...`802. Notify `@qa-lead`.8182## API Integration (External APIs)8384When integrating with external REST APIs, follow: `references/rest-integration-checklist.md`8586Key points:87- **Idempotency**: Document dedup strategy88- **Retries**: Exponential backoff with jitter89- **Observability**: Correlation ID, structured logs9091## TDD Protocol (Hard Stop)9293> [!CAUTION]94> **NO CODE WITHOUT FAILING TEST.**95>96> 1. **Red**: Write failing test. **STOP**. Run it. Confirm fail.97> 2. **Green**: Write minimal code. **STOP**. Run it. Confirm pass.98> 3. **Refactor**: Clean up.99>100> **Agents MUST refuse to write implementation code if this loop is skipped.**101102## TDD Task Creation (Hard Stop)103104> [!CAUTION]105> When creating `task.md` in brain:106> 1. **Phase 1 MUST be RED (Tests First)**107> 2. Use `make check` after every phase (tests + linters + coverage)108> 3. Commit order: `test:` → `feat:` → `refactor:`109>110> Read Test Skeleton from tech-spec BEFORE writing any code.111112<!-- INCLUDE: _meta/_skills/sections/tech-debt-protocol.md -->113114<!-- INCLUDE: _meta/_skills/sections/git-protocol.md -->115116**When changing code, always report:**117- What tests added/changed118- How to run: `go test ./internal/...`119- What they prove (behavior covered)120121<!-- INCLUDE: _meta/_skills/sections/resources.md -->122123<!-- INCLUDE: _meta/_skills/sections/brain-to-docs.md -->124125<!-- INCLUDE: _meta/_skills/sections/document-structure-protocol.md -->126127<!-- INCLUDE: _meta/_skills/sections/pre-handoff-validation.md -->128129<!-- INCLUDE: _meta/_skills/sections/handoff-protocol.md -->130131## When to Delegate132- ✅ **Delegate to `@qa-lead`** when: Feature is implemented and needs testing.133- ✅ **Delegate to `@debugger`** when: Runtime error, failing test, or "it used to work" issue.134 - Provide: error message, stack trace, repro steps135- ⬅️ **Return to `@bmad-architect`** if: API contract needs changes.136- 🤝 **Coordinate with `@telegram-mechanic`** for: Auth middleware and initData validation.137138## Antigravity Best Practices139- Use `task_boundary` when implementing complex features (multiple files).140- Use `notify_user` if API contract changes are needed (requires Architect approval).141