logging-conventions

Enforce structured slog-based logging conventions for Go applications.

3|5|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/ronniegeraghty/hyoka --skill logging-conventions-ronniegeraghty
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-conventions
Source: https://github.com/ronniegeraghty/hyoka/tree/main/.agents/skills/logging-conventions
Command: npx skills add https://github.com/ronniegeraghty/hyoka --skill logging-conventions-ronniegeraghty

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go applications often suffer from inconsistent, hard-to-follow logs. This skill defines a standardized approach to using the built-in slog package for structured, machine-readable logs that improve observability and debugging.

Core Features & Use Cases

  • Standardized log messages with structured key-value pairs (e.g., "level", "message", "duration_s", "request_id").
  • Clear guidance on log levels, initialization, and avoiding common anti-patterns.
  • Helpful examples for common workflows such as request tracing, error handling, and lifecycle events in Go services.

Quick Start

Initialize slog in your Go application and start emitting structured, key-value log entries.

Frequently Asked Questions about logging-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured logging in Go using slog?

Structured logging in Go using slog is implemented by initializing the slog package and emitting log entries with consistent key-value pairs like level, message, and request_id to ensure machine-readable, diagnosable application logs.

What are common slog anti-patterns to avoid in Go services?

Common slog anti-patterns to avoid in Go services include inconsistent log levels, unstructured text messages, and unsafe initialization patterns that break observability and prevent reliable tracing across modules.

Does this structured logging convention work for existing Go services?

Yes, this structured logging convention works for existing Go services by applying documented slog conventions that enforce consistent attributes and safe initialization patterns across environments without requiring external dependencies.

What's the best way to standardize log levels and attributes across Go modules?

The best way to standardize log levels and attributes across Go modules is to enforce structured slog conventions, utilizing recommended log levels and consistent key-value pairs like duration_s and request_id for improved observability.

How do I trace requests and handle errors with slog in Go?

Request tracing and error handling with slog in Go are achieved by emitting structured key-value log entries that capture request_id and lifecycle events, ensuring consistent and diagnosable logs across modules and environments.