dabydat/alpha-omega/nestjs-logging

Claude Code and agent skill by dabydat/alpha-omega

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Structured logging patterns for NestJS microservices. Covers correlation ID propagation, Winston configuration, log levels per environment, HTTP middleware vs TCP interceptor patterns, and centralized logging in common_core. Use when setting up logging infrastructure, debugging request flows, or implementing distributed tracing.

Install

npx vskill@latest install dabydat/alpha-omega/nestjs-logging

SKILL.md

Structured Logging for NestJS Microservices

Production logging is not console.log with extra metadata. It is correlation IDs that stitch across services, log levels that adapt per environment, and transports that go beyond stdout.

Production patterns for: HTTP gateways, TCP microservices, event handlers, job processors, and distributed tracing

Agent collaboration: Backend Dev (logger implementation), DevOps (centralized log aggregation), QA Engineer (log-based debugging)


Core Principle: Why Structured Logging

See references/why-structured-logging.md for the INCORRECT vs CORRECT comparison.


Correlation ID Pattern

See references/correlation-id.md for the full implementation and flow.

Flow:

  1. Incoming request has x-correlation-id header? Use it. Otherwise generate UUID.
  2. Attach to request context (request object for HTTP, message payload for TCP).
  3. Ensure all log calls include it automatically via AsyncLocalStorage.
  4. Propagate to outgoing requests (HTTP headers, message headers).

Structured Logging with Winston

See references/winston-config.md for full configuration.

Key components: See references/logger-port.md for the LoggerPort interface.

Transport decision:

EnvironmentTransportFormat
DevelopmentConsolePretty-printed, colorized
ProductionJSON (file or remote)Structured JSON for search/analysis

Transport-Specific Patterns

HTTP Gateway (REST Controllers)
  • Middleware (before handler): see references/http-middleware.md.
  • Interceptor (after handler): see references/http-interceptor.md.
TCP Microservice

See references/tcp-interceptor.md.


Exception Filter Logging

See references/exception-filter-logging.md (log context before responding).


Module Registration

See references/module-registration.md (APP_INTERCEPTOR/APP_FILTER/LOGGER_PORT).


Log Levels

See references/log-levels.md for detailed environment configuration.

EnvironmentLevelSamplingFormat
developmentdebugnonepretty
staginginfo50%json
productionwarn10%json

Quality Checklist

Correlation ID
[ ] HTTP requests have x-correlation-id header (generated or passed)
[ ] TCP messages have correlationId field in payload
[ ] All logs include correlationId via AsyncLocalStorage
[ ] Responses include correlationId header
Logger
[ ] LoggerPort injected, not Winston directly
[ ] Production uses JSON format
[ ] Development uses pretty print
[ ] Sensitive fields masked
Interceptors
[ ] LoggingInterceptor logs method, URL, status, duration
[ ] CorrelationIdInterceptor sets ID before handler runs
Exception Filter
[ ] All exception types handled
[ ] Logs include stack trace for 5xx
[ ] Logs include correlationId
Module Registration
[ ] LoggerModule global
[ ] APP_INTERCEPTOR for interceptors
[ ] APP_FILTER for exception filter

Anti-Patterns

See references/anti-patterns.md for the three ❌ examples (console.log, logging after throw, sensitive data).


Related Skills

  • nestjs-guards-filters - Exception filters for HTTP error handling
  • nestjs-event-driven-architecture - Event logging patterns
  • nestjs-cqrs-commands - Command and query logging
  • nestjs-ddd-patterns - Domain event logging

Security

  • Security scanPassed, 98 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/dabydat/alpha-omega/nestjs-logging/badge)](https://verified-skill.com/skills/dabydat/alpha-omega/nestjs-logging)

Something wrong with this skill or its page? Tell us.