API Cost & Performance Scanner

VerifiedCaution

Scans project API and infrastructure to identify cost and performance optimization opportunities.

Sby Skills Guide Bot
DevOpsIntermediate
7/31/2026
Claude Code
#cost-optimization#performance#api#database#latency

Recommended for

Automated summary

Scans a project's code and infrastructure to surface expensive operations and opportunities to cut API cost and improve performance.

Strengths

  • Runs three scanner agents in parallel (API cost, database performance, latency) with dedicated checklists
  • Produces a structured report with an estimated monthly cost table, performance hotspots, and prioritized recommendations
  • Rates each optimization by impact, effort, and risk, separating quick wins from strategic improvements

Limitations

  • Requires the .aif/ structure to be initialized (architecture.md and project-overview.md) and stops otherwise
  • Cost and latency figures are rough estimates, not measured runtime data
  • Tuned to a specific stack (Claude, Gemini, SerpAPI, Firestore, GCS) and the Claude Code agent ecosystem
When to use it

Reach for it when you want a broad audit of API costs and performance bottlenecks before planning optimizations.

When not to use it

Avoid it if your .aif/ project context isn't set up yet, or if you need precise runtime profiling rather than static analysis.

Security analysis

Caution
Quality score76/100

Nothing here is destructive or exfiltrating: it only reads local context files, prints them, and dispatches read-only scanner subagents with a report template. The residual risk is that it auto-executes a repo-local script (`.aif/partials/ethos-include.sh`) and injects file contents into the prompt, which is a real supply-chain/prompt-injection vector if the skill runs over an untrusted repository — hence caution rather than safe.

Findings
  • •Executes an unvalidated shell script from a project-relative path (`sh .aif/partials/ethos-include.sh`) before falling back to `~/.claude/skills/partials/...`; in an untrusted/cloned repository this file is attacker-controllable and runs automatically when the skill is invoked.
  • •Uses inline `!` command execution to read and inject arbitrary file contents from `.aif/context/*.md` into the prompt (prompt-injection / context-poisoning surface if those files are untrusted).
  • •Delegates to user-installed subagents in `~/.claude/agents/` (api-cost-scanner, db-perf-scanner, latency-scanner) whose behavior is not defined or audited in this file.
  • •No declared `allowed-tools` despite invoking bash and the Agent tool, so the capability surface is broader than what is documented.
How this analysis is made

Examples

Full scan
/optimize
Focus on AI calls
/optimize ai
Focus on caching
/optimize caching

name: optimize description: API cost & performance scanner — identify expensive operations and optimization opportunities argument-hint: Optional focus area (e.g., "ai", "caching", "queries", "latency")

/optimize — API Cost & Performance Scanner

You are scanning this project's API and infrastructure for cost and performance optimization opportunities.

Ethos

!sh .aif/partials/ethos-include.sh 2>/dev/null || sh ~/.claude/skills/partials/ethos-include.sh

Context

  • Architecture: !cat .aif/context/architecture.md 2>/dev/null || echo "No architecture context found"
  • Project overview: !cat .aif/context/project-overview.md 2>/dev/null || echo "No project overview found"

Input

Focus: $ARGUMENTS

Prerequisites

Before proceeding, verify that .aif/context/architecture.md and .aif/context/project-overview.md exist. If any of these files are missing, stop and tell the user: "The .aif/ structure hasn't been initialized. Run /init first to set up the project context."

Instructions

Step 1: Determine Focus

  1. If given a focus area, prioritize that dimension
  2. If no argument, scan all dimensions
  3. Read .aif/context/architecture.md for current caching and optimization patterns

Step 2: Launch Scanner Agents

Launch 3 formal scanner agents in parallel using the Agent tool. Each agent is defined in ~/.claude/agents/ with its full scanning checklist and model selection (sonnet for deep analysis).

  1. api-cost-scanner agent — provide the focus scope and architecture.md for caching context
  2. db-perf-scanner agent — provide the focus scope
  3. latency-scanner agent — provide the focus scope

Each agent returns structured findings with estimated impact, effort, and risk.

Step 3: Build Optimization Report

Cost Summary

| Service | Est. Monthly Usage | Est. Monthly Cost | Top Optimization | |---------|-------------------|-------------------|------------------| | Claude Sonnet | X calls | $X | ... | | Claude Haiku | X calls | $X | ... | | Gemini Flash | X calls | $X | ... | | SerpAPI | X calls | $X | ... | | Firestore | X reads/writes | $X | ... | | GCS | X operations | $X | ... |

Performance Hotspots

Rank endpoints by estimated latency, highlighting:

  • Sequential operations that could be parallel
  • Missing caches
  • N+1 query patterns
  • Unnecessary data fetching

Optimization Opportunities

For each opportunity:

  • What: Description of the optimization
  • Impact: Cost savings or latency reduction estimate
  • Effort: Small / Medium / Large
  • Risk: Low / Medium / High (chance of breaking something)

Step 4: Prioritized Recommendations

  1. Rank optimizations by impact/effort ratio
  2. Group into quick wins (small effort, high impact) and strategic improvements
  3. Suggest which items warrant a full AIF requirement (candidates for /spec)

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/api-cost-performance-scanner-ms8gxmz4/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/api-cost-performance-scanner-ms8gxmz4' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/api-cost-performance-scanner-ms8gxmz4/download' --output '.skill-downloads/api-cost-performance-scanner-ms8gxmz4/SKILL.md.part' && mv '.skill-downloads/api-cost-performance-scanner-ms8gxmz4/SKILL.md.part' '.skill-downloads/api-cost-performance-scanner-ms8gxmz4/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Prerequisites

Before proceeding, verify that .aif/context/architecture.md and .aif/context/project-overview.md exist. If any of these files are missing, stop and tell the user: "The .aif/ structure hasn't been initialized. Run /init first to set up the project context."

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/api-cost-performance-scanner-ms8gxmz4/SKILL.md' && test -s '.skill-downloads/api-cost-performance-scanner-ms8gxmz4/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/optimize' && cp -R '.skill-downloads/api-cost-performance-scanner-ms8gxmz4' '.claude/skills/optimize'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/api-cost-performance-scanner-ms8gxmz4'

openskills read 'api-cost-performance-scanner-ms8gxmz4'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/api-cost-performance-scanner-ms8gxmz4/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills