Implements consistent structured logging standards across Golang services.

Install

mkdir -p .claude/skills/logging && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2561" && unzip -o skill.zip -d .claude/skills/logging && rm skill.zip

Installs to .claude/skills/logging

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Standards for structured logging and observability in Golang. Use when adding structured logging or tracing to Go services.
123 chars✓ has a “when” trigger
Beginner

Key capabilities

  • Configure structured JSON logging
  • Implement leveled logging
  • Inject correlation IDs into logs
  • Standardize log formats

How it works

It uses structured handlers to inject request-scoped attributes and correlation IDs into logs for machine and human readability.

Inputs & outputs

You give it
Log message and attributes
You get back
Structured log entry

When to use logging

  • Add structured logging to api
  • Configure zap logger
  • Standardize log formats

About this skill

Golang Logging Standards

Priority: P1 (HIGH)

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. Only main should 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.

Workflow: Set Up Structured Logging with slog

  1. Create JSON handler at startup in main()
  2. Optionally wrap in middleware to inject request-scoped attributes
  3. Use slog.With() to add correlation IDs per request
  4. Pass logger via context or dependency injection

See slog setup and usage examples

References

Anti-Patterns

  • No fmt.Println in production: Use slog or zap for structured, leveled logging.
  • No log.Fatal in libraries: Return errors; only main() should call os.Exit.
  • No unstructured log strings: Include correlation IDs and structured fields via slog.Attr.

When not to use it

  • Using fmt.Println in production
  • Terminating applications inside libraries

Prerequisites

Go 1.21 or higher for slog

Limitations

  • Requires Go 1.21 for standard library slog
  • Libraries must return errors instead of exiting

How it compares

It enforces structured, leveled logging standards instead of unstructured print statements.

Compared to similar skills

logging side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
logging (this skill)21moNo flagsBeginner
go-logging-observability04moNo flagsIntermediate
architecture-patterns552moNo flagsAdvanced
workflow-orchestration-patterns102moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

go-logging-observability

riordanpawley

Build and review production-grade Go logging and observability with `log/slog` and OpenTelemetry. Use when adding or refactoring logs, instrumenting request paths, defining event schemas, reducing log cost/cardinality, enforcing redaction/PII policy, correlating logs with traces, or reviewing Go ser

00

architecture-patterns

wshobson

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use when architecting complex backend systems or refactoring existing applications for better maintainability.

55214

workflow-orchestration-patterns

wshobson

Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.

10117

golang-pro

sickn33

Master Go 1.21+ with modern patterns, advanced concurrency, performance optimization, and production-ready microservices. Expert in the latest Go ecosystem including generics, workspaces, and cutting-edge frameworks. Use PROACTIVELY for Go development, architecture design, or performance optimization.

1479

go-concurrency-patterns

wshobson

Master Go concurrency with goroutines, channels, sync primitives, and context. Use when building concurrent Go applications, implementing worker pools, or debugging race conditions.

782

go

grafana

Best practices for working with Go codebases. Use when writing, debugging, or exploring Go code, including reading dependency sources and documentation.

533

Search skills

Search the agent skills registry