grezxune/ai-tools/setup-hosting
Claude Code and agent skill by grezxune/ai-tools
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Create the GitHub repo, the Vercel project, and its environment variables, then deploy to production.
Install
npx vskill@latest install grezxune/ai-tools/setup-hostingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as grezxune/ai-tools/setup-hosting.
Setup Hosting
Automate the full hosting pipeline: Git init, GitHub repo creation, Vercel project setup, environment variable configuration, and production deployment.
Prerequisites
Before starting, verify all required CLI tools are authenticated:
If any tool is missing or not authenticated:
- gh not found: Ask user to install (
brew install gh) and authenticate (gh auth login) - vercel not found: Install with
bun add -g vercel, thenvercel login - git not configured: Ask user for name/email
Workflow
Execute these steps in order. Ask the user to confirm before each major phase (Git, GitHub, Vercel, Deploy).
Phase 1: Gather Information
Ask the user for:
- Repository name — suggest based on current directory name (kebab-case)
- Visibility — public or private (default: private)
- Vercel team/scope — if they have multiple Vercel teams (check with
vercel teams ls) - Custom domain — optional, if they want to add one after deployment
Check for existing state:
Skip any steps that are already complete. Tell the user what you're skipping and why.
Phase 2: Git Setup
Commit strategy:
- If there are no commits yet, create an initial commit with all files
- If there are existing commits, only commit uncommitted changes
- Use descriptive commit messages, not "initial commit" for projects with real code
- Stage specific files — avoid
git add -Ato prevent accidentally committing secrets
Secret file check — CRITICAL: Before any commit, verify these are in .gitignore:
If .env files exist but .gitignore is missing entries, stop and warn the user before committing.
Phase 3: GitHub Repo Creation
Key flags:
--source=.— use the current directory--remote=origin— sets the remote name--push— pushes after creating
If the repo already exists on GitHub, just add the remote and push:
If the branch is `master` not `main`:
Phase 4: Vercel Project Setup
During `vercel link`:
- It will ask to link to an existing project or create new — choose Create New
- Project name should match the repo name
- It auto-detects the framework (Next.js, etc.)
If already linked (.vercel/project.json exists), skip this step.
Phase 5: Environment Variables
This is the most error-prone step. Follow carefully.
Discovery — find all env vars the project needs:
Ask the user which env file contains production values. If .env.prod exists, confirm they want to use those values.
Pushing env vars to Vercel — correct syntax:
Common env var categories and handling:
| Category | Example | Notes | |
|---|---|---|---|
| Public build vars | NEXT_PUBLIC_* | Needed at build time, safe to expose | |
| Server secrets | BETTER_AUTH_SECRET, API keys | Production only, never expose | |
| Service URLs | NEXT_PUBLIC_CONVEX_URL | Usually same across environments | |
| Payment keys | STRIPE_* | Use test keys for preview, live for production |
Batch approach — push all vars efficiently:
Read the env file, extract key-value pairs, and push each one. Run the calls in parallel where possible (they're independent).
Verify after pushing:
Phase 6: Deploy
If the build fails:
- Check the build logs — the URL is in the output (the "Inspect" URL)
- Common failures and fixes:
| Failure | Cause | Fix | |
|---|---|---|---|
NEXT_PUBLIC_* undefined at build | Env var missing or not NEXT_PUBLIC_ prefixed | Push the var to Vercel | |
| Module-level env access crashes build | Code reads process.env.X at import time | Use lazy initialization pattern (see below) | |
| TypeScript errors | Stricter config on Vercel | Fix locally with bun run build first | |
| Missing dependencies | devDependencies not installed in prod | Move to dependencies or set INSTALL_DEV_DEPS=1 |
Lazy initialization pattern for server-side clients:
If code instantiates clients at module level using env vars, the build will fail because env vars aren't available at build time on Vercel. Fix with lazy initialization:
This applies to ConvexHttpClient, database clients, Stripe clients, etc. — anything that reads env vars at import time.
- After fixing, commit, push to GitHub, then redeploy:
Phase 7: Post-Deploy Verification
After successful deployment:
- Report the URLs to the user:
- Production URL (e.g.,
https://project-name.vercel.app) - Inspect URL for build logs
- Dashboard URL:
https://vercel.com/<team>/<project>
- Custom domain setup (if requested):
``bash vercel domains add <domain> ` Then offer to point the domain's nameservers at Vercel, so its DNS records are managed through the Vercel API. vercel domains inspect <domain>` lists the nameservers to set at the registrar. If the user keeps DNS at the registrar, have them add:
- For apex domain: A record →
76.76.21.21 - For subdomain: CNAME →
cname.vercel-dns.com
- Remind user about:
- Auth callback URLs. Google OAuth and other sign-in providers need the production URL added as an authorized redirect, such as
https://<domain>/api/auth/callback/google - Webhook URLs — Stripe, payment providers need the production URL
- CORS settings — if using external APIs that whitelist origins
- The auth base URL must be the production URL:
SITE_URLin the Convex deployment, orBETTER_AUTH_URLin an app without Convex
Gotchas and Lessons Learned
Vercel CLI quirks
vercel env addaccepts only ONE environment per call — passing multiple errors with "Invalid number of arguments"- Valid built-in environments:
production,preview,development - Custom environments (e.g.,
staging,QA) are supported on Pro/Enterprise plans. The CLI accepts custom environment names directly —vercel env add VAR_NAME stagingwill auto-create the custom environment if it doesn't exist - To deploy to a custom environment:
vercel deploy --target=staging - To remove a var from a custom environment:
vercel env rm VAR_NAME staging --yes vercel --proddeploys from local files, not from Git — for Git-triggered deploys, push to GitHub and let Vercel's GitHub integration handle itvercel linkmust be run from the project root directoryNEXT_PUBLIC_vars are flagged with a warning — this is expected, not an error- Do NOT use `preview` as a staging environment —
previewis Vercel's built-in PR preview system. Use a custom environment namedstaginginstead
Git pitfalls
- Always check
.gitignorebefore the first commit — secrets pushed to Git history are very hard to remove - Use
git add <specific-files>notgit add -Ato avoid committing.env,.DS_Store, etc. - If the repo was created with a README via GitHub web UI, you'll need
git pull --rebase origin mainbefore pushing
Build-time vs runtime env vars
NEXT_PUBLIC_*vars are inlined at build time — they must be set in Vercel before deploying- Server-only vars are available at runtime — they work even if added after the build
- If a
NEXT_PUBLIC_var changes, you must redeploy for the change to take effect
Better Auth on Vercel
- Google OAuth requires
https://<domain>/api/auth/callback/googlein the authorized redirect URIs in Google Cloud Console. - With Convex, the auth instance runs in Convex.
BETTER_AUTH_SECRET,SITE_URL(the production URL), and the OAuth credentials go in the production Convex deployment's environment, through the dashboard ornpx convex env set. Vercel holdsNEXT_PUBLIC_CONVEX_URL,NEXT_PUBLIC_CONVEX_SITE_URL, andNEXT_PUBLIC_SITE_URL. - Without Convex, the auth instance runs in Next.js, and Vercel holds
BETTER_AUTH_SECRET(Better Auth also readsAUTH_SECRET) andBETTER_AUTH_URL, set to the custom domain. An app that answers on several domains or on preview URLs setsbaseURL: { allowedHosts: [...] }in its auth config instead ofBETTER_AUTH_URL.
Framework detection
- Vercel auto-detects Next.js, Vite, Remix, etc. from
package.json - If detection fails, set the framework in Vercel dashboard or via
vercel.json:
``json { "framework": "nextjs" } ``
Checklist
Before reporting completion to the user, verify:
- [ ] Code is committed and pushed to GitHub
- [ ] GitHub repo visibility matches user preference
- [ ] Vercel project is linked and deployed
- [ ] All environment variables are pushed to Vercel production
- [ ] Build succeeded (no errors in build logs)
- [ ] Production URL is accessible
- [ ] User has been given: production URL, GitHub repo URL, Vercel dashboard URL
- [ ] User has been reminded about auth callback URLs and webhook URLs
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/setup-hosting/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/grezxune/ai-tools/setup-hosting)