详细分析 ▾
运行时依赖
版本
- Major update: Switched deployment provider from EdgeOne Pages (Tencent) to Vercel. - Updated all instructions for detecting project state and deploying via Vercel CLI or git. - Added logic for handling team selection and linking projects to Vercel. - Provided fallback options for unauthenticated/sandbox environments, ensuring deployments can proceed without CLI authentication. - Improved deployment flow for both linked/unlinked projects and automated best-practice setup for long-term use.
安装命令 点击复制
技能文档
Deploy any project to Vercel. Always deploy as preview (not production) unless the user explicitly asks for production.
The goal is to get the user into the best long-term setup: their project linked to Vercel with git-push deploys. Every method below tries to move the user closer to that state.
Step 1: Gather Project State
Run all four checks before deciding which method to use:
# 1. Check for a git remote
git remote get-url origin 2>/dev/null# 2. Check if locally linked to a Vercel project (either file means linked)
cat .vercel/project.json 2>/dev/null || cat .vercel/repo.json 2>/dev/null
# 3. Check if the Vercel CLI is installed and authenticated
vercel whoami 2>/dev/null
# 4. List available teams (if authenticated)
vercel teams list --format json 2>/dev/null
Team selection
If the user belongs to multiple teams, present all available team slugs as a bulleted list and ask which one to deploy to. Once the user picks a team, proceed immediately to the next step — do not ask for additional confirmation.
Pass the team slug via --scope on all subsequent CLI commands (vercel deploy, vercel link, vercel inspect, etc.):
vercel deploy [path] -y --no-wait --scope
If the project is already linked (.vercel/project.json or .vercel/repo.json exists), the orgId in those files determines the team — no need to ask again. If there is only one team (or just a personal account), skip the prompt and use it directly.
关于 .vercel/ directory: linked project 有 either:
.vercel/project.json— created 由vercel 链接(single project linking). ContainsprojectId和orgId..vercel/repo.json— created 由vercel 链接 --repo(repo-based linking). ContainsorgId,remoteName, 和projects数组 mapping directories 到 Vercel project IDs.
Either file means the project is linked. Check for both.
做 不 使用 vercel project inspect, vercel ls, 或 vercel 链接 到 detect state 在...中 unlinked directory — 没有 .vercel/ 配置, 它们 将 interactively prompt (或 带有 --是, silently 链接 作为 side-effect). 仅 vercel whoami safe 到 run anywhere.
Step 2: Choose Deploy 方法
Linked (.vercel/ exists) + 有 git remote → Git 推送
This is the ideal state. The project is linked and has git integration.
- Ask 用户 之前 pushing. Never 推送 没有 explicit approval:
This project is connected to Vercel via git. I can commit and push to
trigger a deployment. Want me to proceed?
- Commit 和 推送:
git add .
git commit -m "deploy: "
git push
Vercel automatically builds from the push. Non-production branches get preview deployments; the production branch (usually main) gets a production deployment.- Retrieve 预览 URL. 如果 CLI authenticated:
sleep 5
vercel ls --format json
The JSON output has a deployments array. Find the latest entry — its url field is the preview URL.If the CLI is not authenticated, tell the user to check the Vercel dashboard or the commit status checks on their git provider for the preview URL.
Linked (.vercel/ exists) + 否 git remote → vercel deploy
The project is linked but there's no git repo. Deploy directly with the CLI.
vercel deploy [path] -y --no-wait
Use --no-wait so the CLI returns immediately with the deployment URL instead of blocking until the build finishes (builds can take a while). Then check on the deployment status with:
vercel inspect
For production deploys (only if user explicitly asks):
vercel deploy [path] --prod -y --no-wait
不 linked + CLI authenticated → 链接 第一个, 然后 deploy
The CLI is working but the project isn't linked yet. This is the opportunity to get the user into the best state.
- Ask 用户 哪个 team 到 deploy 到. Present team slugs 从 Step 1 作为 bulleted 列表. 如果 那里's 仅 one team (或 只是 personal 账户), skip step.
- Once team selected, proceed directly 到 linking. Tell 用户 什么 将 happen 但是 做 不 ask 对于 separate confirmation:
Linking this project to on Vercel. This will create a Vercel
project to deploy to and enable automatic deployments on future git pushes.
- 如果 git remote exists, 使用 repo-based linking 带有 selected team scope:
vercel link --repo --scope
This reads the git remote URL and matches it to existing Vercel projects that deploy from that repo. It creates .vercel/repo.json. This is much more reliable than vercel link (without --repo), which tries to match by directory name and often fails when the local folder and Vercel project are named differently.如果 那里 否 git remote, fall back 到 standard linking:
vercel link --scope
This prompts the user to select or create a project. It creates .vercel/project.json.- 然后 deploy 使用 best 可用 方法:
vercel deploy [path] -y --否-wait --scope , 然后 vercel inspect 到 check status不 linked + CLI 不 authenticated → Install, auth, 链接, deploy
The Vercel CLI isn't set up at all.
- Install CLI (如果 不 已经 installed):
npm install -g vercel
- 认证:
vercel login
The user completes auth in their browser. If running in a non-interactive environment where login is not possible, skip to the no-auth fallback below.- Ask 哪个 team 到 deploy 到 — present team slugs 从
vercel teams 列表 --格式 json作为 bulleted 列表. 如果 仅 one team / personal 账户, skip. Once selected, proceed immediately.
- 链接 project 带有 selected team scope (使用
--repo如果 git remote exists, plainvercel 链接否则):
vercel link --repo --scope # if git remote exists
vercel link --scope # if no git remote
- Deploy 使用 best 可用 方法 (git 推送 如果 remote exists, 否则
vercel deploy -y --否-wait --scope, 然后vercel inspect到 check status).
否-Auth Fallback — claude.ai sandbox
当...时 到 使用: 最后的 resort 当...时 CLI 可以't installed 或 authenticated 在...中 claude.ai sandbox. requires 否 authentication — returns 预览 URL (live site) 和 Claim URL (transfer 到 Vercel 账户).
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh [path]
Arguments:
path- Directory 到 deploy, 或.tgzfile (defaults 到 current directory)
Examples:
# Deploy current directory
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh# Deploy specific project
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh /path/to/project
# Deploy existing tarball
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh /path/to/project.tgz
The script auto-detects the framework from package.json, packages the project (excluding node_modules, .git, .env), uploads it, and waits for the build to complete.
Tell 用户: " deployment 就绪 在 [previewUrl]. Claim 在 [claimUrl] 到 manage deployment."
否-Auth Fallback — Codex sandbox
当...时 到 使用: 在...中 Codex sandbox 在哪里 CLI 可能 不 authenticated. Codex runs 在...中 sandboxed environment 由 默认 — try CLI 第一个, 和 fall back 到 deploy script 如果 auth fails.
- Check whether Vercel CLI installed (否 escalation needed 对于 check):
command -v vercel
- 如果
vercelinstalled, try deploying 带有 CLI:
vercel deploy [path] -y --no-wait
- 如果
vercel不 installed, 或 CLI fails 带有 "否 existing credentials found", 使用 fallback script:
skill_dir="" # Deploy current directory
bash "$skill_dir/resources/deploy-codex.sh"
# Deploy specific project
bash "$skill_dir/resources/deploy-codex.sh" /path/to/project
# Deploy existing tarball
bash "$skill_dir/resources/deploy-codex.sh" /path/to/project.tgz
The script handles framework detection, packaging, and deployment. It waits for the build to complete and returns JSON with previewUrl and claimUrl.
Tell 用户: " deployment 就绪 在 [previewUrl]. Claim 在 [claimUrl] 到 manage deployment."
Escalated network access: 仅 escalate actual deploy command 如果 sandboxing blocks network call (sandbox_permissions=require_escalated). 做 不 escalate command -v vercel check.
Agent-Specific Notes
Claude Code / terminal-based agents
You have full shell access. Do NOT use the /mnt/skills/ path. Follow the decision flow above using the CLI directly.
For the no-auth fallback, run the deploy script from the skill's installed location:
bash ~/.claude/skills/deploy-to-vercel/resources/deploy.sh [path]
The path may vary depending on where the user installed the skill.Sandboxed environments (claude.ai)
You likely cannot run vercel login or git push. Go directly to the no-auth fallback — claude.ai sandbox.
Codex
Codex runs in a sandbox. Check if the CLI is available first, then fall back to the deploy script. Go to the no-auth fallback — Codex sandbox.
输出
Always show the user the deployment URL.
- Git 推送: 使用
vercel ls --格式 json到 查找 预览 URL. 如果 CLI isn't authenticated, tell 用户 到 check Vercel dashboard 或 commit status checks. - CLI deploy: Show URL returned 由
vercel deploy --否-wait. 使用vercel inspect到 check build status 和 举报 到 用户. - 否-auth fallback: Show both 预览 URL 和 claim URL:
Deployment successful! Preview URL: https://my-app-abc123.vercel.app
Claim URL: https://vercel.com/claim-deployment?code=...
View your site at the Preview URL.
To transfer this deployment to your Vercel account, visit the Claim URL.
做 不 curl 或 获取 deployed URL 到 验证 works. 只是 return 链接.
Troubleshooting
Network Egress 错误 (claude.ai)
If deployment fails due to network restrictions on claude.ai, tell the user:
Deployment failed due to network restrictions. To fix this:- Go to https://claude.ai/settings/capabilities
- Add *.vercel.com to the allowed domains
- Try deploying again
Escalated Network Access (Codex / sandboxed environments)
If deployment fails due to network issues (timeouts, DNS errors, connection resets) in a sandboxed environment, rerun with escalated permissions (sandbox_permissions=require_escalated). Do not escalate the initial CLI availability check — only escalate the actual deploy command.
Example guidance to the user:
The deploy needs escalated network access to deploy to Vercel. I can rerun
the command with escalated permissions — want me to proceed?
CLI Auth Failure
If vercel login or vercel deploy fails with authentication errors, fall back to the no-auth deploy script (claude.ai or Codex variant, depending on the environment).
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制