Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Agent Cost And Latency

ASecurity

Optimize AI-system cost and latency per verified successful outcome using measured budgets. Use when profiling model/tool/retrieval spend or delays, setting agent run ceilings, choosing model routing/escalation, caching, batching or parallelism under quality constraints. Do not use for general application performance without model/agent costs, speculative model recommendations, or reducing tokens without outcome measurements.

2 stars
0 votes
0 copies
0 views
Added 10/6/2026
ai-agentsgoperformance

Security Analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned 10/6/2026

$npx -y skills add Sathvikar01/Agent-engineering-skills --skill agent-cost-and-latency --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Agent Cost And Latency?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Agent Cost And Latency
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sathvikar01-agent-cost-and-latency/badge)](https://www.skillsdirectory.com/skills/sathvikar01-agent-cost-and-latency)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: agent-cost-and-latency
description: >-
  Optimize AI-system cost and latency per verified successful outcome using measured budgets. Use when profiling model/tool/retrieval spend or delays, setting agent run ceilings, choosing model routing/escalation, caching, batching or parallelism under quality constraints. Do not use for general application performance without model/agent costs, speculative model recommendations, or reducing tokens without outcome measurements.
metadata:
  collection: "Agent Engineering"
  version: "2.0.1"
---

# Agent Cost and Latency

Measure the full logical task before optimizing it. Token savings are not a win if errors, retries or incomplete results make successful outcomes more expensive.

## Establish the baseline and ceilings

1. Define verified success, safe abstention, quality/safety floors and user-facing latency target. Measure representative task slices, p50/p95 wall time, token categories, tool/retrieval time, number of steps/calls, cache behavior and all failed/retried work. Pin model/prompt/tool versions and pricing timestamp; use measured billing when available and label estimates.
2. Compute cost per successful task = total attributable spend across all attempts / verified successes. Report success rate and abstention mix alongside it; if successes=0 the metric is undefined, not zero. Include queueing, human wait time where relevant and coordination costs. Separate interactive response latency from completion latency.
3. Enforce maximum steps, model calls, tool calls, retrieved candidates/context, fan-out, deadline and spend in software. Reserve aggregate worker budgets and preserve them across resume. Stop or return a supported partial/abstained result when limits are exhausted; do not silently drop validation to hit a budget.

## Optimize the measured bottleneck

4. Route to the smallest model/workflow that satisfies the eval gate; escalate on calibrated hard-case/validation signals within explicit call/spend limits. A cheap failed call followed by a large model can cost more than direct routing. Compare routing end to end, including fallbacks.
5. Reduce context by removing irrelevant/redundant evidence and verbose tool outputs while preserving needed provenance and constraints. Improve retrieval/assembly before raising context limits. Measure recall and groundedness after reduction.
6. Cache only stable reusable work with keys covering principal/tenant, permissions, input, model/prompt/schema/tool/index versions and freshness requirements. Never reuse approvals, authoritative changing state or cross-tenant output as if current. Define expiry/invalidation and charge cache creation/read costs correctly.
7. Parallelize independent reads/model tasks only when it reduces critical-path latency within rate/concurrency/spend limits. Keep dependent actions ordered. Batch offline independent work when supported and latency tolerance permits; bound queue time and retry blast radius. Use deterministic orchestration where sufficient.
8. Reduce loops and needless calls before adding clever routing. Coalesce coherent tool operations where semantics/authority remain clear. Do not hide side effects inside a read tool to save a round trip.

## Compare and verify

9. Change one variable, run matched eval tasks under comparable load/cache conditions, repeat noisy measurements and examine tail behavior. Keep gains only if success, safety, groundedness and latency floors hold. Report cost per success, failures and p95, not only average tokens. Read [cost comparison](references/cost-comparison.md) for a worked denominator trap.

Deliver a baseline ledger, bottleneck evidence, enforced ceilings, one optimization experiment and a quality-gated retain/revert decision. Generic profiling belongs to ordinary performance work (or a performance-optimization skill, if available); this skill owns model/retrieval/trajectory economics. Do not recommend a provider/model by reputation without current measured evidence.

Evaluate model choices per role (extraction, reasoning, routing, verification, grounded generation, multimodal interpretation, embedding/reranking), then measure the assembled system. One model may satisfy several roles; an extra verifier/model needs an on/off or matched-routing ablation on the same gold set. Record role errors and whole-task quality, cost per success and latency to verified completion. Participation statistics and provider reputation do not prescribe models. agent-evals owns rigor; agent-orchestration owns route transitions.

Attribution

Sathvikar01Sathvikar01
View sourceSee grades on GitHubMore from Sathvikar01 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →