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
Reach for it when you want a broad audit of API costs and performance bottlenecks before planning optimizations.
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
CautionNothing 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.
- •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.
Examples
/optimize/optimize ai/optimize cachingname: 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
- If given a focus area, prioritize that dimension
- If no argument, scan all dimensions
- Read
.aif/context/architecture.mdfor 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).
- api-cost-scanner agent — provide the focus scope and architecture.md for caching context
- db-perf-scanner agent — provide the focus scope
- 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
- Rank optimizations by impact/effort ratio
- Group into quick wins (small effort, high impact) and strategic improvements
- 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 filesThis 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.mdFrom 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 installationopenskills 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 syncManual 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.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.