agentleFS
harrissohail6harrissohail6/claude-code-config/skills/logging-monitoring/SKILL.md

logging-monitoring

Skill1 starsChanged 11 months agoMITView on GitHub

Logging and monitoring best practices. Auto-activates when adding logs, metrics, or observability.

  • Reads credentials
Files
SKILL.md

Logging & Monitoring

Structured Logging

import pino from 'pino';

const logger = pino({
  level: process.env.LOG_LEVEL || 'info',
});

// Good: Structured with context
logger.info({
  event: 'user_created',
  userId: user.id,
  email: user.email,
  duration: 150
}, 'User created successfully');

// Bad: Unstructured
console.log('User ' + user.id + ' created');

Log Levels

LevelUse For
ERRORErrors requiring immediate attention
WARNUnexpected but handled situations
INFOImportant business events
DEBUGDetailed debugging info
TRACEVery detailed tracing

What to Log

DO Log

  • Request/response (without sensitive data)
  • Business events (user signup, purchase)
  • Errors with stack traces
  • Performance metrics
  • Security events (login, failed auth)

DON'T Log

  • Passwords or tokens
  • PII without consent
  • Credit card numbers
  • Health check endpoints (too noisy)

Request Tracing

// Add request ID to all logs
app.use((req, res, next) => {
  req.requestId = uuid();
  logger.child({ requestId: req.requestId });
  next();
});

Metrics to Track

  • Request rate (requests/second)
  • Error rate (errors/total)
  • Response time (p50, p95, p99)
  • CPU/Memory usage
  • Database query time
  • Queue depth

Alerting Rules

  • Error rate > 1% for 5 minutes
  • Response time p99 > 2s
  • CPU > 80% for 10 minutes
  • Disk space < 20%

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.