hoangnguyen0403/agent-skills-standard/golang-logging
Claude Code and agent skill by hoangnguyen0403/agent-skills-standard
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Standards for structured logging and observability in Golang. Use when adding structured logging or tracing to Go services.
Install
npx vskill@latest install hoangnguyen0403/agent-skills-standard/golang-loggingSKILL.md
The same SKILL.md was published earlier as hoangnguyen0403/agent-skills-standard/golang-logging.
Golang Logging Standards
Priority: P1 (HIGH)
Principles
- Structured Logging: Use JSON or structured key-value attributes. Machine-readable and filterable.
- One Log Owner: Each request, job, or CLI invocation has exactly one boundary that logs its failures—usually where the error is handled or translated. Choose it by responsibility, not a fixed layer. Deeper helpers wrap and return without logging.
- Typed Context Keys: Use a private typed key (
type ctxKey string) and an accessor for both storing and reading request-scoped values. Never mix string and typed keys for the same value. - Context-Aware Logging: Pass
ctxtoInfoContext/ErrorContext/WarnContext. Context alone does not add attributes unless the handler is built to read them; attach correlation IDs withslog.Withfrom the typed accessor. - Business Traceability vs PII Redaction: Include only approved non-sensitive identifiers (e.g. tenant ID, organization code, order number). Strictly redact credentials, API tokens, passwords, and sensitive PII. Free-form and joined error text is not automatically scrubbed.
- Leveled Logging: Debug, Info, Warn, Error.
- No `log.Fatal`: Avoid terminating apps inside libraries. Return errors instead; only
main()should handle process exit.
Libraries
- `log/slog` (Recommended Stdlib): Stdlib since Go 1.21. Fast, structured, zero-dep.
- Zap (`uber-go/zap`): Production-grade structured logger for high-throughput microservices.
- Zerolog: Zero allocation, fast JSON logger.
Workflow: Set Up Structured Logging
- Initialize structured logger at startup in
main()with standard JSON output. - Inject request correlation IDs (TraceID, RequestID) via middleware using typed context keys.
- Pass logger via context (
logger.FromContext(ctx)) or constructor injection. - Log once at the chosen owner; wrap errors in helpers without intermediate logging.
See slog setup and usage examples
Anti-Patterns
- No Double-Logging: Do not log an error in a repository/database helper AND log it again at the owner.
- No log-and-rethrow into another logger: If a boundary logs, do not pass the same failure to a layer that logs it again.
- No fmt.Println in production: Use structured, leveled loggers.
- No Untyped Context Keys: Avoid
context.WithValue(ctx, "logger", l)andctx.Value("trace_id")with raw string keys. - No Secrets in Logs: Redact bearer tokens, passwords, and sensitive personal info.
- No log.Fatal in libraries: Return errors; only
main()should callos.Exit.
References
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 repositoryCheckingskills/golang/golang-logging/SKILL.md
Popularity
- Repository stars
- 539
- Repository forks
- 158
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 10 Aug 2026, 3 months ago.
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/hoangnguyen0403/agent-skills-standard/golang-logging)