All skills
boristane avatar

/logging-best-practices

@8aa14dd
by Boris Taneboristane/agent-skills119 stars
10

Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics

Use this Skill: https://skilld.dev/gh/boristane/agent-skills/logging-best-practices

This session only. Nothing lands on disk.

README.md

≈526 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Logging Best Practices Skill

A skill for AI coding assistants to apply logging best practices when writing or reviewing code.

Overview

This skill teaches the wide events pattern (also known as canonical log lines) - emit a single, context-rich event per request per service instead of scattered log statements.

Key Concepts

  • Wide Events: One comprehensive event per request, emitted at completion
  • High Cardinality: Support fields with millions of unique values (user_id, request_id)
  • High Dimensionality: Include many fields (20+) per event
  • Business Context: Always include user subscription, cart value, feature flags
  • Environment Context: Always include commit hash, version, region, instance ID
  • Single Logger: One logger instance configured at startup, used everywhere
  • Middleware Pattern: Handle logging infrastructure in middleware, business context in handlers

Structure

logging-best-practices/
├── SKILL.md              # Agent instructions
├── README.md             # This file
├── metadata.json         # Version and references
└── rules/
    ├── wide-events.md    # Core pattern (CRITICAL)
    ├── context.md        # Cardinality, business & environment context (CRITICAL)
    ├── structure.md      # Single logger, middleware, JSON format (HIGH)
    └── pitfalls.md       # Common mistakes (MEDIUM)

Rules

  1. Wide Events (CRITICAL) - One event per request, emit in finally block, request ID correlation
  2. Context (CRITICAL) - High cardinality, dimensionality, business context, environment characteristics
  3. Structure (HIGH) - Single logger, middleware pattern, JSON format, consistent schema
  4. Pitfalls (MEDIUM) - Scattered logs, unknown unknowns, missing request correlation

Reference

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides clear and effective guidelines for implementing structured logging using the 'wide events' (canonical log lines) pattern. It covers high-cardinality context, environment metadata, and the use of middleware for consistent logging infrastructure. No security issues were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    3/7 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 8aa14dd. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
metadata
{
  "author": "boristane",
  "version": "1.0.0"
}

README badge

README badge for boristane/agent-skills