Logging Best Practices
Structured logging guidance covering log levels, request context, PII redaction, and production logging rules.
- CCM score
- 52 of 100
- skills.sh installs
- 419
- GitHub stars
- 257
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers log level selection, from DEBUG through FATAL, with which levels stay on in production
- Includes Winston JSON logger setup, AsyncLocalStorage request context, and a PII sanitizer for password, SSN, card, and token fields
- Enforces rules such as no console.log in production, no logging inside tight loops, and no passwords or tokens in logs
- Designed for Node.js services that need correlation IDs, with Python, Go, ELK, CloudWatch, and OpenTelemetry covered in a reference file
Install
$ npx -y skills add secondsky/claude-skills --skill logging-best-practices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Logging Best Practices
Implement secure, structured logging with proper levels and context.
Log Levels
| Level | Use For | Production |
|---|---|---|
| DEBUG | Detailed debugging | Off |
| INFO | Normal operations | On |
| WARN | Potential issues | On |
| ERROR | Errors with recovery | On |
| FATAL | Critical failures | On |
Structured Logging (Winston)
const winston = require('winston');
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || 'info',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.json()
),
defaultMeta: { service: 'api-service' },
transports: [
new winston.transports.Console(),
new winston.transports.File({ filename: 'error.log', level: 'error' })
]
});
// Usage
logger.info('User logged in', { userId: '123', ip: '192.168.1.1' });
logger.error('Payment failed', { error: err.message, orderId: '456' });
Request Context
const { AsyncLocalStorage } = require('async_hooks');
const storage = new AsyncLocalStorage();
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Backend & APIs, DevOps & Cloud, Debugging
- First seen
- Jun 3, 2026
Questions
What does the logging-best-practices skill help with?
The logging-best-practices skill helps an agent implement structured logging with proper levels, request context, PII sanitization and centralized log aggregation. It also covers log bloat, PII exposure and missing context errors. The skill includes Winston examples and references for Python structlog, Go zap, ELK Stack, AWS CloudWatch and OpenTelemetry tracing.
How do I install the logging-best-practices skill?
Run npx -y skills add secondsky/claude-skills --skill logging-best-practices -y in your project. Once installed, the agent can apply the skill's guidance on log levels, correlation IDs and redaction of sensitive fields when you add logging to an application.
Which skills lead the Backend & APIs category that logging-best-practices belongs to?
In the Backend & APIs category, logging-best-practices sits alongside entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. It focuses on application logging, log management integration and distributed tracing rather than database or authentication setup.
Does the logging-best-practices skill cover PII handling in logs?
Yes, the skill includes a PII sanitization pattern that redacts fields such as password, ssn, creditCard and token. It also partially masks email addresses before they are written to logs, and its guidance says to sanitize all PII before logging.
More from secondsky/claude-skills
All 116- Bun Hot Reloading418
- Claude Hook Writer418
- Claude Code Bash Patterns417
- Plan Interview417
- Bun React Ssr416
- Bun Shell416
- Bun Websocket Server414
- Bun Redis412
- Ml Pipeline Automation412
- Nuxt Core411
- Nuxt Data411
- Bun Ffi409
- Bun Nuxt409
- Bun Jest Migration408
- Bun Macros407
- Multi Ai Consultant407
- Model Deployment405
- Graphql Implementation403
- Jest Generator402
- Thesys Generative Ui393
- Nuxt Studio391
- Maz Ui390
- Woocommerce Code Review389
- Woocommerce Backend Dev388
Similar to Logging Best Practices
More Backend & APIsapplication-loggingaj-geddes/useful-ai-prompts504 installsStructured logging guide for Node.js, Python, Express, Flask, and ELK pipelines with clear do and don't rules.
python-observabilitywshobson/agents12.5K installsStructured logging, metrics, and tracing patterns for Python services with correlation IDs and log-level guidance.
observability-and-instrumentationaddyosmani/agent-skills76K installsInstrumentation guidance that makes production behavior visible and diagnosable, covering logs, metrics, and traces.
python-logging-best-practicesterrylica/cc-skills411 installsPython logging guide covering loguru, structlog, orjson, and a zero-dependency JSONL telemetry pattern with rotation.
go-loggingcxuu/golang-skills1.2K installsStructured Go logging guide for slog, log levels, request-scoped context, and what to keep out of logs.