Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
boristane avatar

Logging Best Practices

  • 4k installs
  • 104 repo stars
  • Updated January 21, 2026
  • boristane/agent-skills

logging-best-practices is an agent skill for implement wide-event canonical log lines for powerful debugging and analytics observability.

About

The logging-best-practices skill Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics. This skill provides guidelines for implementing effective logging in applications. It focuses on wide events (also called canonical log lines) - a pattern where you emit a single, context-rich event per request per service, enabling powerful debugging and analytics. Apply these guidelines when: - Writing or reviewing logging code - Adding console.log, logger.info, or similar - Designing logging strategy for new services - Setting up logging infrastructure Emit one context-rich event per request per service. Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion. ```typescript const wideEvent: Record<string, unknown = { method: 'POST', path: '/checkout', requestId: c.get('requestId'), timestamp: new Date().toISOString(), }; typescript const wideEvent: Record<string, unknown = { method: 'POST', path: '/checkout', requestId: c.get('requestId'), timestamp: new Date().toISOString(), }; try { const user = await getUser(c.get('userId')); wideEvent.user = { id: user.i.

  • Writing or reviewing logging code
  • Adding console.log, logger.info, or similar
  • Designing logging strategy for new services
  • Setting up logging infrastructure
  • Use JSON format consistently

Logging Best Practices by the numbers

  • 3,983 all-time installs (skills.sh)
  • +108 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #39 of 1,453 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Security screen: CRITICAL risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

logging-best-practices capabilities & compatibility

Capabilities
writing or reviewing logging code · adding console.log, logger.info, or similar · designing logging strategy for new services · setting up logging infrastructure · use json format consistently
Use cases
debugging · devops
From the docs

What logging-best-practices says it does

Emit **one context-rich event per request per service**. Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion.
SKILL.md
const wideEvent: Record<string, unknown> = {
SKILL.md
const user = await getUser(c.get('userId'));
SKILL.md
npx skills add https://github.com/boristane/agent-skills --skill logging-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4k
repo stars104
Security audit2 / 3 scanners passed
Last updatedJanuary 21, 2026
Repositoryboristane/agent-skills

How do I implement wide-event canonical log lines for powerful debugging and analytics observability with documented agent guidance?

Implement wide-event canonical log lines for powerful debugging and analytics observability.

Who is it for?

Developers who need devops & ci/cd help during operate work.

Skip if: Skip when the task falls outside DevOps & CI/CD scope described in SKILL.md.

When should I use this skill?

Implement wide-event canonical log lines for powerful debugging and analytics observability.

What you get

Completed devops & ci/cd workflow aligned with SKILL.md steps and validation.

  • Canonical log line schema
  • Middleware logging setup
  • High-cardinality field definitions

By the numbers

  • Writing or reviewing logging code
  • Adding console.log, logger.info, or similar
  • Designing logging strategy for new services

Files

SKILL.mdMarkdownGitHub ↗

Logging Best Practices Skill

Version: 1.0.0

Purpose

This skill provides guidelines for implementing effective logging in applications. It focuses on wide events (also called canonical log lines) - a pattern where you emit a single, context-rich event per request per service, enabling powerful debugging and analytics.

When to Apply

Apply these guidelines when:

  • Writing or reviewing logging code
  • Adding console.log, logger.info, or similar
  • Designing logging strategy for new services
  • Setting up logging infrastructure

Core Principles

1. Wide Events (CRITICAL)

Emit one context-rich event per request per service. Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion.

const wideEvent: Record<string, unknown> = {
  method: 'POST',
  path: '/checkout',
  requestId: c.get('requestId'),
  timestamp: new Date().toISOString(),
};

try {
  const user = await getUser(c.get('userId'));
  wideEvent.user = { id: user.id, subscription: user.subscription };

  const cart = await getCart(user.id);
  wideEvent.cart = { total_cents: cart.total, item_count: cart.items.length };

  wideEvent.status_code = 200;
  wideEvent.outcome = 'success';
  return c.json({ success: true });
} catch (error) {
  wideEvent.status_code = 500;
  wideEvent.outcome = 'error';
  wideEvent.error = { message: error.message, type: error.name };
  throw error;
} finally {
  wideEvent.duration_ms = Date.now() - startTime;
  logger.info(wideEvent);
}

2. High Cardinality & Dimensionality (CRITICAL)

Include fields with high cardinality (user IDs, request IDs - millions of unique values) and high dimensionality (many fields per event). This enables querying by specific users and answering questions you haven't anticipated yet.

3. Business Context (CRITICAL)

Always include business context: user subscription tier, cart value, feature flags, account age. The goal is to know "a premium customer couldn't complete a $2,499 purchase" not just "checkout failed."

4. Environment Characteristics (CRITICAL)

Include environment and deployment info in every event: commit hash, service version, region, instance ID. This enables correlating issues with deployments and identifying region-specific problems.

5. Single Logger (HIGH)

Use one logger instance configured at startup and import it everywhere. This ensures consistent formatting and automatic environment context.

6. Middleware Pattern (HIGH)

Use middleware to handle wide event infrastructure (timing, status, environment, emission). Handlers should only add business context.

7. Structure & Consistency (HIGH)

  • Use JSON format consistently
  • Maintain consistent field names across services
  • Simplify to two log levels: info and error
  • Never log unstructured strings

Anti-Patterns to Avoid

1. Scattered logs: Multiple console.log() calls per request 2. Multiple loggers: Different logger instances in different files 3. Missing environment context: No commit hash or deployment info 4. Missing business context: Logging technical details without user/business data 5. Unstructured strings: console.log('something happened') instead of structured data 6. Inconsistent schemas: Different field names across services

Guidelines

Wide Events (rules/wide-events.md)

  • Emit one wide event per service hop
  • Include all relevant context
  • Connect events with request ID
  • Emit at request completion in finally block

Context (rules/context.md)

  • Support high cardinality fields (user_id, request_id)
  • Include high dimensionality (many fields)
  • Always include business context
  • Always include environment characteristics (commit_hash, version, region)

Structure (rules/structure.md)

  • Use a single logger throughout the codebase
  • Use middleware for consistent wide events
  • Use JSON format
  • Maintain consistent schema
  • Simplify to info and error levels
  • Never log unstructured strings

Common Pitfalls (rules/pitfalls.md)

  • Avoid multiple log lines per request
  • Design for unknown unknowns
  • Always propagate request IDs across services

References:

Related skills

Forks & variants (1)

Logging Best Practices has 1 known copy in the catalog totaling 46 installs. They canonicalize to this original listing.

How it compares

logging-best-practices is an agent skill for implement wide-event canonical log lines for powerful debugging and analytics observability, not a generic alternative.

FAQ

Who is logging-best-practices for?

Developers using DevOps & CI/CD workflows with agent-guided SKILL.md steps.

When should I use logging-best-practices?

Implement wide-event canonical log lines for powerful debugging and analytics observability.

Is logging-best-practices safe to install?

Review the Security Audits panel on this page before installing in production.

DevOps & CI/CDmonitoring

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.