agentleFS
vndeevndee/engineering-skills/.claude/skills/observability/SKILL.md

observability

Skill3 starsChanged 8 months agoMITView on GitHub

Use when adding logging, metrics, tracing, or error tracking to Go, Python, or React applications — structured observability from day one

  • Reads credentials

59 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use parallel-agent-orchestration, ci-cd and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • itallstartedwithaideaSkill

    parallel-agent-orchestration

    Parallel Agent Orchestration is the discipline of dispatching, coordinating, and aggregating results from multiple concurrent subagents to dramatically accelerate complex tasks.

    Also in 3 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 8 projects that use this

  • zebbernSkill

    caching

    Caching strategies — invalidation, TTL guidelines, cache keys, cache layers, and when not to cache. Use when implementing or reviewing caching logic.

    Also in 3 projects that use this

  • terrene-foundationSkill

    architecture-decisions

    Architecture decision guides for Kailash SDK including framework selection (Core SDK vs DataFlow vs Nexus vs Kaizen), runtime selection (Async vs Sync), database selection (PostgreSQL vs SQLite), node selection, and test tier selection. Use when asking about 'which framework', 'choose framework', 'which runtime', 'which database', 'which node', 'architecture decision', 'when to use', 'Core SDK vs DataFlow', 'PostgreSQL vs SQLite', 'AsyncLocalRuntime vs LocalRuntime', or 'test tier selection'.

    Also in 3 projects that use this

  • mmondoraSkill

    finops

    Cloud cost management as an architectural discipline. Unit economics, right-sizing, GCP free tier optimization, budget alerts, serverless-first. Use when making infrastructure decisions, estimating costs, or optimizing cloud spending.

    Also in 3 projects that use this

  • cryptofish7Skill

    ci-cd-pipeline

    Analyze a repo and maintain its GitHub Actions CI/CD pipeline. Detects language, tooling, test frameworks, Docker, and deploy targets, then adds or removes workflow actions to match the project's current state. Use when the user asks to "add CI/CD", "update CI", "review pipeline", "set up GitHub Actions", "audit CI", "improve CI/CD", or any request about CI/CD pipelines, GitHub Actions workflows, or continuous integration.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 42 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Core principle: If it's not logged, traced, and measured, it doesn't exist in production.

    line 12
  2. Distinctive:

    DON'T: Use string interpolation in log messages — use structured fields

    line 78
  3. Distinctive:

    Every incoming HTTP request (automatic with middleware)

    line 147
  4. Distinctive:

    Every service must expose a health endpoint that checks all dependencies:

    line 243
  5. Very specific:

    REQUIRED: Update CLAUDE.md with logging conventions and monitoring env vars (claude-md)

    line 269

“Common” is measured: kept by at least 6 in 10 of the 42 edited versions of this file we could read. “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

Overview

Structured logging, distributed tracing, metrics, and error tracking. Without observability, you're debugging in the dark.

Core principle: If it's not logged, traced, and measured, it doesn't exist in production.

Three Pillars

1. Structured Logging

Never use unstructured log messages. Always key-value pairs.

Go (slog — standard library):

import "log/slog"

// Setup (in main.go)
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
    Level: slog.LevelInfo,
}))
slog.SetDefault(logger)

// Usage
slog.Info("user created",
    "user_id", user.ID,
    "email", user.Email,
    "org_id", orgID,
)

slog.Error("failed to create user",
    "error", err,
    "email", input.Email,
)

// With request context (middleware injects request_id)
slog.InfoContext(ctx, "processing request",
    "request_id", middleware.GetRequestID(ctx),
    "method", c.Method(),
    "path", c.Path(),
)

Python (structlog):

import structlog

# Setup
structlog.configure(
    processors=[
        structlog.processors.TimeStamper(fmt="iso"),
        structlog.processors.JSONRenderer(),
    ],
)
logger = structlog.get_logger()

# Usage
logger.info("user_created", user_id=str(user.id), email=user.email)
logger.error("user_creation_failed", error=str(err), email=input.email)

# With request context (bind request_id in middleware)
logger = logger.bind(request_id=request_id)
logger.info("processing_request", method=request.method, path=request.url.path)

Logging rules:

  • DO: Log at service boundaries (incoming request, outgoing call, response)
  • DO: Log business events (user created, payment processed, invitation sent)
  • DO: Log errors with full context (what were you trying to do, what input caused it)
  • DON'T: Log sensitive data (passwords, tokens, PII)
  • DON'T: Log inside hot loops
  • DON'T: Use string interpolation in log messages — use structured fields

Log levels:

LevelWhen
ERROROperation failed, needs attention
WARNUnexpected but handled (retry succeeded, fallback used)
INFOBusiness events, request lifecycle
DEBUGDetailed debugging info (disabled in prod)

2. Distributed Tracing (OpenTelemetry)

Go:

import (
    "go.opentelemetry.io/otel"
    "go.opentelemetry.io/otel/trace"
)

// Create span for a unit of work
tracer := otel.Tracer("service-name")

func (uc *CreateUserUseCase) Execute(ctx context.Context, input CreateUserInput) (*User, error) {
    ctx, span := tracer.Start(ctx, "CreateUser")
    defer span.End()

    span.SetAttributes(
        attribute.String("user.email", input.Email),
    )

    user, err := uc.repo.Create(ctx, input)
    if err != nil {
        span.RecordError(err)
        span.SetStatus(codes.Error, err.Error())
        return nil, err
    }
    return user, nil
}

Fiber middleware:

import fiberotel "github.com/gofiber/contrib/v3/otel"
app.Use(fiberotel.Middleware())

Python (FastAPI):

from opentelemetry import trace
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor

tracer = trace.get_tracer("service-name")

# Auto-instrument FastAPI
FastAPIInstrumentor.instrument_app(app)

# Manual spans for business logic
async def create_user(self, input: CreateUserInput) -> User:
    with tracer.start_as_current_span("CreateUser") as span:
        span.set_attribute("user.email", input.email)
        try:
            return await self._repo.create(input)
        except Exception as e:
            span.record_exception(e)
            raise

What to trace:

  • Every incoming HTTP request (automatic with middleware)
  • Database queries (auto-instrumented with OTel libraries)
  • External API calls
  • Message queue publish/consume
  • Cache operations
  • Business-critical operations

3. Metrics (Prometheus)

Go:

import "github.com/prometheus/client_golang/prometheus"

var (
    httpRequestsTotal = prometheus.NewCounterVec(
        prometheus.CounterOpts{
            Name: "http_requests_total",
            Help: "Total HTTP requests",
        },
        []string{"method", "path", "status"},
    )
    httpRequestDuration = prometheus.NewHistogramVec(
        prometheus.HistogramOpts{
            Name:    "http_request_duration_seconds",
            Help:    "HTTP request duration",
            Buckets: prometheus.DefBuckets,
        },
        []string{"method", "path"},
    )
)

Key metrics to track:

MetricTypeWhat
http_requests_totalCounterRequest count by method, path, status
http_request_duration_secondsHistogramLatency distribution
db_query_duration_secondsHistogramDatabase query time
db_connections_activeGaugeConnection pool usage
business_events_totalCounterDomain events (signups, payments)
errors_totalCounterErrors by type

Expose metrics endpoint:

// Go: /metrics endpoint
import "github.com/prometheus/client_golang/prometheus/promhttp"
app.Get("/metrics", adaptor.HTTPHandler(promhttp.Handler()))

Error Tracking (Sentry)

// Go
import "github.com/getsentry/sentry-go"

sentry.Init(sentry.ClientOptions{
    Dsn:              os.Getenv("SENTRY_DSN"),
    TracesSampleRate: 0.1,
    Environment:      os.Getenv("APP_ENV"),
})

// In error handler middleware
sentry.CaptureException(err)
# Python
import sentry_sdk
from sentry_sdk.integrations.fastapi import FastApiIntegration

sentry_sdk.init(
    dsn=os.getenv("SENTRY_DSN"),
    traces_sample_rate=0.1,
    integrations=[FastApiIntegration()],
)

React:

import * as Sentry from '@sentry/react'

Sentry.init({
  dsn: import.meta.env.VITE_SENTRY_DSN,
  integrations: [Sentry.browserTracingIntegration()],
  tracesSampleRate: 0.1,
})

// Wrap app
<Sentry.ErrorBoundary fallback={<ErrorPage />}>
  <App />
</Sentry.ErrorBoundary>

Health Check Endpoint

Every service must expose a health endpoint that checks all dependencies:

// GET /health
{
    "status": "ok",          // or "degraded" or "error"
    "database": "connected",
    "redis": "connected",
    "version": "1.2.3",
    "uptime": "24h30m"
}

Observability Checklist for New Services

  • Structured JSON logging configured (slog/structlog)
  • Request ID middleware (generated + propagated)
  • OpenTelemetry tracing with auto-instrumentation
  • Prometheus metrics endpoint (/metrics)
  • Sentry error tracking initialized
  • Health check endpoint with dependency checks
  • Log levels appropriate (INFO in prod, DEBUG in dev)
  • No sensitive data in logs/traces/metrics

Chains

  • REQUIRED: Update CLAUDE.md with logging conventions and monitoring env vars (claude-md)
  • Setup during: go-scaffold or py-scaffold
  • Debug with: debug skill uses these signals for investigation

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.