agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/devops/vercel/SKILL.md

vercel

Skill15 starsChanged 42 days agoMITView on GitHub

Expert Vercel platform assistance covering Next.js deployment, Edge Middleware, Serverless Functions, Turborepo, and analytics. Use when deploying frontend frameworks and serverless backends globally.

  • Reads credentials
  • Installs packages

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use analytics-metrics, aws-account-management and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hoodiniSkill

    analytics-metrics

    Build data visualization and analytics dashboards. Use when creating charts, KPI displays, metrics dashboards, or data visualization components. Triggers on analytics, dashboard, charts, metrics, KPI, data visualization, Recharts.

    Also in 3 projects that use this

  • hoodiniSkill

    aws-account-management

    Manage AWS accounts, organizations, IAM, and billing. Use when setting up AWS Organizations, managing IAM policies, controlling costs, or implementing multi-account strategies. Triggers on AWS Organizations, AWS IAM, AWS billing, Cost Explorer, SCPs, multi-account, AWS SSO, Identity Center.

    Also in 3 projects that use this

  • VercelSkill

    twilio

    Emulated Twilio REST APIs for local development and testing. Use when the user needs to test Twilio Messaging, Verify, Voice, phone numbers, webhooks, status callbacks, inbound SMS simulation, or Twilio SDK integrations without hitting the real Twilio service.

    Also in 3 projects that use this

  • +6 more from hoodini

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Vercel Edge Middleware with geolocation:

    line 115
  2. Distinctive:

    Use Edge Middleware for lightweight tasks (redirects, header injection).

    line 141
  3. Very specific:

    Commit .vercel or .env.local directories to source control.

    line 147

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Vercel

Vercel is a frontend cloud platform providing automated CI/CD deployments, edge middleware, global content distribution, and serverless compute tailored for modern web frameworks.

When to Use

  • Production Next.js & Frontend Deployment: First-party platform optimized for Next.js, React, SvelteKit, and Nuxt.
  • Vercel Edge Functions & Middleware: Sub-millisecond routing, A/B testing, and authentication at the global edge.
  • Instant Preview Deployments: Automated unique URLs for every pull request branch with visual feedback and commenting.
  • Serverless Compute with Fluid Compute: Scaling serverless execution transparently without cold start delays.

Quick Start

npm i -g vercel

# Deploy (Preview)
vercel

# Deploy (Production)
vercel --prod

Core Concepts

Edge Middleware Configuration (middleware.ts)

Executing routing and authentication checks at the network edge:

// middleware.ts
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export function middleware(request: NextRequest) {
  const token = request.cookies.get("auth_token")?.value;

  // Protect dashboard routes
  if (request.nextUrl.pathname.startsWith("/dashboard") && !token) {
    const loginUrl = new URL("/login", request.url);
    loginUrl.searchParams.set("from", request.nextUrl.pathname);
    return NextResponse.redirect(loginUrl);
  }

  // Geolocation header injection
  const response = NextResponse.next();
  const country = request.geo?.country || "US";
  response.headers.set("x-user-country", country);

  return response;
}

export const config = {
  matcher: ["/dashboard/:path*", "/api/secure/:path*"],
};

Declarative Vercel Configuration (vercel.json)

Configuring custom headers, rewrites, and function memory:

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "cleanUrls": true,
  "trailingSlash": false,
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "X-Frame-Options", "value": "DENY" }
      ]
    }
  ],
  "functions": {
    "api/export-pdf.ts": {
      "memory": 1024,
      "maxDuration": 30
    }
  }
}

Vercel CLI Deployment Operations

Deploying and pulling remote environments:

# Link local repository to Vercel project
vercel link

# Pull production environment variables to local .env
vercel env pull .env.local

# Deploy preview build to Vercel edge network
vercel

# Deploy to production domain
vercel --prod

Common Patterns

Geolocation Edge Middleware with Custom Rewrites

Problem: Personalizing content by visitor country without server-side rendering latency.

Solution: Use Vercel Edge Middleware with geolocation:

import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export function middleware(request: NextRequest) {
  const country = request.geo?.country || "US";

  if (country === "GB") {
    return NextResponse.rewrite(new URL("/uk", request.url));
  }
  return NextResponse.next();
}

export const config = {
  matcher: ["/"],
};

Best Practices

Do:

  • Leverage Vercel's native Next.js 15 App Router optimizations (RSC, Server Actions, streaming).
  • Pull environment variables securely using vercel env pull rather than manually copying secrets.
  • Use Edge Middleware for lightweight tasks (redirects, header injection); offload heavy computation to Serverless Functions.
  • Configure maxDuration in vercel.json if background operations require more than default serverless timeout.

Don't:

  • Perform long-running background tasks inside Vercel Edge Middleware; it has strict CPU runtime limits.
  • Commit .vercel or .env.local directories to source control.
  • Bypass Vercel deployment preview gates for production merges.

Troubleshooting

ErrorCauseSolution
FUNCTION_INVOCATION_TIMEOUTServerless Function execution exceeded plan duration limit (15s hobby, 60s pro).Optimize slow external queries or split into background task.
Build Cache Miss on TurborepoEnvironment variables changing between builds without being declared in turbo.json.Add cache-invalidating env vars to globalEnv in turbo.json.
404 Not Found on static assetAsset path missing leading slash or output directory misconfigured.Verify outputDirectory setting matches framework build output (e.g. dist or .next).

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.