Skip to content
Back to skills

Vercel Patterns

ASecurity

Apply Vercel deployment, edge function, and environment variable patterns. Use when deploying to Vercel.

  • 66 stars
  • 0 votes
  • 0 copies
  • 9 views
  • Added September 12, 2026
developmenttypescriptbashnextjsnodenodejstestingapisecurity

Works with

  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add kinncj/Heimdall --skill vercel-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vercel Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vercel Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kinncj-vercel-patterns-heimdall/badge)](https://www.skillsdirectory.com/skills/kinncj-vercel-patterns-heimdall)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vercel-patterns
description: "Apply Vercel deployment, edge function, and environment variable patterns. Use when deploying to Vercel."
---

# SKILL: Vercel Patterns

## vercel.json Configuration
```json
{
  "framework": "nextjs",
  "buildCommand": "npm run build",
  "devCommand": "npm run dev",
  "installCommand": "npm ci",
  "regions": ["iad1"],
  "headers": [
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "X-Frame-Options", "value": "DENY" },
        { "key": "Strict-Transport-Security", "value": "max-age=31536000" }
      ]
    }
  ],
  "rewrites": [],
  "redirects": [
    {
      "source": "/old-path",
      "destination": "/new-path",
      "permanent": true
    }
  ]
}
```

## Runtime Selection
```typescript
// Edge Runtime (low-latency, streaming, middleware)
export const runtime = 'edge';

// Node.js Runtime (heavy compute, native modules, file system)
export const runtime = 'nodejs';

// ISR (static with revalidation)
export const revalidate = 3600; // seconds
```

## Environment Variables
```bash
# Pull env vars for local development
vercel env pull .env.local

# Add env var
vercel env add SECRET_KEY production

# List env vars
vercel env ls
```

## Deployment Workflow
```bash
# Build locally first (catch errors before deploy)
vercel build

# Deploy prebuilt (faster, recommended for CI)
vercel deploy --prebuilt

# Deploy to production
vercel deploy --prod --prebuilt
```

## Middleware Pattern
```typescript
// middleware.ts (runs at edge, before every request)
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export function middleware(request: NextRequest) {
  // Auth check, rate limiting, A/B testing, etc.
  const token = request.cookies.get('token');
  if (!token && request.nextUrl.pathname.startsWith('/dashboard')) {
    return NextResponse.redirect(new URL('/login', request.url));
  }
  return NextResponse.next();
}

export const config = {
  matcher: ['/dashboard/:path*', '/api/protected/:path*'],
};
```

## Rules
- Run `vercel build` locally before deploying to catch errors.
- Use `vercel env pull` to sync environment variables locally.
- Prefer Edge runtime for middleware and simple API routes.
- Use Node.js runtime for heavy compute or native module requirements.
- Set security headers for all API routes.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.