Deploy to Vercel

Deploy to Vercel

Guides an agent to deploy apps to Vercel as previews by default, checking git, link and CLI state first and choosing the best deploy method.

Skill files1 file
SKILL.md231 lines
1
---
2
name: deploy-to-vercel
3
description: Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".
4
metadata:
5
author: vercel
6
version: "4.0.0"
7
---
8
9
# Deploy to Vercel
10
11
Deploy any project to Vercel. **Always deploy as preview** (not production) unless the user explicitly asks for production.
12
13
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.
14
15
## Step 1: Gather Project State
16
17
Run all four checks before deciding which method to use:
18
19
```bash
20
# 1. Check for a git remote
21
git remote get-url origin 2>/dev/null
22
23
# 2. Check if locally linked to a Vercel project (either file means linked)
24
cat .vercel/project.json 2>/dev/null || cat .vercel/repo.json 2>/dev/null
25
26
# 3. Check if the Vercel CLI is installed and authenticated
27
vercel whoami 2>/dev/null
28
29
# 4. List available teams (if authenticated)
30
vercel teams list --format json 2>/dev/null
31
```
32
33
### Team selection
34
35
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.
36
37
Pass the team slug via `--scope` on all subsequent CLI commands (`vercel deploy`, `vercel link`, `vercel inspect`, etc.):
38
39
```bash
40
vercel deploy [path] -y --no-wait --scope <team-slug>
41
```
42
43
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.
44
45
**About the `.vercel/` directory:** A linked project has either:
46
- `.vercel/project.json` — created by `vercel link` (single project linking). Contains `projectId` and `orgId`.
47
- `.vercel/repo.json` — created by `vercel link --repo` (repo-based linking). Contains `orgId`, `remoteName`, and a `projects` array mapping directories to Vercel project IDs.
48
49
Either file means the project is linked. Check for both.
50
51
**Do NOT** use `vercel project inspect`, `vercel ls`, or `vercel link` to detect state in an unlinked directory — without a `.vercel/` config, they will interactively prompt (or with `--yes`, silently link as a side-effect). Only `vercel whoami` is safe to run anywhere.
52
53
## Step 2: Choose a Deploy Method
54
55
### Linked (`.vercel/` exists) + has git remote → Git Push
56
57
This is the ideal state. The project is linked and has git integration.
58
59
1. **Ask the user before pushing.** Never push without explicit approval:
60
```
61
This project is connected to Vercel via git. I can commit and push to
62
trigger a deployment. Want me to proceed?
63
```
64
65
2. **Commit and push:**
66
```bash
67
git add .
68
git commit -m "deploy: <description of changes>"
69
git push
70
```
71
Vercel automatically builds from the push. Non-production branches get preview deployments; the production branch (usually `main`) gets a production deployment.
72
73
3. **Retrieve the preview URL.** If the CLI is authenticated:
74
```bash
75
sleep 5
76
vercel ls --format json
77
```
78
The JSON output has a `deployments` array. Find the latest entry — its `url` field is the preview URL.
79
80
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.
81
82
---
83
84
### Linked (`.vercel/` exists) + no git remote → `vercel deploy`
85
86
The project is linked but there's no git repo. Deploy directly with the CLI.
87
88
```bash
89
vercel deploy [path] -y --no-wait
90
```
91
92
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:
93
94
```bash
95
vercel inspect <deployment-url>
96
```
97
98
For production deploys (only if user explicitly asks):
99
```bash
100
vercel deploy [path] --prod -y --no-wait
101
```
102
103
---
104
105
### Not linked + CLI is authenticated → Link first, then deploy
106
107
The CLI is working but the project isn't linked yet. This is the opportunity to get the user into the best state.
108
109
1. **Ask the user which team to deploy to.** Present the team slugs from Step 1 as a bulleted list. If there's only one team (or just a personal account), skip this step.
110
111
2. **Once a team is selected, proceed directly to linking.** Tell the user what will happen but do not ask for separate confirmation:
112
```
113
Linking this project to <team name> on Vercel. This will create a Vercel
114
project to deploy to and enable automatic deployments on future git pushes.
115
```
116
117
3. **If a git remote exists**, use repo-based linking with the selected team scope:
118
```bash
119
vercel link --repo --scope <team-slug>
120
```
121
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.
122
123
**If there is no git remote**, fall back to standard linking:
124
```bash
125
vercel link --scope <team-slug>
126
```
127
This prompts the user to select or create a project. It creates `.vercel/project.json`.
128
129
4. **Then deploy using the best available method:**
130
- If a git remote exists → commit and push (see git push method above)
131
- If no git remote → `vercel deploy [path] -y --no-wait --scope <team-slug>`, then `vercel inspect <url>` to check status
132
133
---
134
135
### Not linked + CLI not authenticated → Install, auth, link, deploy
136
137
The Vercel CLI isn't set up at all.
138
139
1. **Install the CLI (if not already installed):**
140
```bash
141
npm install -g vercel
142
```
143
144
2. **Authenticate:**
145
```bash
146
vercel login
147
```
148
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.
149
150
3. **Ask which team to deploy to** — present team slugs from `vercel teams list --format json` as a bulleted list. If only one team / personal account, skip. Once selected, proceed immediately.
151
152
4. **Link the project** with the selected team scope (use `--repo` if a git remote exists, plain `vercel link` otherwise):
153
```bash
154
vercel link --repo --scope <team-slug> # if git remote exists
155
vercel link --scope <team-slug> # if no git remote
156
```
157
158
5. **Deploy** using the best available method (git push if remote exists, otherwise `vercel deploy -y --no-wait --scope <team-slug>`, then `vercel inspect <url>` to check status).
159
160
---
161
162
### No-Auth Fallback — `vercel deploy --temporary`
163
164
**When to use:** The CLI has no credentials and `vercel login` isn't possible (sandboxes, agents, non-interactive environments). Do **not** ask the user to approve a CLI login or device code first — try this.
165
166
```bash
167
npx vercel@latest deploy [path] --temporary -y
168
```
169
170
No account is needed. The CLI builds locally, deploys to a temporary production URL, and prints a **claim URL** plus how long until the deployment expires. Rerunning the command in the same directory redeploys the same temporary project until it expires.
171
172
Temporary deployments don't work in CI or in a directory already linked to a Vercel project. See https://vercel.com/docs/deployments/deploy-without-logging-in.
173
174
**Tell the user:** "Your deployment is ready at [url]. It expires in [time] unless you claim it at [claimUrl]. Don't share the claim link."
175
176
**Escalated network access (Codex):** Only escalate the deploy command if sandboxing blocks the network call (`sandbox_permissions=require_escalated`).
177
178
---
179
180
## Agent-Specific Notes
181
182
### Claude Code / terminal-based agents
183
184
You have full shell access. Follow the decision flow above using the CLI directly.
185
186
### Sandboxed environments (claude.ai, Codex)
187
188
Check whether the CLI is logged in with `vercel whoami`. If it is, follow Step 2, including team selection. If it isn't, use the **no-auth fallback**.
189
190
---
191
192
## Output
193
194
Always show the user the deployment URL.
195
196
- **Git push:** Use `vercel ls --format json` to find the preview URL. If the CLI isn't authenticated, tell the user to check the Vercel dashboard or commit status checks.
197
- **CLI deploy:** Show the URL returned by `vercel deploy --no-wait`. Use `vercel inspect <url>` to check build status and report it to the user.
198
- **No-auth fallback:** Show the deployment URL, the claim URL, and the expiry the CLI printed.
199
200
**Do not** curl or fetch the deployed URL to verify it works. Just return the link.
201
202
---
203
204
## Troubleshooting
205
206
### Network Egress Error (claude.ai)
207
208
If deployment fails due to network restrictions on claude.ai, tell the user:
209
210
```
211
Deployment failed due to network restrictions. To fix this:
212
213
1. Go to https://claude.ai/settings/capabilities
214
2. Add *.vercel.com and registry.npmjs.org to the allowed domains
215
3. Try deploying again
216
```
217
218
### Escalated Network Access (Codex / sandboxed environments)
219
220
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.
221
222
Example guidance to the user:
223
```
224
The deploy needs escalated network access to deploy to Vercel. I can rerun
225
the command with escalated permissions — want me to proceed?
226
```
227
228
### CLI Auth Failure
229
230
If `vercel login` or `vercel deploy` fails with authentication errors, use the no-auth fallback: `vercel deploy --temporary -y`.
231

