instrumentation
Skill by basicmachines-co
Adds Pydantic Logfire observability to Python, JavaScript/TypeScript and Rust applications. It is for developers who want tracing, structured logging or monitoring of AI and LLM calls.
Install instrumentation
Built from the published package, never by AI.
git clone --depth 1 https://github.com/basicmachines-co/basic-memory /tmp/basic-memory && mkdir -p ~/.claude/skills && cp -r /tmp/basic-memory/.agents/skills/instrumentation ~/.claude/skills/instrumentationRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/basicmachines-co/basic-memory /tmp/basic-memory && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/basic-memory/.agents/skills/instrumentation ~/.gemini/antigravity-cli/skills/instrumentationAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The instrumentation skill guides an AI assistant through adding Pydantic Logfire to an application. It covers Python, JavaScript/TypeScript and Rust. For Python, it covers installing the right extras, calling logfire.configure() before instrument_*() calls, and structured logging with {key} placeholders. For JavaScript and Rust, it covers SDK installation and configuration, plus logging and spans.
The skill also covers AI and LLM monitoring for PydanticAI, OpenAI and Anthropic. It includes a verify step that checks authentication and whether traces appear in the Logfire UI. It is aimed at developers who want to add tracing, logging or monitoring to a project.
Written from the project's SKILL.md and checked against it.
What it can do
- Detect language and frameworksReads pyproject.toml, requirements.txt, package.json or Cargo.toml to find instrumentable libraries.
- Python setupInstalls logfire with extras and orders configure() before instrument_*() calls.
- Structured loggingReplaces print and logging calls with {key} placeholders, spans and logfire.exception().
- AI and LLM instrumentationInstruments PydanticAI, OpenAI, Anthropic and other AI libraries to capture calls and token usage.
- JavaScript and TypeScript setupConfigures Logfire for Node.js, Cloudflare Workers and Next.js.
- Rust setupConfigures the Rust SDK with a panic handler and a shutdown handler to flush data.
- Verify setupChecks authentication and whether traces appear at the Logfire web interface.
What you need
- Logfire authentication via LOGFIRE_TOKEN or logfire auth
- uv for Python installs
- npm for JavaScript installs
- Cargo for Rust projects
Try asking
- Add Logfire tracing to my FastAPI app
- Instrument my PydanticAI agent with Logfire
- Replace print statements in this project with Logfire structured logging
Good to know
- Python configure() must run before instrument_*() calls, or traces are silently dropped.
- In Gunicorn deployments, configure() belongs in the post_fork hook.
- Missing extras cause instrument_*() calls to fail at runtime.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/instrumentation/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md9 KB -
references/javascript/frameworks.md2 KB -
references/javascript/patterns.md2 KB -
references/python/integrations.md2 KB -
references/python/logging-patterns.md3 KB
Show all 6 files
-
references/rust/patterns.md2 KB
Alternatives to instrumentation
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
instrumentation: common questions
Which languages does the Logfire instrumentation skill support?
The skill supports Python, JavaScript/TypeScript and Rust. The source also notes that Logfire supports any language via OpenTelemetry.
Why does the order of configure() and instrument calls matter?
In Python, calling instrument_*() before configure() registers the hooks but traces go nowhere. The source says a misconfigured setup silently drops traces.
How do I check that Logfire is working after setup?
Run logfire auth or set LOGFIRE_TOKEN, start the app, trigger a request, then check the traces at logfire.pydantic.dev.
How do I install instrumentation?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is instrumentation free?
The code is published under the AGPL-3.0 licence. The service it connects to may have its own pricing.
Is instrumentation safe to use?
It scores 86 of 100. Grades: maintenance A, licence C, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to instrumentation?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
