Skip to content

vercel-labs/agent-skills / skills/vercel-optimize

vercel-optimize

Verified

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.

FileKindSize
AGENTS.mdmarkdown1.9 KB
CONTRIBUTING.mdmarkdown2.2 KB
README.mdmarkdown4.4 KB
SKILL.mdskill md16.9 KB
lib/auth-route.mjsscript807 B
lib/budget-summary.mjsscript7.0 KB
lib/citations.mjsscript3.9 KB
lib/cost-coverage.mjsscript8.4 KB
lib/dedup-recs.mjsscript9.9 KB
lib/deep-dive.mjsscript10.2 KB
lib/display-labels.mjsscript7.4 KB
lib/extract-claims.mjsscript18.7 KB
lib/framework-support.mjsscript2.1 KB
lib/gates/build-minutes-fanout.mjsscript2.9 KB
lib/gates/cold-start.mjsscript2.7 KB
lib/gates/contract.mjsscript3.1 KB
lib/gates/cwv-poor.mjsscript3.3 KB
lib/gates/external-api-slow.mjsscript2.1 KB
lib/gates/hard-gates.mjsscript2.5 KB
lib/gates/index.mjsscript2.0 KB
lib/gates/isr-overrevalidation.mjsscript2.4 KB
lib/gates/middleware-heavy.mjsscript2.0 KB
lib/gates/observability-events-attribution.mjsscript2.2 KB
lib/gates/platform-bot-protection.mjsscript5.0 KB
lib/gates/platform-fluid-compute.mjsscript3.5 KB
lib/gates/region-misconfig.mjsscript3.0 KB
lib/gates/route-errors.mjsscript3.0 KB
lib/gates/scanner-driven.mjsscript5.1 KB
lib/gates/select-candidates.mjsscript4.6 KB
lib/gates/slow-route.mjsscript4.3 KB
lib/gates/types.d.tsscript893 B
lib/gates/uncached-route.mjsscript3.9 KB
lib/gates/usage-spike-triage.mjsscript5.0 KB
lib/grade-recommendation.mjsscript6.7 KB
lib/impact-label.mjsscript5.2 KB
lib/impact-magnitude.mjsscript2.1 KB
lib/investigation-brief.mjsscript34.3 KB
lib/observation-safety.mjsscript9.3 KB
lib/project-facts.mjsscript4.3 KB
lib/queries.mjsscript10.1 KB
lib/reconcile-candidates.mjsscript15.6 KB
lib/render-report.mjsscript38.2 KB
lib/repo-root.mjsscript3.1 KB
lib/route-normalize.mjsscript8.4 KB
lib/sanitizers/bot-protection-certainty.mjsscript1.9 KB
lib/sanitizers/cache-tag-invalidation-certainty.mjsscript1.5 KB
lib/sanitizers/count-correct.mjsscript1.9 KB
lib/sanitizers/function-duration-invocations.mjsscript1.4 KB
lib/sanitizers/index.mjsscript3.0 KB
lib/sanitizers/middleware-conflict.mjsscript1.5 KB
lib/sanitizers/missing-citation.mjsscript497 B
lib/sanitizers/pre-release.mjsscript2.2 KB
lib/sanitizers/rate-limit.mjsscript2.6 KB
lib/sanitizers/rendering-mode-mislabel.mjsscript1.6 KB
lib/sanitizers/undeclared-dep.mjsscript2.8 KB
lib/sanitizers/vercel-directive-strip.mjsscript1.4 KB
lib/sanitizers/window-units.mjsscript869 B
lib/scanners/cache-components-suspense-dedupe.mjsscript4.3 KB
lib/scanners/edge-heavy-import.mjsscript3.7 KB
lib/scanners/force-dynamic.mjsscript1.5 KB
lib/scanners/headers-in-page.mjsscript1.5 KB
lib/scanners/index.mjsscript1.4 KB
lib/scanners/large-static-asset.mjsscript3.2 KB
lib/scanners/max-age-without-s-maxage.mjsscript1.6 KB
lib/scanners/middleware-broad-matcher.mjsscript1.9 KB
lib/scanners/missing-cache-headers.mjsscript3.8 KB
lib/scanners/prisma-include-tree.mjsscript1.5 KB
lib/scanners/region-pin-in-config.mjsscript3.4 KB
lib/scanners/source-maps-production.mjsscript1.3 KB
lib/scanners/sveltekit-prerender-missing.mjsscript2.1 KB
lib/scanners/turbo-force-bypass.mjsscript4.9 KB
lib/scanners/unoptimized-image.mjsscript4.4 KB
lib/scanners/use-cache-date-stamp.mjsscript3.9 KB
lib/support-topics.mjsscript12.5 KB
lib/throttle.mjsscript8.8 KB
lib/util.mjsscript544 B
lib/vercel.mjsscript30.4 KB
lib/verify-claim.mjsscript59.6 KB
lib/workspace-resolver.mjsscript17.1 KB
metadata.jsonconfig903 B
references/candidates.mdmarkdown8.3 KB
references/data-collection.mdmarkdown20.4 KB
references/docs-library.jsonconfig30.8 KB
references/doctrine.mdmarkdown9.3 KB
references/observability-plus.mdmarkdown5.2 KB
references/playbooks/README.mdmarkdown2.7 KB
references/playbooks/ai-application.mdmarkdown3.8 KB
references/playbooks/api-service.mdmarkdown2.4 KB
references/playbooks/content-site.mdmarkdown2.4 KB
references/playbooks/ecommerce.mdmarkdown2.7 KB
references/playbooks/marketing.mdmarkdown2.6 KB
references/playbooks/saas.mdmarkdown2.8 KB
references/playbooks/sveltekit.mdmarkdown3.9 KB
references/recommendations.mdmarkdown10.5 KB
references/scanner-patterns.mdmarkdown13.4 KB
references/scoring.mdmarkdown12.2 KB
references/support-topics/README.mdmarkdown1.7 KB
references/support-topics/astro-edge-middleware-scope.mdmarkdown1012 B
references/support-topics/astro-output-mode-and-isr.mdmarkdown1.1 KB
references/support-topics/auth-preserving-parallelization.mdmarkdown1.2 KB
references/support-topics/bot-protection-product-guardrails.mdmarkdown1.1 KB
references/support-topics/build-minutes-monorepo-fanout.mdmarkdown1.2 KB
references/support-topics/cache-components-static-shell-boundaries.mdmarkdown1.1 KB
references/support-topics/cache-components-suspense-dedupe-pitfall.mdmarkdown1.3 KB
references/support-topics/cdn-cache-auth-safety.mdmarkdown1.0 KB
references/support-topics/cold-start-initialization-bundle.mdmarkdown1.1 KB
references/support-topics/core-web-vitals-client-bottlenecks.mdmarkdown1.0 KB
references/support-topics/database-egress-pooling-region.mdmarkdown1015 B
references/support-topics/dynamic-rendering-traps.mdmarkdown1.1 KB
references/support-topics/external-api-critical-path-platform.mdmarkdown1.1 KB
references/support-topics/external-api-critical-path.mdmarkdown978 B
references/support-topics/fast-data-transfer-payloads.mdmarkdown1.0 KB
references/support-topics/fluid-compute-caveats.mdmarkdown1.1 KB
references/support-topics/function-duration-io-and-after.mdmarkdown1.0 KB
references/support-topics/function-invocation-reduction.mdmarkdown1.2 KB
references/support-topics/function-region-misconfiguration-ttfb.mdmarkdown1.2 KB
references/support-topics/image-optimization-cost-control.mdmarkdown1.0 KB
references/support-topics/isr-revalidation-static-generation.mdmarkdown1.4 KB
references/support-topics/middleware-proxy-edge-cost.mdmarkdown991 B
references/support-topics/next-fetch-revalidate-floor.mdmarkdown1.0 KB
references/support-topics/next-font-cls-self-hosting.mdmarkdown906 B
references/support-topics/next-heavy-ui-lazy-load-boundaries.mdmarkdown1.0 KB
references/support-topics/next-image-lcp-preload-sizes.mdmarkdown1.0 KB
references/support-topics/next-route-handler-get-cache-defaults.mdmarkdown1.0 KB
references/support-topics/next-script-third-party-strategy.mdmarkdown1.0 KB
references/support-topics/nextjs-version-cache-semantics.mdmarkdown996 B
references/support-topics/not-found-catchall-request-waste.mdmarkdown1.2 KB
references/support-topics/nuxt-route-rules-cache-isr.mdmarkdown1.2 KB
references/support-topics/observability-events-cost-attribution.mdmarkdown1.1 KB
references/support-topics/post-response-work-waituntil.mdmarkdown1009 B
references/support-topics/route-error-durable-offload.mdmarkdown1.3 KB
references/support-topics/route-error-runtime-limits.mdmarkdown988 B
references/support-topics/runtime-cache-reusable-data.mdmarkdown1.2 KB
references/support-topics/sveltekit-isr-prerender-safety.mdmarkdown1.1 KB
references/support-topics/sveltekit-split-cold-start-tradeoff.mdmarkdown1.0 KB
references/support-topics/usage-spike-triage.mdmarkdown1018 B
references/support-topics/use-cache-date-stamp-isr-write-amplifier.mdmarkdown1.2 KB
references/support-topics/use-cache-remote-shared-origin-data.mdmarkdown1.1 KB
references/support-topics/workflow-resumable-stream-routes.mdmarkdown1.2 KB
references/verification.mdmarkdown8.8 KB
references/voice.mdmarkdown3.6 KB
scripts/budget-summary.mjsscript2.0 KB
scripts/build-docs.mjsexecutablescript3.3 KB
scripts/check-citations.mjsscript3.4 KB
scripts/check-docs-fresh.mjsexecutablescript3.8 KB
scripts/collect-signals.mjsexecutablescript21.1 KB
scripts/collect-sub-agent-outputs.mjsscript9.9 KB
scripts/deep-dive.mjsexecutablescript12.0 KB
scripts/gate-investigations.mjsexecutablescript6.2 KB
scripts/merge-signals.mjsscript6.2 KB
scripts/prepare-investigation-brief.mjsscript7.9 KB
scripts/reconcile-candidates.mjsscript2.4 KB
scripts/render-report.mjsscript17.0 KB
scripts/scan-codebase.mjsexecutablescript11.3 KB
scripts/verify-and-regen.mjsscript14.9 KB
scripts/verify-finding.mjsexecutablescript698 B

lib/observation-safety.mjs

View on GitHub
export function splitCustomerSafeObservations(observations, abstentions = [], signals = {}) {
  const safe = [];
  const heldBack = [];
  for (const observation of Array.isArray(observations) ? observations : []) {
    const unsafeReason = unsupportedObservationReason(observation, abstentions, signals);
    if (unsafeReason) {
      heldBack.push({
        candidateRef: observation?.candidateRef ?? null,
        reason: unsafeReason,
        needsEvidence: true,
      });
    } else {
      safe.push(observation);
    }
  }
  return { observations: safe, heldBackObservations: heldBack };
}

function unsupportedObservationReason(observation, abstentions = [], signals = {}) {
  if (contradictsNoChangeReason(observation, abstentions)) {
    return 'This observation repeated an action that another investigation rejected. Re-run with a single scoped candidate before applying it.';
  }
  if (hasUnsupportedWafBotCategoryClaim(observation)) {
    return 'This observation described an Observability bot category as a WAF-rule condition without supported rule evidence. Re-run with documented WAF condition evidence before applying it.';
  }
  if (hasUnsafeBotProtectionObservation(observation)) {
    return 'This observation recommended Bot Protection or WAF changes without a staged safe-rollout plan and allowlist review. Promote it to a verified platform recommendation before applying it.';
  }
  if (hasStaleNextCacheApiObservation(observation, signals)) {
    return 'This observation used a cache API that does not match the detected framework-version evidence. Re-run with the current Next.js cache evidence before applying it.';
  }
  if (hasUnsupportedFrameworkCausalClaim(observation)) {
    return 'This observation made a framework-specific cause claim that verification could not support. Re-run with runtime logs or official framework evidence before applying it.';
  }
  if (hasUnsupportedStaticGenerationClaim(observation)) {
    return 'This observation made a static-generation behavior claim that verification could not support. Re-run with route-manifest or runtime evidence before applying it.';
  }
  if (hasUnsupportedSourceAbsenceClaim(observation)) {
    return 'This observation made a source-file absence claim that verification could not support. Re-run with a file-existence check or runtime logs before applying it.';
  }
  if (hasUnsupportedCacheLifeCdnClaim(observation)) {
    return 'This observation depended on an unsupported cacheLife-to-CDN claim. Re-run with production header evidence before applying it.';
  }
  if (hasUnsupportedRuntimeRootCauseClaim(observation)) {
    return 'This observation made a runtime root-cause claim that needs log, stack, or upstream response evidence before it can ship.';
  }
  if (hasImplementationGradeObservationAction(observation)) {
    return 'This observation described an implementation change that needs the ready-to-apply recommendation evidence bar before it can ship.';
  }
  return null;
}

