vercel-labs/agent-skills / skills/vercel-optimize
vercel-optimize
VerifiedUse 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.
lib/gates/platform-fluid-compute.mjs
View on GitHub// Second branch (slow p95 + traffic floor) keeps the gate useful on teams where
// cold-start isn't directly observable — common on CLI v53 — trading specificity for coverage.
export const metadata = {
id: 'platform_fluid_compute',
threshold: 'fluid=false AND (any cold_start signal OR any route with p95>1000ms AND inv>1000)',
billingDimension: 'function-duration',
scope: 'account',
sourceCitation: 'vercel-optimize gate threshold',
description:
'When Fluid Compute is disabled on a project that shows cold-start pressure (high cold-start rate) or sustained slow function p95 on hot routes. Fluid Compute reduces cold starts via instance reuse — recommend turning it on at the project level rather than per-route.',
};
export function gate(signals) {
// If project config failed to load we can't tell if Fluid is on; recommending it when already-on
// erodes trust badly, so stay silent and let Strengths note the gap.
if (signals.project?.error) return [];
const fluidEnabled =
signals.project?.resourceConfig?.fluid === true
|| signals.project?.defaultResourceConfig?.fluid === true;
if (fluidEnabled) return [];
const cold = extractHighColdRoutes(signals);
const slow = extractSlowHotRoutes(signals);
if (cold.length === 0 && slow.length === 0) return [];
return [{
kind: metadata.id,
scope: 'account',
files: [],
priority: 50,
confidence: cold.length > 0 ? 0.85 : 0.65,
o11ySignal: cold.length > 0
? `${cold.length} route(s) with high cold-start rate`
: `${slow.length} hot route(s) with p95>1s; cold-start not directly observable`,
reason: cold.length > 0
? 'cold starts observed and Fluid Compute is disabled'
: 'slow hot routes and Fluid Compute is disabled',
question: 'Would enabling Fluid Compute reduce cold-start and warm-instance reuse overhead for the observed hot routes?',
evidence: { fluidEnabled, highColdRoutes: cold.slice(0, 5), slowHotRoutes: slow.slice(0, 5) },
}];
}
function extractHighColdRoutes(signals) {
const live = signals.metrics?.fnStartTypeByRoute?.rows;
if (Array.isArray(live) && live.some((r) => 'coldCount' in r || 'coldPct' in r)) {
return live.filter((r) => r.route && (r.coldPct ?? 0) > 0.3 && (r.total ?? 0) > 100);
}
// Legacy pre-derived fixture shape.
const direct = signals.metrics?.coldStartByRoute?.rows;
if (Array.isArray(direct)) {
return direct.filter((r) => r.route && (r.coldPct ?? 0) > 0.3 && (r.total ?? 0) > 100);
}
const legacy = signals.metrics?.coldStarts?.series;
if (Array.isArray(legacy)) {
return legacy
.map((s) => {
const total = s.summary?.count ?? 0;
const coldCount = s.summary?.coldCount ?? s.summary?.sum ?? 0;
return { route: s.groupValues?.route, total, coldPct: total > 0 ? coldCount / total : 0 };
})
.filter((r) => r.route && r.coldPct > 0.3 && r.total > 100);
}
return [];
}
function extractSlowHotRoutes(signals) {
const dur = signals.metrics?.fnDurationP95ByRoute?.rows;
const cache = signals.metrics?.requestsByRouteCache?.rows;
if (!Array.isArray(dur)) return [];
// Sum requests per route across cache_result.
const inv = new Map();
for (const r of (cache ?? [])) {
if (!r.route) continue;
inv.set(r.route, (inv.get(r.route) ?? 0) + (r.value ?? 0));
}
return dur
.filter((r) => r.route)
.map((r) => ({ route: r.route, p95Ms: Math.round(r.value ?? 0), invocations: inv.get(r.route) ?? 0 }))
// inv>500 floor is the 14d-window equivalent of the old 1000/30d.
.filter((r) => r.p95Ms > 1000 && r.invocations > 500);
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |