set-up-observability
Skill7 starsChanged 16 days agoMITView on GitHub
Use when a backend service should emit traces, metrics and trace-correlated logs. Wires app-side OpenTelemetry - SDK started before app code, HTTP and DB auto-instrumentation, use-case spans, RED metrics, OTEL_* env only, flush on shutdown (Hono, Go, FastAPI).
- Reads credentials
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- VelimirMueller/ai-development-skillsword for word, first seen Oct 25, 2026
Other versions1 project uses a version of this.
Word for word · 1
- VelimirMueller/ai-development-skills★ 7100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository156 other files it gives its agents.
- skills/swift/swiftui-design-principles/AGENTS.mdAGENTS.md
- skills/swift/ios-code-audit/CLAUDE.mdCLAUDE.md
- skills/swift/swift-focusengine-pro/llms.txtllms.txt
- build-llm-seamSkill
- build-mcp-serverSkill
- build-rag-pipelineSkill
- secure-llm-featuresSkill
- set-up-llm-evalsSkill
- build-nextjs-backendSkill
- build-supabase-edge-functionSkill
- configure-backend-testsSkill
- design-http-apiSkill
- harden-backendSkill
- scaffold-fastapi-serviceSkill
- scaffold-go-serviceSkill
- scaffold-hono-serviceSkill
- secure-supabase-rlsSkill
- set-up-backend-authSkill
- set-up-background-jobsSkill
- set-up-databaseSkill
- set-up-nextjs-supabase-authSkill
- set-up-supabaseSkill
- build-cliSkill
- release-cliSkill
- set-up-dev-toolchainSkill
- audit-securitySkill
- audit-toolchainSkill
- extend-skillsetSkill
- promote-releaseSkill
- set-up-stack-profileSkill
- write-commit-messagesSkill
- write-pull-requestsSkill
- analyze-complexitySkill
- apply-algorithmsSkill
- apply-design-patternsSkill
- apply-design-principlesSkill
- apply-solidSkill
- choose-data-structureSkill
- debug-systematicallySkill
- enforce-dependency-ruleSkill
- refactor-safelySkill
- slice-and-estimateSkill
- write-clean-testsSkill
- write-readable-codeSkill
- clean-frontend-scaffoldingSkill
- configure-accessibilitySkill
- configure-analyticsSkill
- configure-ciSkill
- configure-error-trackingSkill
- configure-lintingSkill
- configure-test-stackSkill
- configure-typescriptSkill
- create-moduleSkill
- optimize-performanceSkill
- scaffold-frontend-projectSkill
- set-up-authSkill
- set-up-design-systemSkill
- set-up-document-headSkill
- set-up-error-boundariesSkill
- set-up-feature-flagsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Read the profile first; detect only what it leaves open (stack-profile.md).
- Distinctive: line 27
No telemetry module and no OTel dependencies: full setup, steps 3 to 7.
- Distinctive: line 50
Use the profile's package manager.
- Distinctive: line 54
Create from otel-tracks.md, skipping files that exist:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Set Up Observability
Rules and rationale: otel-patterns.md. Code per track: otel-tracks.md. One seam, one exporter: observability.md. Trace-correlated logs: logging-contract.md. Seam paths: service-layout.md. Env keys: config.md.
Bootstrap path: observability.md shows src/instrumentation.ts as an example; the backend layout below wins — src/platform/telemetry.ts (TS), internal/platform/telemetry/telemetry.go (Go), src/svc/platform/telemetry.py (Python).
1. Audit (change nothing)
cat .claude/stack-profile.md ~/.claude/stack-profile.md 2>/dev/null # observability.otel, observability.backend, backend.track
grep -rnE "opentelemetry" package.json go.mod pyproject.toml 2>/dev/null
grep -rnE "console\.(log|error|warn)|print\(" --include=*.ts --include=*.go --include=*.py src internal cmd 2>/dev/null | head
grep -n "OTEL_" .env.example 2>/dev/null
ls src/platform/telemetry.ts internal/platform/telemetry src/svc/platform/telemetry.py 2>/dev/nullRead the profile first; detect only what it leaves open (stack-profile.md).
2. Decide
observability.otel: false: stop. Keeprequest_idlogging per the logging contract's "When to deviate" (generate a request id and log it asrequest_id). No OTel SDK.- No telemetry module and no OTel dependencies: full setup, steps 3 to 7.
- A telemetry module exists but misses auto-instrumentation, route templates, trace fields or shutdown flush: apply the deltas from otel-tracks.md in place. Do not rewrite what works.
- Everything present and step 7 passes: report "already in place" and stop.
3. Detect track
backend.track | Do |
hono, go, fastapi | Continue. |
nextjs | Stop. Use build-nextjs-backend. |
supabase | Stop. Use set-up-supabase for the edge-function telemetry notes. |
none or unset | Run set-up-stack-profile, then a scaffold-*-service skill. |
Also read observability.backend (signoz | grafana-lgtm | sentry | none) only to write the exporter env example in step 6. The OTEL_* variables are the same for all backends (observability.md).
4. Install only what is missing
pnpm add @opentelemetry/api @opentelemetry/core @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node @opentelemetry/exporter-metrics-otlp-http @opentelemetry/sdk-metrics # hono
go get go.opentelemetry.io/otel go.opentelemetry.io/otel/sdk go.opentelemetry.io/otel/sdk/metric go.opentelemetry.io/contrib/exporters/autoexport go.opentelemetry.io/contrib/propagators/autoprop go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp github.com/exaring/otelpgx # go
uv add opentelemetry-distro opentelemetry-exporter-otlp opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-psycopg # fastapi (NOT instrumentation-sqlalchemy, see tracks)Use the profile's package manager. Verify each line in stack-versions.md before you write it.
5. Generate the seams
Create from otel-tracks.md, skipping files that exist:
TS src/platform/telemetry.ts, src/platform/tracer.ts + deltas to logger.ts, main.ts, app.ts, tsdown.config.ts, package.json, vitest.config.ts
Go internal/platform/telemetry/telemetry.go, internal/transport/httpapi/route.go + deltas to logging.go, main.go, server.go
Python src/svc/platform/telemetry.py + deltas to main.py, logging.py, app.py, pyproject.toml, tests/conftest.pyPaths follow service-layout.md. tracer is the platform seam that owns the OTel SDK.
6. Wire
- Order. Telemetry first, then config, logger, DB, app. The SDK patches modules at load; anything imported before it keeps the unpatched original (otel-patterns.md rule 1).
- Route templates. TS:
app.use(routeTemplate)as the first middleware. Go:routeTag(mux)first in the chain. Python: the FastAPI instrumentation does it itself. - Logger trace fields. The logger seam adds
trace_id/span_idfrom the active span (pinomixin, slogtraceHandler, structlogadd_trace_context), per logging-contract.md. - Shutdown order. Drain server → close pool → flush telemetry, with a hard timeout so a rollout never hangs.
- Tests disable the SDK.
OTEL_SDK_DISABLED=true(vitesttest.env, pytest conftest before anysvcimport; Go:Setupis only called frommain). .env.example(plusDEPLOYMENT_ENVIRONMENTandOTEL_SERVICE_NAME, already read by config.md):
OTEL_SERVICE_NAME=svc
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=1.0
OTEL_RESOURCE_ATTRIBUTES=service.version=devdeployment.environment.name comes from DEPLOYMENT_ENVIRONMENT (config.md): in the deploy config, append deployment.environment.name=$DEPLOYMENT_ENVIRONMENT to OTEL_RESOURCE_ATTRIBUTES — not in .env.example.
7. Verify
OTEL_TRACES_EXPORTER=console pnpm dev # hono
OTEL_TRACES_EXPORTER=console go run ./cmd/svc # go
OTEL_TRACES_EXPORTER=console uv run fastapi run # fastapiCurl one route and expect:
- span name TS
GET /notes/:idwith attributehttp.route; GoGET /notes/{id}withhttp.route; PythonGET /notes/{note_id}; - DB spans appear when the DB is used — Go:
otelpgxspans; TS:pg.query:SELECT postgreswith attributedb.system.name=postgresql; Python: psycopg spans withdb.system=postgresql; - the structured log line of the same request carries the same
trace_id; - send
SIGTERMright after a request: the spans still appear (flush on shutdown).
Then finish with the four-step Verify in observability.md.
References
- otel-patterns.md: the rules and the verified pitfalls behind each decision.
- otel-tracks.md: files for Hono, Go and FastAPI, with wiring deltas and span examples.
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
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.