function observationText(observation) {
  return [
    observation?.summary,
    observation?.evidence,
    observation?.suggestedAction,
  ].filter(Boolean).join(' ');
}

function evidenceText(observation) {
  return [
    observation?.summary,
    observation?.evidence,
  ].filter(Boolean).join(' ');
}

function hasUnsupportedWafBotCategoryClaim(observation) {
  const text = observationText(observation);
  if (!/\bWAF\b/i.test(text)) return false;
  return /\bbot_category\s*=/i.test(text) ||
    /\btarget(?:ing)?\s+(?:browser_impersonation|automated_browser|ecommerce|monitor)\b/i.test(text);
}

function hasUnsafeBotProtectionObservation(observation) {
  const text = observationText(observation);
  if (!/\b(?:Bot Protection|BotID|bot_filter|WAF|managed bot rules?)\b/i.test(text)) return false;
  const recommendsAction = /\b(?:enable|add|create|configure|challenge|deny|block|rate-limit|target)\b/i.test(String(observation?.suggestedAction ?? ''));
  if (!recommendsAction) return false;
  const hasSafeRollout = /\b(?:staged|log mode|log action|dry run)\b/i.test(text);
  const hasAllowlist = /\ballowlist|exclusions?\b/i.test(text);
  return !(hasSafeRollout && hasAllowlist);
}

function hasStaleNextCacheApiObservation(observation, signals = {}) {
  const text = observationText(observation);
  if (!/\bunstable_cache\b/.test(text)) return false;
  if (signals?.stack?.framework !== 'next') return false;
  const major = parseInt(String(signals?.stack?.frameworkVersion ?? '').match(/\d+/)?.[0] ?? '', 10);
  return Number.isFinite(major) && major >= 16;
}

function hasImplementationGradeObservationAction(observation) {
  const action = String(observation?.suggestedAction ?? '');
  if (action.trim() === '') return false;
  if (/\b(?:use cache:\s*remote|unstable_cache|Cache-Control|s-maxage|cacheLife|export const revalidate|checkBotId|BotID)\b/i.test(action)) return true;
  return /\b(?:enable|add|wrap|apply|move|parallelize|set|create|configure|deny|challenge|block|fix|replace|refactor|rewrite|upgrade|downgrade)\b/i.test(action) ||
    /\bcache\s+(?:the|this|that|shared|public|origin|response|route|data|lookup|fetch|helper)\b/i.test(action) ||
    /\bturn\s+(?:on|off)\b/i.test(action) ||
    /\bswitch\s+(?:to|from|the|this)\b/i.test(action) ||
    /\buse\s+Promise\.all\b/i.test(action) ||
    /\b(?:raise|lower|increase|decrease)\s+(?:the\s+)?(?:TTL|timeout|memory|CPU|cache|cache lifetime|duration)\b/i.test(action);
}

function contradictsNoChangeReason(observation, abstentions) {
  const target = candidateTarget(observation?.candidateRef);
  if (!target) return false;
  const lowerObservationText = observationText(observation).toLowerCase();
  const relevantReasons = abstentions
    .filter((a) => candidateTarget(a?.candidateRef) === target)
    .map((a) => String(a?.reason ?? '').toLowerCase());
  if (relevantReasons.length === 0) return false;

  if (/\bparalleliz(?:e|ing)\b/.test(lowerObservationText) &&
      /\bgetsession\b/.test(lowerObservationText) &&
      relevantReasons.some((reason) => /\bgetsession\b/.test(reason) && /\b(?:gates?|redirect|auth-preserving|blocked)\b/.test(reason))) {
    return true;
  }
  return false;
}

function candidateTarget(ref) {
  if (typeof ref !== 'string') return null;
  const idx = ref.indexOf(':');
  if (idx === -1) return null;
  return ref.slice(idx + 1);
}

function hasUnsupportedFrameworkCausalClaim(observation) {
  const text = observationText(observation).toLowerCase();
  if (!text.includes('notfound') || !text.includes('use cache')) return false;
  return (
    /known next\.js cache components edge case/.test(text) ||
    /next\.js\s+\d+(?:\.\d+)?[^.]{0,120}treats[^.]{0,120}dynamic api/.test(text) ||
    /can surface as 5xx/.test(text) ||
    /surface as 500/.test(text) ||
    /instead of throwing inside (?:the )?cache/.test(text) ||
    /cache boundary/.test(text)
  );
}

function hasUnsupportedStaticGenerationClaim(observation) {
  const text = observationText(observation).toLowerCase();
  if (!/\bgeneratestaticparams\b/.test(text)) return false;
  return /\b(?:returns?\s*(?:an\s+)?empty|\[\])\b[^.\n]{0,240}\b(?:every request|on[- ]demand|no params? (?:are )?prebuilt|populate generatestaticparams|served from (?:the )?cdn|hit bucket|cachebreakdown)\b/i.test(text) ||
    /\b(?:every request|on[- ]demand|no params? (?:are )?prebuilt|populate generatestaticparams|served from (?:the )?cdn|hit bucket|cachebreakdown)\b[^.\n]{0,240}\b(?:returns?\s*(?:an\s+)?empty|\[\])\b/i.test(text) ||
    /\bdynamic\s*=\s*['"`]error['"`]\b[^.\n]{0,240}\b(?:generatestaticparams|dynamicparams|every request|on[- ]demand)\b/i.test(text);
}

function hasUnsupportedSourceAbsenceClaim(observation) {
  const ref = String(observation?.candidateRef ?? '');
  if (!ref.startsWith('route_errors:')) return false;
  const text = observationText(observation).toLowerCase();
  return /\b(?:enoent|no\s+(?:matching|corresponding)\s+(?:mdx|file|post)|missing\s+(?:mdx|file|post)|does\s+not\s+exist|not\s+found\s+on\s+disk)\b/.test(text);
}

function hasUnsupportedCacheLifeCdnClaim(observation) {
  return hasUnsupportedCacheLifeCdnText(observationText(observation));
}

export function hasUnsupportedCacheLifeCdnText(text) {
  if (typeof text !== 'string' || !/\bcacheLife\b/i.test(text)) return false;
  if (/\btoLaunch-\d+\b/i.test(text)) return true;
  return /\bcacheLife\b[^.\n]{0,240}\b(?:Cache-Control|s-maxage|CDN|edge cache|cache breakdown|x-vercel-cache|HIT|MISS|function (?:still )?runs per request|every request invokes the function|canonical|toLaunch-\d+)\b/i.test(text) ||
    /\b(?:Cache-Control|s-maxage|CDN|edge cache|cache breakdown|x-vercel-cache|HIT|MISS|function (?:still )?runs per request|every request invokes the function|canonical|toLaunch-\d+)\b[^.\n]{0,240}\bcacheLife\b/i.test(text) ||
    /\b(?:no|never|without|missing)\s+cacheLife\b[^.\n]{0,240}\b(?:no|not|never|0%|every|per request|function)\b[^.\n]{0,120}\b(?:cache|cached|hit|runs?|invoke)/i.test(text);
}

function hasUnsupportedRuntimeRootCauseClaim(observation) {
  const text = observationText(observation);
  if (!/\b(?:caused by|root cause|responsible for failures|would produce)\b/i.test(text)) return false;
  if (!/\b(?:5xx|500|error|failures?)\b/i.test(text)) return false;
  return !/\b(?:logs?\s+(?:show|confirm|include|contain)|stack\s+(?:shows|trace|evidence)|trace\s+(?:shows|confirms)|exception\s+(?:shows|confirms)|response body\s+(?:shows|confirms)|runtime evidence)\b/i.test(evidenceText(observation));
}
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 119kUpdated Claude CodeCodexVerifiedInstall
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: 118kUpdated Claude CodeCodexVerifiedInstall