agentleFS
Vimalk0703Vimalk0703/shipworthy/skills/architecture/observability-by-default/SKILL.md

observability-by-default

Skill6 starsChanged 8 months agoMITView on GitHub

Structured logging, request tracing, health checks, error tracking, and key metrics. Every service should be observable from day one.

  • Installs packages

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you can't see it, you can't fix it.

    line 11
  2. Distinctive:

    Before writing any code that logs anything, install a structured logger:

    line 16
  3. Very specific:

    Python: use stdlib logging with JSON formatter, or structlog

    line 18
  4. Very specific:

    Go: use slog (stdlib) or zerolog

    line 19
  5. Distinctive:

    Every service MUST expose:

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Observability by Default

Principle

If you can't see it, you can't fix it. Every service should be observable from the first commit, not bolted on after the first outage.

Structured Logging

First Step: Install a Logger

Before writing any code that logs anything, install a structured logger:

  • Node.js: npm install pino (or pino-http for Express/Fastify)
  • Python: use stdlib logging with JSON formatter, or structlog
  • Go: use slog (stdlib) or zerolog

NEVER use console.log for any purpose — not even "Server running on port 3000." Replace every console.log with logger.info(). This is non-negotiable because console.log is unstructured, has no levels, and cannot be collected by log aggregation tools.

// WRONG — even for startup
console.log(`Server running on port ${PORT}`);

// RIGHT
import pino from 'pino';
const logger = pino();
logger.info({ port: PORT }, 'Server started');

Rules

  • JSON format — not free-text strings
  • Correlation IDs — every request gets a unique ID, propagated through all log entries
  • Log levels used correctly:
    • error: something failed that shouldn't have (action needed)
    • warn: something unexpected but handled (investigate if frequent)
    • info: significant business events (user created, order placed)
    • debug: detailed diagnostic info (disabled in production)
  • Never log: passwords, tokens, PII, credit card numbers, full request bodies with sensitive fields

Pattern

logger.info('User created', {
  correlationId: req.id,
  userId: user.id,
  email: user.email, // only if non-sensitive
  duration: Date.now() - start
});

Health Check Endpoints

Every service MUST expose:

  • GET /health — returns 200 if service is running
  • GET /health/ready — returns 200 if service can handle traffic (DB connected, dependencies available)

Key Metrics (The Four Golden Signals)

  1. Latency — how long requests take (p50, p95, p99)
  2. Traffic — requests per second
  3. Errors — error rate (5xx responses / total responses)
  4. Saturation — how full your resources are (CPU, memory, connections)

Error Tracking

  • Capture unhandled exceptions with context (request, user, stack trace)
  • Group errors by type to identify patterns
  • Alert on new error types and error rate spikes

Request Tracing

  • Assign a unique ID to every inbound request
  • Pass it through all internal service calls
  • Include it in all log entries and error reports
  • Return it in response headers for client-side debugging: X-Request-Id

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.