Back to Skills

deploy-to-vercel

pjt222
Updated 6 days ago
16 views
17
2
17
View on GitHub
Otherai

About

This skill deploys a Next.js application to Vercel, handling project linking, environment variables, and deployment configurations. Use it for initial deployments, setting up preview deployments for pull requests, or configuring custom domains and production settings. It's designed for developers managing the full deployment lifecycle of a Next.js app on Vercel.

Quick Install

Claude Code

Recommended
Primary
npx skills add pjt222/agent-almanac -a claude-code
Plugin CommandAlternative
/plugin add https://github.com/pjt222/agent-almanac
Git CloneAlternative
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/deploy-to-vercel

Copy and paste this command in Claude Code to install this skill

Documentation

部署至 Vercel

部 Next.js 應於 Vercel 含生產配。

  • 首次部 Next.js 應
  • 立拉請求預覽部署
  • 配自定域
  • 理生產環境變量

  • :本地構建成功之 Next.js 應
  • :GitHub 倉庫(宜)或本地項目
  • :自定域
  • :生產環境變量

一:驗本地構建

npm run build

得: 構建無錯成。

敗: 修構建錯後部。常見:TypeScript 錯、缺依賴、無效引入。

二:裝 Vercel CLI

npm install -g vercel

得: vercel 命令全局可用,vercel --version 印版本。

敗: 權限錯→sudo npm install -g vercel 或配 npm 用戶本地前綴。node --version 驗 Node.js 已裝。

三:鏈接並部署

# Login to Vercel
vercel login

# Deploy (first time: creates project)
vercel

# Follow prompts:
# - Set up and deploy? Y
# - Which scope? (select your account)
# - Link to existing project? N (for new projects)
# - Project name: my-app
# - Directory: ./
# - Override settings? N

得: 預覽 URL 給(如 https://my-app-xxx.vercel.app)。

敗: vercel login 失→查網,試瀏覽器認證。部失→察構建輸出錯——Vercel 用潔環境,諸依賴須於 package.json

四:配環境變量

# Add environment variables
vercel env add DATABASE_URL production
vercel env add API_KEY production preview

# List environment variables
vercel env ls

或經 Vercel 儀板:Project Settings > Environment Variables。

得: vercel env ls 示諸需變量配於正環境(production、preview、development)。

敗: 運行時無變量→驗目標環境匹(production vs preview)。加變量後重部——現部不自動取新變量。

五:部至生產

vercel --prod

得: 生產 URL 可用(如 https://my-app.vercel.app)。

敗: vercel logs 或 Vercel 儀板察部署日誌。常見:生產環境缺變量、構建命與本地異。

六:連 GitHub 自動部署(宜)

  1. https://vercel.com/new
  2. 引入 GitHub 倉
  3. Vercel 自動部於:
    • 推 main → 生產部署
    • 拉請求 → 預覽部署

得: Vercel 儀板示 GitHub 倉已連,後推 main 自動觸發生產部署。

敗: 倉未現於引入列→查 Vercel GitHub 應有倉訪問權。至 GitHub Settings > Applications > Vercel 授權。

七:配自定域

vercel domains add my-domain.com

或經儀板:Project Settings > Domains。

按 Vercel 指示更 DNS 記錄(通常 CNAME 或 A)。

得: vercel domains ls 示自定域已配,DNS 傳播畢(至 48 時),域解至 Vercel 部署。

敗: 示「Invalid Configuration」→驗 DNS 記錄精匹 Vercel 指示。dig my-domain.com 或在線 DNS 檢確傳播。

八:優化配置

vercel.json 進階設:

{
  "framework": "nextjs",
  "regions": ["iad1"],
  "headers": [
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "Cache-Control", "value": "no-store" }
      ]
    }
  ]
}

得: vercel.json 存項根,下部取配(於 Vercel 儀板構建日誌可見)。

敗: 配忽→jq . vercel.json 驗有效 JSON。查 Vercel 文檔匹框架版本,某設可遷 next.config.ts

  • npm run build 本地成
  • 預覽部署可達
  • 生產部署正確服務應
  • 生產環境變量可用
  • 自定域解(若配)
  • GitHub 集成推時觸部署

  • 本地成 Vercel 失:Vercel 用潔環境。諸依賴須於 package.json 非僅全局裝。
  • 缺環境變量:變量須加於 Vercel,非僅 .env.local。不同環境(production、preview、development)分別變量集。
  • Node.js 版本異:於 Project Settings 或 package.json engines 字段設 Node.js 版本。
  • 部署過大:Vercel 有大小限。以 .vercelignore 排除不需檔。
  • API 路超時:Vercel 無服函於 Hobby 計畫 10s 超時。優化或升級。

  • scaffold-nextjs-app
  • setup-tailwind-typescript
  • configure-git-repository

GitHub Repository

pjt222/agent-almanac
Path: i18n/wenyan-ultra/skills/deploy-to-vercel
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

Related Skills

llamaguard

Other

LlamaGuard is Meta's 7-8B parameter model for moderating LLM inputs and outputs across six safety categories like violence and hate speech. It offers 94-95% accuracy and can be deployed using vLLM, Hugging Face, or Amazon SageMaker. Use this skill to easily integrate content filtering and safety guardrails into your AI applications.

View skill

cost-optimization

Other

This Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.

View skill

quantizing-models-bitsandbytes

Other

This skill quantizes LLMs to 8-bit or 4-bit precision using bitsandbytes, achieving 50-75% memory reduction with minimal accuracy loss. It's ideal for running larger models on limited GPU memory or accelerating inference, supporting formats like INT8, NF4, and FP4. The skill integrates with HuggingFace Transformers and enables QLoRA training and 8-bit optimizers.

View skill

dispatching-parallel-agents

Other

This Claude Skill dispatches multiple agents to investigate and fix 3+ independent problems concurrently. It is designed for scenarios involving unrelated failures that can be resolved without shared state or dependencies. The core capability is parallel problem-solving, assigning one agent per independent problem domain to maximize efficiency.

View skill