The Currai Skill
Install the Currai agent skill so Claude Code or Cursor can instrument your app with traces, generations, and spans automatically.
The Currai Skill is an agent skill for AI coding tools like Claude Code and Cursor. Once installed, your coding agent knows how to wire Currai into an app the right way — the trace → observation model, the client singleton pattern, MCP tool wrapping, Vercel AI SDK integration, and the flush hygiene serverless needs. Ask it to "add tracing", "log my LLM calls", or "see token usage" and it produces instrumentation that matches Currai's conventions instead of guessing.
The skill is published at skills.sh and lives in the open-source curraiapp/skills repo.
Install the skill
Add the skill to your project with one command:
This drops the skill's SKILL.md into your agent's skills directory, where it's discovered automatically — Claude Code and Cursor load it whenever a task involves observability or currai.
Then add the SDK to your app:
And set your keys (the SDKs are server-side — never ship the secret key to the browser):
See Authentication for how to create keys.
What the skill teaches
The skill encodes Currai's recommended patterns so your agent gets them right the first time:
- Client singleton — instantiate
Curraionce per process and stash it onglobalThisso HMR and route handlers don't create duplicates. - Trace anatomy — one trace per request or agent turn, with
sessionIdanduserIdso the dashboard can group by conversation and user. - The observation hierarchy — generations (one LLM call, with
model,modelParameters, andusage), spans (tool calls, retrieval, MCP connect/close), and events (point-in-time markers). Spans nest under generations viaparentObservationId. - Error handling — end an observation with
level: "ERROR"and astatusMessageon failure, rather than throwing and losing the record. - MCP tool wrapping — a drop-in
instrumentToolshelper that wraps every MCP tool'sexecuteso each invocation becomes a child span automatically. - Vercel AI SDK integration — wire
generation.end()andtrace.update()intostreamText'sonFinish/onError. - Flush hygiene — always
await currai.flushAsync()before a serverless function returns.
Using it
After the skill is installed, prompt your agent in plain language:
Add Currai tracing to my chat route.
The agent will create the client singleton, wrap the request in a trace, record the model call as a generation with token usage, wrap any tool calls as spans, and flush before returning. The result follows the same shape as Your first trace:
Next steps
- Installation — add the SDK to a TypeScript or Python app.
- Your first trace — send a trace end to end.
- API reference — the underlying HTTP surface the SDK wraps.
currai