Agent skill
golang-mastery-skill
Principal/Senior-level Go (Golang) playbook for architecture, idiomatic code, concurrency, testing, performance, reliability, security, observability, and production readiness. Use when: designing services/APIs/CLIs, doing large refactors, running code reviews, debugging races/leaks, tuning performance, hardening security, and shipping to production.
Install this agent skill to your Project
npx add-skill https://github.com/mOdrA40/claude-codex-skills-directory/tree/main/backend-skills/golang-mastery-skill
SKILL.md
Golang Mastery (Senior → Principal)
Operate
- Start by confirming: goal, scope, constraints (Go version, platform, deps), non-functional requirements (latency/throughput/SLO), and “done”.
- Prefer small, end-to-end changes with tests; keep diffs easy to review (unless the user asks otherwise).
- Stdlib-first and “boring” solutions by default; add dependencies only when constraints justify them.
- Explain tradeoffs briefly; keep output actionable (commands, file paths, checklists).
The goal is not “it works locally”, but “it survives production”: clear boundaries, observable behavior, secure defaults, and low ops cost.
Default Go Standards
- Keep packages cohesive; avoid “util” grab-bags; name packages by responsibility, not type.
- Export only what must be used externally; keep APIs minimal and stable.
- Use
context.Contextfor cancellation/timeouts at boundaries; passctxas first arg. - Return errors, do not log-and-return the same error; wrap with
%wfor context. - Avoid global state; prefer dependency injection via constructors and interfaces.
- Avoid premature interfaces; introduce interfaces at the consumer boundary.
- Concurrency: avoid shared mutable state; prefer channels for coordination, mutexes for invariants; always handle cancellation and shutdown.
“Bad vs Good” (common production pitfalls)
// ❌ BAD: log-and-return (double logging), no useful context
if err != nil {
slog.Error("create user failed", "err", err)
return err
}
// ✅ GOOD: log once at the boundary; wrap error with context
if err != nil {
return fmt.Errorf("create user: %w", err)
}
Workflow (Feature / Refactor / Bug)
- Reproduce or specify behavior (tests first if feasible).
- Sketch design: public API, package boundaries, data shapes, failure modes, concurrency model.
- Implement smallest slice end-to-end.
- Add/adjust tests and benchmarks (when performance-sensitive).
- Validate: formatting, vet, tests, race (when relevant).
- Review for production readiness: config, logging, metrics, timeouts, retries, shutdown.
Validation Commands
- Run
gofmt -w (go list -f '{{.Dir}}' ./...)(PowerShell:gofmt -w @(go list -f '{{.Dir}}' ./...)) and ensure no diffs remain. - Run
go test ./.... - Run
go test -race ./...for concurrent code or servers (where supported). - Run
go test -run TestName -count=1 ./pathto avoid cached results when debugging. - Run
go test -bench . -benchmem ./...for hotspots. - If available, run
golangci-lint run(orgolangci-lint run --fast-onlyduring local iteration). - If available, run
govulncheck ./...(orgovulncheck -test ./...) before release.
If you want PowerShell entrypoints:
- sanity:
scripts/go_sanity.ps1 - security/vuln:
scripts/go_security.ps1
Project Structure & Dependencies
See references/project-structure.md for pragmatic layouts by project size, dependency direction guidance, and package naming heuristics.
Tooling (Up-to-date defaults)
See references/tooling.md for a safe baseline linter set, handling false positives, and configuration patterns.
Advanced Topics (Production)
Use these when the project demands “senior+” rigor (many sections include ❌/✅ patterns):
- Arsitektur & boundaries: references/architecture.md
- Principal playbook (casebook + decision tree): references/principal-playbook.md
- Coding standards (review-required): references/coding-standards.md
- Anti-patterns & bug traps: references/anti-patterns.md
- Concurrency (race/leak/backpressure): references/concurrency.md
- Errors & taxonomy: references/errors.md
- HTTP API & status codes: references/http-api.md
- gRPC (contracts, deadlines, streaming, retries): references/grpc.md
- Frameworks (Gin/Fiber/Beego): references/frameworks.md
- Database & queries: references/database.md
- Migrations and rollbacks (deploy-safe schema change): references/migrations-and-rollbacks.md
- Query engineering (Postgres/SQLC): references/query-engineering.md
- Auth (sessions/JWT/OAuth2): references/auth.md
- Multi-tenant systems (isolation, quotas, blast radius): references/multi-tenant-systems.md
- Outbound HTTP & SSRF hardening: references/outbound-http.md
- Idempotency & outbox: references/idempotency-outbox.md
- Security: references/security.md
- Reliability (timeouts, retries, backpressure): references/reliability.md
- Observability (OTel, correlation): references/observability.md
- Incident runbooks (triage, rollback, blast-radius control): references/incident-runbooks.md
- Log/trace correlation: references/log-correlation.md
- OTel bootstrap: references/otel-bootstrap.md
- Performance (pprof/trace/allocs): references/performance.md
- Testing advanced: references/testing-advanced.md
- Distributed systems: references/distributed-systems.md
- Examples (real-world skeleton): references/examples.md
- Patterns (DI/options/circuit-breaker): references/patterns.md
- Snippets (copy/paste-safe): references/snippets.md
Service/HTTP Defaults
- Set timeouts: server
ReadHeaderTimeout, clientTimeout/transport timeouts; avoid unbounded requests. - Always implement graceful shutdown: close listeners, stop accepting, drain, cancel contexts, waitgroups.
- Prefer structured logs; include request IDs; avoid logging secrets/PII.
- Add health endpoints (
/healthz,/readyz) and basic metrics hooks.
Docker & Release Defaults
See references/docker.md for secure, reproducible Docker patterns (multi-stage builds, non-root, no latest, health checks).
Data & Persistence Defaults
- Validate inputs at the boundary; normalize early.
- Make error taxonomy explicit (not found, conflict, invalid, unavailable).
- Prefer migrations and explicit schemas; keep transactional boundaries clear.
- Keep domain logic independent of transport (HTTP/GRPC/CLI) where feasible.
Debugging & Performance
- Use
pprofand benchmarks for performance claims; measure before/after. - Watch allocations; prefer
strings.Builder,bytes.Buffer, preallocation when proven necessary. - Avoid reflection-heavy paths in hot loops unless unavoidable.
Security Checklist (Minimum)
- Validate and bound untrusted input (size, depth, time).
- Use
crypto/randfor security tokens; never roll your own crypto. - Store secrets in env/secret managers; never log secrets.
- Prefer least privilege and explicit allowlists for network/file operations.
Library Selection (Practical)
See references/libraries.md for a conservative shortlist (stdlib-first) plus config/env decoding examples.
Code Review Checklist
See references/checklists.md and references/code-review.md for PR checklists (API, concurrency, testing, ops).
Snippets
See references/snippets.md for copy/paste-safe patterns (graceful shutdown, context plumbing, worker pools).
Scripts
scripts/go_sanity.ps1- runsgofmt,go test,go vet, optional-race, andgolangci-lintif installed.scripts/go_security.ps1- runsgovulncheck+ quick hardening checks (and optionalgosec/staticcheckif installed).scripts/init_project.py- bootstraps a clean Go project skeleton (optional).
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
nuxt-tanstack-mastery
Panduan senior/lead developer 20 tahun pengalaman untuk Vue.js 3 + Nuxt 3 + TanStack Query development. Gunakan skill ini ketika: (1) Membuat project Nuxt 3 baru dengan arsitektur production-ready, (2) Integrasi TanStack Query untuk data fetching, (3) Debugging Vue/Nuxt yang kompleks, (4) Review code untuk clean code compliance, (5) Optimisasi performa aplikasi Vue/Nuxt, (6) Setup folder structure yang scalable, (7) Mencari library terpercaya untuk Vue ecosystem, (8) Menghindari common pitfalls dan bugs, (9) Implementasi state management patterns, (10) Security hardening aplikasi Nuxt. Trigger keywords: vue, vuejs, nuxt, nuxtjs, tanstack, vue-query, composition api, pinia, vueuse, vue router, clean code vue, debugging vue, folder structure nuxt.
solidjs-solidstart-expert
Expert-level SolidJS and SolidStart development skill with 20+ years senior/lead engineer mindset. Comprehensive guidance for building production-ready, scalable web applications with fine-grained reactivity. Use when Claude needs to: (1) Create new SolidJS/SolidStart projects, (2) Implement TanStack Query/Router/Table/Form integration, (3) Build reactive components with signals/stores/resources, (4) Handle SSR/SSG/streaming with SolidStart, (5) Implement authentication and API routes, (6) Optimize bundle size and performance, (7) Debug reactivity issues and memory leaks, (8) Structure large-scale applications, (9) Implement type-safe patterns with TypeScript, (10) Handle error boundaries and suspense, (11) Build accessible UI components, (12) Deploy to Vercel/Netlify/Cloudflare. Triggers: "solid", "solidjs", "solidstart", "createSignal", "createStore", "createResource", "tanstack solid", "vinxi", "fine-grained reactivity".
react-tanstack-senior
Expertise senior/lead React developer 20 tahun dengan TanStack ecosystem (Query, Router, Table, Form, Start). Gunakan skill ini ketika: (1) Membuat aplikasi React dengan TanStack libraries, (2) Review/refactor kode React untuk clean code, (3) Debugging React/TanStack issues, (4) Setup project structure yang maintainable, (5) Optimasi performa React apps, (6) Memilih library yang tepat untuk use case tertentu, (7) Mencegah common bugs dan memory leaks, (8) Implementasi best practices KISS dan less is more. Trigger keywords: React, TanStack, React Query, TanStack Router, TanStack Table, TanStack Form, TanStack Start, Vinxi, clean code, refactor, performance, debugging.
clickhouse-principal-engineer
Principal/Senior-level ClickHouse playbook for analytical schema design, partitioning, ingestion, query performance, replication, storage strategy, and operating large-scale columnar systems. Use when: designing OLAP workloads, reviewing MergeTree layout, tuning analytical queries, building event analytics platforms, or operating ClickHouse in production.
mysql-principal-engineer
Principal/Senior-level MySQL playbook for schema design, indexing, transactions, replication, operational reliability, online migrations, and production workload tuning. Use when: designing relational systems, reviewing query/index strategy, operating MySQL fleets, debugging contention or replication lag, or hardening MySQL-backed applications.
mongodb-principal-engineer
Principal/Senior-level MongoDB playbook for document modeling, indexing, replication, sharding, query design, observability, and production reliability. Use when: designing document schemas, reviewing aggregation/query performance, operating replicas/shards, or hardening MongoDB-backed systems.
Didn't find tool you were looking for?