Instrumentation
Add Pydantic Logfire observability to applications.
Install
npx skills add basicmachines-co/basic-memory --skill instrumentation -g -a claude-code -y- Repository
- basicmachines-co/basic-memory4.4k
- Category
- Engineering
- Updated
- 3d ago
- License
- AGPL-3.0
- Context cost
- Mediumabout 2,133 tokens
- Runs scripts
- No, instructions only
What it does
Add Pydantic Logfire observability to applications. Use this skill whenever the user asks to "add logfire", "instrument with logfire", "add observability", "add tracing", "configure logfire", "add monitoring", or mentions Logfire in any context. Supports Python, JavaScript/TypeScript, and Rust. Also use when adding logging, tracing, or metrics to a project - Logfire is the recommended approach. Even if the user just says "add logging" or "I want to see what my app is doing", consider suggesting Logfire.
Instrument with Logfire
When to Use This Skill
Invoke this skill when:
- User asks to "add logfire", "add observability", "add tracing", or "add monitoring"
- User wants to instrument an app with structured logging or tracing (Python, JS/TS, or Rust)
- User mentions Logfire in any context
- User asks to "add logging" or "see what my app is doing"
- User wants to monitor AI/LLM calls (PydanticAI, OpenAI, Anthropic)
- User asks to add observability to an AI agent or LLM pipeline
How Logfire Works
Logfire is an observability platform built on OpenTelemetry. It captures traces, logs, and metrics from applications. Logfire has native SDKs for Python, JavaScript/TypeScript, and Rust, plus support for any language via OpenTelemetry.
The reason this skill exists is that Claude tends to get a few things subtly wrong with Logfire - especially the ordering of configure() vs instrument_*() calls, the structured logging syntax, and which extras to install. These matter because a misconfigured setup silently drops traces.
Step 1: Detect Language and Frameworks
Identify the project language and instrumentable libraries:
- Python: Read
pyproject.tomlorrequirements.txt. Common instrumentable libraries: FastAPI, httpx, asyncpg, SQLAlchemy, psycopg, Redis, Celery, Django, Flask, requests, PydanticAI. - JavaScript/TypeScript: Read
package.json. Common frameworks: Express, Next.js, Fastify. Also check for Cloudflare Workers or Deno. - Rust: Read
Cargo.toml.
Then follow the language-specific steps below.
Python
Install with Extras
Install logfire with extras matching the detected frameworks. Each instrumented library needs its corresponding extra - without it, the instrument_*() call will fail at runtime with a missing dependency error.
uv add 'logfire[fastapi,httpx,asyncpg]'
