built-in-metrics

built-in-metrics is a skill for Claude Code, Codex from Bilal140202/the-lord-of-the-skills. It costs 59 tokens per session (3,099 once invoked), scanned A, original, MIT.

A guide for adding tracking around an AI provider call, meaning the part of an application that sends a request to an AI service. It records duration, token use, success or failure, and—when streaming—time to the first response token.

In plain words
What is it for?
Use it to inspect an existing AI call, select an integration level, and instrument the code for monitoring request performance and outcomes.
Why use it?
It removes the need to collect these measurements by hand when the existing SDK or provider integration can do it automatically. The guide chooses the simplest suitable tracking method.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect an existing AI call, select an integration level, and instrument the code for monitoring request performance and outcomes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bilal140202/the-lord-of-the-skills/agentcontrol-built-in-metrics
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Bilal140202/the-lord-of-the-skills --skill agentcontrol-built-in-metrics
Clone the repo
git clone --depth 1 https://github.com/Bilal140202/the-lord-of-the-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for built-in-metrics

README.md
[![agentmods](https://agentmods.dev/badge/skills/bilal140202/the-lord-of-the-skills/agentcontrol-built-in-metrics/github.svg)](https://agentmods.dev/skills/bilal140202/the-lord-of-the-skills/agentcontrol-built-in-metrics)
Your own site
<a href="https://agentmods.dev/skills/bilal140202/the-lord-of-the-skills/agentcontrol-built-in-metrics"><img src="https://agentmods.dev/badge/skills/bilal140202/the-lord-of-the-skills/agentcontrol-built-in-metrics/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for built-in-metrics

Your own site · 80×15
<a href="https://agentmods.dev/skills/bilal140202/the-lord-of-the-skills/agentcontrol-built-in-metrics"><img src="https://agentmods.dev/badge/skills/bilal140202/the-lord-of-the-skills/agentcontrol-built-in-metrics.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,099 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00059 $0.03099
Opus 5 $0.00030 $0.01550
Sonnet 5 $0.00012 $0.00620
Haiku 4.5 $0.00006 $0.00310

Measured 6d ago against content hash 09004c069189, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

built-in-metrics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/gondor/claude-code/LaunchDarkly__agent-skills/agentcontrol-built-in-metrics-SKILL.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Metrics Instrumentation

You're using a skill that wires LaunchDarkly agent metrics around an existing provider call. Your job is to audit what's already there, pick the right tier from the ladder below, and implement it with the least ceremony that still captures the metrics the Monitoring tab needs (duration, input/output tokens, success/error, plus TTFT when streaming).

The single most important thing to get right: default to the highest tier that fits the shape of the call. Going lower ("just write the manual tracker calls") looks flexible but costs you drift, missed metrics, and legacy patterns the SDKs have moved past.

The four-tier ladder

This is the order the official SDK READMEs (Python core, Node core, and every provider package) recommend. Walk from the top and stop at the first tier that fits:

Tier Pattern Use when Tracks automatically
1 — Managed runner Python: ai_client.create_model(...) returning a ManagedModel, then await model.run(...). Node: aiClient.createModel(...) returning a ManagedModel, then await model.run(...). The call is conversational (chat history, turn-based). This is what the provider READMEs lead with. Duration, tokens, success/error — all of it, zero tracker calls.
2 — Provider package + trackMetricsOf tracker.trackMetricsOf(Provider.getAIMetricsFromResponse, () => providerCall()). Provider packages today: @launchdarkly/server-sdk-ai-openai, -langchain, -vercel (Node) and launchdarkly-server-sdk-ai-openai, -langchain (Python). The shape isn't a chat loop (one-shot completion, structured output, agent step) but the framework or provider has a package. Duration + success/error from the wrapper; tokens from the package's built-in getAIMetricsFromResponse extractor.
3 — Custom extractor + trackMetricsOf Same trackMetricsOf wrapper, but you write a small function that maps the provider response to LDAIMetrics (tokens + success). No provider package exists (Anthropic direct, Gemini, Cohere, custom HTTP). Duration + success/error from the wrapper; tokens from your extractor.
4 — Raw manual Separate calls to trackDuration, trackTokens, trackSuccess / trackError, plus trackTimeToFirstToken for streams. Streaming with TTFT, unusual response shapes, partial tracking, anything Tier 2–3 can't cleanly wrap. Only what you explicitly call — it's on you to not miss one.

Read the full file on GitHub · 110 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 110 lines · 59 tokens per session scan A 09004c069189

Subscribe to this mod's changes

built-in-metrics is a skill published in the GitHub repository Bilal140202/the-lord-of-the-skills (4 stars, last pushed 6d ago), licensed MIT. It adds 59 tokens to every session and 3,099 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-06.