log-designing

Design structured JSON application logs with semantic error codes and correlation IDs.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/swat9013/dotfiles --skill log-designing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: log-designing
Source: https://github.com/swat9013/dotfiles/tree/main/.claude-global/skills/log-designing
Command: npx skills add https://github.com/swat9013/dotfiles --skill log-designing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps teams and developers design logging that is both machine-readable and actionable, reducing time-to-diagnosis and enabling automated incident triage by prescribing format, content, and CLI conventions.

Core Features & Use Cases

  • Seven design principles: structured-first JSON output, semantic error codes, complete reproduction data, correlation IDs, stdout/stderr separation, staged verbosity, and signal-to-noise optimization.
  • CLI patterns & verbosity: clear rules for when to write to stdout vs stderr, standard -v/-vv/-vvv/-q mappings, and environment variable fallbacks like LOG_LEVEL or RUST_LOG.
  • Error code design & required fields: category-based E4xx/E5xx/E6xx template and mandatory error log fields (error_code, message, input, expected/actual, stack_trace, context, correlation_id, suggestions).
  • Libraries & rollout: recommended libraries per language (Python structlog, Node Pino, Go slog, Rust tracing) and a phased adoption flow from quick JSON adoption to OpenTelemetry integration.

Quick Start

Generate a concise logging design checklist that enforces JSON structured logs, semantic error codes with E4xx–E6xx categories, correlation IDs, stdout/stderr separation, and staged verbosity flags.

Frequently Asked Questions about log-designing

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

FAQPage Schema
How do I design structured application logs for automated incident triage?

Design structured application logs by enforcing JSON output, semantic E4xx–E6xx error codes, correlation IDs, stdout/stderr separation, and staged verbosity flags to enable efficient debugging and automated incident triage.

What should be included in structured error logs for better observability?

Structured error logs should include mandatory fields: error_code, message, input, expected/actual, stack_trace, context, correlation_id, and suggestions to ensure reproducibility and actionable observability across microservices.

How do I separate stdout and stderr for CLI tool logging?

Separate stdout and stderr in CLI logging by writing standard operational output to stdout and routing diagnostic or error messages to stderr, utilizing verbosity flags like -v/-vv/-vvv/-q or environment variable fallbacks such as LOG_LEVEL.

Can I use correlation IDs for distributed system logging across microservices?

Use correlation IDs for distributed system logging to trace requests across microservices. Propagating correlation IDs in structured JSON logs enables efficient error diagnosis and tracking across complex distributed systems.

What are the best libraries for implementing structured logging?

Recommended libraries for structured logging include Python structlog, Node Pino, Go slog, and Rust tracing, which support JSON output and staged verbosity to optimize signal-to-noise ratio in application logs.

How do I implement semantic error codes in application logs?

Implement semantic error codes in application logs using category-based templates like E4xx, E5xx, and E6xx to classify errors semantically, enabling automated incident triage and faster error diagnosis in microservices.