Vercel Optimize

Skill

Vercel's official cost and performance skill: gathers production metrics, usage and project config, investigates only the routes and files the metrics point to, and returns ranked, doc-backed recommendations. Supports Next.js, SvelteKit and Nuxt; needs Vercel CLI v53+ logged in and linked.

vercel-labs/agent-skills · skills/vercel-optimize32.5k
Auf GitHub ansehen
README

vercel-optimize

Optimize cost and performance for supported projects on Vercel.

This skill uses Vercel metrics to find high-impact improvements in your app. Every recommendation is backed by observed data, scoped code evidence, and version-aware docs.

skills.sh

Install

Install just this skill:

npx skills add vercel-labs/agent-skills --skill vercel-optimize

Manual install: copy skills/vercel-optimize into .agents/skills/vercel-optimize and reference SKILL.md from your project AGENTS.md.

Requirements

  • Node.js 20+
  • Vercel CLI with vercel metrics, vercel usage, vercel contract, and vercel api support (npm i -g vercel@latest). The skill enforces v53+ as its compatibility floor.
  • Authenticated Vercel CLI session (vercel login)
  • Linked Vercel project directory (vercel link) for route metrics. VERCEL_PROJECT_ID can resolve project config, but it does not replace directory linkage for vercel metrics. The project must resolve to a CLI-safe team or personal scope so vercel metrics, vercel usage, and vercel contract all run against the same account.
  • Observability Plus for metric-backed route ranking
  • Code-backed recommendation coverage is strongest for Next.js and SvelteKit, supported for Nuxt route mapping with generic checks, and limited for Astro. Hono, Remix, and unknown frameworks pause up front.

If route-level metrics are unavailable, the skill pauses before scanner-only mode. Scanner-only can catch traffic-independent code issues, but it cannot rank hot routes or prove cost impact.

Use

From the Vercel project directory, ask your coding agent:

optimize this Vercel project

The agent should collect metrics first. If it starts by reading source files or guessing from vercel.json, the skill was not loaded correctly.

Roadmap

AttributeStatus
Route-level Vercel Function invocations, duration, TTFB, and cold startsSupported
Vercel Function CPU, memory, and GB-hoursSupported
Request volume, cache hit rate, HTTP status, and method distributionSupported
Fast Data Transfer and bot traffic patternsSupported
ISR reads, writes, and over-revalidationSupported
Routing Middleware volume and durationSupported
External API latency, volume, and transfer bytesSupported
Core Web Vitals from Speed InsightsSupported
Image Optimization usage, source hosts, and source bytesSupported
Build Minutes fan-outSupported
Usage spikes by billing serviceSupported
Bot Protection and BotID configurationSupported
Fluid Compute configuration and compute signalsSupported
Region pinning and project configuration mismatchesSupported
Observability Events cost attributionSupported
Route-to-file recommendations for Next.js and SvelteKitSupported
Nuxt route mapping with generic/platform checksSupported
Generic route mapping and platform checks for AstroSupported
Hono route-to-file mappingPlanned
Remix route-to-file mappingPlanned
AI Gateway usage and cost optimizationPlanned
Sandbox usage and cost optimizationPlanned
Blob, Edge Config, Runtime Cache, Workflows, Queues, Flags, and Microfrontends billing dimensionsPlanned

What You Get

  • Ranked recommendations tied to observed Vercel metrics
  • Specific route and file references when source changes are justified
  • Before/after code for ready recommendations
  • Citations from a curated, version-aware documentation allow-list
  • Held-back findings when evidence is real but not strong enough for a recommendation
  • A concise final message plus a full Markdown report

Trust Model

  • Metrics come first. Code investigation starts only after signals are collected.
  • Gates are deterministic JavaScript thresholds. No LLM decides whether a metric qualifies.
  • Citations are allow-listed. Unknown URLs and version-mismatched framework docs are stripped.
  • Project config contradictions are rejected. For example, the verifier blocks "enable Fluid Compute" when Fluid Compute is already on.
  • Cost impact uses magnitude framing, not invented exact savings.

Contributing

See CONTRIBUTING.md. New gates, scanners, playbooks, citations, and sanitizers need fixture coverage in packages/vercel-optimize-tests.

License

MIT