Agent skill
Logging
Standards for structured logging and observability in Golang.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/logging
Metadata
Additional technical details for this skill
- labels
-
golang logging slog zap observability
- triggers
-
{ "files": [ "go.mod", "pkg/logger/**" ], "keywords": [ "logging", "slog", "structured logging", "zap" ] }
SKILL.md
Golang Logging Standards
Priority: P1 (STANDARD)
Principles
- Structured Logging: Use JSON or structured text. Readable by machines and humans.
- Leveled Logging: Debug, Info, Warn, Error.
- Contextual: Include correlation IDs (TraceID, RequestID) in logs.
- No
log.Fatal: Avoid terminating app inside libraries. Return error instead. Onlymainshould exit.
Libraries
log/slog(Recommended): Stdlib since Go 1.21. Fast, structured, zero-dep.- Zap (
uber-go/zap): High performance, good if pre-1.21 or extreme throughput needed. - Zerolog: Zero allocation, fast JSON logger.
Guidelines
- Initialize logger at startup.
- Inject logger or use a global singleton configured at startup (pragmatic choice).
- Use
slog.Attrfor structured data.
References
- Slog Patterns
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?