用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Dev-Toolbelt/dev-team-agents --skill vercel命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | vercel |
| description | Vercel — env vars, edge functions, caching, preview, monorepo. |
vercel.json)Keep vercel.json minimal — only override defaults when necessary.
{
"buildCommand": "npm run build",
"outputDirectory": ".next",
"installCommand": "npm ci",
"framework": "nextjs"
}
| Field | When to set | Notes |
|---|---|---|
framework | Always | Enables Vercel-specific optimizations |
buildCommand | Override only | Defaults to framework's standard build |
outputDirectory | Override only | Framework default is usually correct |
installCommand | When using npm ci or pnpm | Speeds up builds with frozen lockfiles |
regions | Latency-sensitive | Defaults to closest region; see Regions section |
Rules:
vercel.json or the repositoryvercel env addProduction, Preview, DevelopmentNEXT_PUBLIC_ (Next.js) or framework equivalent# Add a secret via CLI
vercel env add DATABASE_URL production
# Pull env vars to local .env.local (never commit this file)
vercel env pull .env.local
| Scope | When to use |
|---|---|
Production | Live traffic only |
Preview | All branch/PR deployments |
Development | Local vercel dev only |
Default: iad1 (Washington DC). Set per-project in vercel.json:
{ "regions": ["gru1"] }
| Code | Location | Best for |
|---|---|---|
iad1 | US East (N. Virginia) | Default, global baseline |
gru1 | South America (São Paulo) | Brazilian user base |
cdg1 | Europe (Paris) | EU user base |
sin1 | Asia (Singapore) | SEA / Asia-Pacific |
For globally distributed workloads, use Edge Functions (see below) instead of specifying multiple regions.
| Edge Functions | Serverless Functions | |
|---|---|---|
| Runtime | V8 isolates (no Node.js) | Node.js / Python / Go / Ruby |
| Cold start | ~0ms | 100–500ms |
| Max duration | 30s | 10s (Hobby) / 60s (Pro) |
| Use case | Auth, redirects, A/B, geo-routing | DB queries, heavy compute |
| File location | middleware.ts (Next.js) or /api with export const runtime = 'edge' | /api/*.ts (default) |
Prefer Edge for: response rewrites, authentication checks, geolocation headers, A/B testing flags.
Prefer Serverless for: anything requiring Node.js APIs, database connections, or long-running tasks.
{
"headers": [
{
"source": "/_next/static/(.*)",
"headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
},
{
"source": "/api/(.*)",
"headers": [{ "key": "Cache-Control", "value": "no-store" }]
}
]
}
immutable, 1 year TTLno-store by default; add s-maxage only for stable, non-user-specific responsesnext/image); avoid manual <img> tagsBuild cache: Vercel caches node_modules and framework build caches automatically between deployments. Use npm ci (not npm install) to ensure reproducible installs.
Every push to a non-production branch gets a unique preview URL.
Best practices:
VERCEL_URL env var checks in code for environment-aware configurationPreview scope env vars to point to staging databases, not production# Header to bypass preview password protection in CI
x-vercel-protection-bypass: <secret>
For monorepos, set Root Directory in the Vercel project settings (or via CLI --cwd) to the app subdirectory:
vercel --cwd apps/web
Or configure in vercel.json at the repo root:
{ "rootDirectory": "apps/web" }
Each app in the monorepo should be a separate Vercel project. Use Turborepo's remote cache with Vercel for faster CI builds:
npx turbo login
npx turbo link
vercel --prod only for intentional production deploys; CI should auto-deploy via Git integrationvercel logs --prodVERCEL_TOKEN secrets at least quarterly; scope tokens to the minimum required project| Problem | Cause | Fix |
|---|---|---|
| Function timeout in production | Default 10s limit on Hobby | Upgrade plan or move to Edge |
| Env var not available at build time | Set as Development not Preview/Production | Re-scope in dashboard → redeploy |
| Large bundle size warnings | Dependencies imported at top level | Use dynamic import() for heavy libs |
| Cold starts on API routes | Serverless function not warmed | Move to Edge, or use Vercel's Fluid Compute (Pro) |
| Preview URL auth blocks CI | Protection enabled | Add x-vercel-protection-bypass header in CI |