All skills
vercel-labs avatar

/vercel-optimize

@583754a official
by Vercel Labsvercel-labs/agent-skills32k stars
2,784

Use for Vercel cost and performance optimization on deployed projects, especially Next.js, SvelteKit, Nuxt, and limited Astro apps. Collect Vercel metrics, usage, project config, and code scan results first; investigate only metric-backed candidates; produce ranked recommendations grounded in verified files and version-aware Vercel/framework docs. Trigger for Vercel bill reduction, slow or expensive routes, caching opportunities, Function Invocations, Build Minutes, Fast Data Transfer, Core Web Vitals, Bot Management, Fluid compute, or cost breakdown requests.

Use this Skill: https://skilld.dev/gh/vercel-labs/agent-skills/vercel-optimize

This session only. Nothing lands on disk.

referencesplaybookssaas.md

≈724 tokens on demand. Your agent reads this file only when SKILL.md points to it.

SaaS

Multi-tenant applications with authenticated dashboards, settings, billing. Auth-gated by default. Traffic skews toward function duration (per-user data fetches) over edge requests.

Typical billing shape

Function Duration dominates (every dashboard request runs the function fully — no edge caching for auth-gated content). Edge Requests grow with API surface. ISR rarely applies. Image Optimization rarely material.

Priority patterns

  1. Per-request memoization with React.cache(). Server Components called from multiple places in the same request tree often re-query the database. React.cache() dedupes within the request. Cite vercel-react-best-practices:server-cache-react.
  2. Parallel data loads in Server Components. Dashboards typically load user + org + billing + recent-activity. Run all four in parallel via Promise.all. Cite vercel-react-best-practices:async-parallel and :server-parallel-fetching.
  3. Fluid Compute. Auth-gated routes have higher cold-start sensitivity (every cold start is a user waiting). If cold-start signal shows up in observability, Fluid Compute is usually the right account-level rec.
  4. Async work after response. Activity logs, audit trails, analytics events — anything that doesn't block the user — should run via after() (Next 15+) or waitUntil() from @vercel/functions. Cite vercel-react-best-practices:server-after-nonblocking.
  5. Suspense boundaries around expensive widgets. The dashboard shell renders fast; widgets stream in. This shifts perceived latency without changing the underlying queries.

Frequent gotchas

  • N+1 ORM queries. A list page that loops over results and fetches related records per-item. Especially common with Prisma's .findUnique inside a .map. Use include or batch via DataLoader.
  • Sequential session+permission checks. await getSession() then await checkPermissions() then await loadData() — these can often be parallelized when the permissions check doesn't depend on the data load.
  • No connection pooling on serverless. Prisma without a pooler exhausts the database under load. Connection pooling is mandatory.
  • Polling for state from the client. Every poll is a function invocation. Replace with SWR + on-demand revalidation, or with revalidateTag triggered by the mutation that actually changes state.

Cross-references

  • vercel-react-best-practices:server-cache-react — per-request dedup
  • vercel-react-best-practices:server-parallel-fetching — restructure for Promise.all
  • vercel-react-best-practices:async-suspense-boundaries — stream the dashboard shell
  • vercel-react-best-practices:server-after-nonblocking — defer audit/analytics writes (Next 15+)
  • vercel-react-best-practices:client-swr-dedup — replace polling with SWR
  • https://vercel.com/docs/fluid-compute — when cold starts hurt

Source: SKILL.md on GitHub

No alerts16d3 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The `vercel-optimize` skill is a robust tool designed for performance and cost auditing of Vercel projects. It implements a 'metrics-first' doctrine, ensuring that any code investigation is preceded by an analysis of production telemetry fetched via the official Vercel CLI. The skill demonstrates high security standards, including deterministic gates to limit AI investigation scope, automated redaction of sensitive telemetry identifiers, and a verification framework to prevent hallucinations.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

Signed by skilld at 583754a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 4 months ago
metadata
{
  "version": "1.2.0"
}
  • Nuxt
  • Performance
  • vercel
  • next.js
  • sveltekit
  • astro
  • optimization
  • cost
  • metrics
  • observability

README badge

README badge for vercel-labs/agent-skills/vercel-optimize

Runs a metrics-first audit of Vercel-deployed projects to identify cost and performance optimization opportunities. Collects production metrics, usage, and code signals, then gates candidates by verified impact before investigating Next.js, SvelteKit, Nuxt, and limited Astro apps. Produces ranked recommendations tied to actual route-level performance data and framework-aware documentation.

Generated from the current SKILL.md.

Does this work with my framework?
Vercel Optimize supports Next.js (App Router and Pages Router), SvelteKit, and Nuxt with full metric-backed recommendations. Astro support is limited. Other frameworks like Hono or Remix can run a code-only audit but may not map route-level metrics back to source files.
What do I need to set up before running an audit?
You need Vercel CLI v53+, an authenticated session (`vercel login`), a linked app directory (`vercel link`), and Node.js 20+. Observability Plus is required for route-level metric-backed recommendations.
Does this require Observability Plus?
Observability Plus is required for route-level recommendations. Without it, the skill can still run a limited code-only audit if you accept the reduced scope.
What metrics does this collect and analyze?
The skill collects Vercel production signals via `vercel metrics`, `vercel usage`, and `vercel contract`, then gates investigations based on metric-backed candidates. It analyzes cost (Function Invocations, Build Minutes, Fast Data Transfer), performance (Core Web Vitals), and caching opportunities on a 14-day window.
Can I run this on unsupported frameworks?
Yes, but with limitations. The skill can run a platform/code-only audit for unsupported frameworks and will prompt you to accept the limited scope before proceeding.

Generated from the current SKILL.md. These answers refresh after source changes.