© vercel · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 10,806 prompts

More by @OpenSourceBuffGuy

See all
Legal Precedent Research Expert prompt image

Legal Precedent Research Expert

Turns the AI into a legal precedent researcher that maps authorities, analyses holdings, builds arguments and anticipates counterarguments in IRAC-structured memoranda.

system-prompt, act-as, legal-research, litigation, legal, for-lawyers, xml-tags, structured-output, report, guardrails, advanced, long-form, formal, objective, critique, academic-writing, citation-formatting, research-methods

Felt miniature doll walking with a fox prompt image

Felt miniature doll walking with a fox

Generates a handmade felt miniature scene of a wool doll in a casual tech outfit walking across felt grass beside a small felt fox, in a macro stop-motion look.

image-prompt, nano-banana, embroidery, miniature, storybook, whimsical, cozy, macro, bokeh, natural-light, pastel, animals, toys, character-design, cinematic, for-artists, for-designers

Baby copies mother's yoga poses in 3D prompt image

Baby copies mother's yoga poses in 3D

Generates a 20-second Pixar-style 3D clip of a mother doing morning yoga while her baby copies every pose, with fixed character looks and camera plan.

video-prompt, animation, pixar-style, yoga, family, family-friendly, cinematic, character-consistency, camera-movement, tracking-shot, multi-shot, seedance, natural-light, soft-lighting, bokeh, pastel, close-up, wide-shot, widescreen, negative-prompt

Reviews

Loading reviews…

Discussion

Loading comments…