solo-deploy
npx skills add https://github.com/fortunto2/solo-factory --skill solo-deploy
Agent 安装分布
Skill 文档
/deploy
Deploy the project to its hosting platform. Reads the stack template YAML (templates/stacks/{stack}.yaml) for exact deploy config (platform, CLI tools, infra tier, CI/CD, monitoring), detects installed CLI tools, sets up database and environment, pushes code, and verifies deployment is live.
References
templates/principles/dev-principles.mdâ CI/CD, secrets, DNS, shared infra rulestemplates/stacks/*.yamlâ Stack templates with deploy, infra, ci_cd, monitoring fields
Paths are relative to the skill’s plugin root. Search for these files via Glob if not found at expected location.
When to use
After /build has completed all tasks (build stage is complete). This is the deployment engine.
Pipeline: /build â /deploy â /review
MCP Tools (use if available)
session_search(query)â find how similar projects were deployed beforeproject_code_search(query, project)â find deployment patterns across projectscodegraph_query(query)â check project dependencies and stack
If MCP tools are not available, fall back to Glob + Grep + Read.
Pre-flight Checks
1. Verify build is complete (optional)
- If pipeline state tracking exists (
.solo/states/directory), check.solo/states/build. - If
.solo/states/exists butbuildmarker is missing: warn “Build may not be complete. Consider running/buildfirst.” - If
.solo/states/does not exist: skip this check and proceed with deployment.
2. Detect available CLI tools
Run in parallel â detect what’s installed locally:
vercel --version 2>/dev/null && echo "VERCEL_CLI=yes" || echo "VERCEL_CLI=no"
wrangler --version 2>/dev/null && echo "WRANGLER_CLI=yes" || echo "WRANGLER_CLI=no"
npx supabase --version 2>/dev/null && echo "SUPABASE_CLI=yes" || echo "SUPABASE_CLI=no"
fly version 2>/dev/null && echo "FLY_CLI=yes" || echo "FLY_CLI=no"
sst version 2>/dev/null && echo "SST_CLI=yes" || echo "SST_CLI=no"
gh --version 2>/dev/null && echo "GH_CLI=yes" || echo "GH_CLI=no"
Record which tools are available. Use them directly when found â do NOT npx if CLI is already installed globally.
3. Load project context (parallel reads)
CLAUDE.mdâ stack name, architecture, deploy platformdocs/prd.mdâ product requirements, deployment notesdocs/workflow.mdâ CI/CD policy (if exists)package.jsonorpyproject.tomlâ dependencies, scriptsfly.toml,wrangler.toml,sst.config.tsâ platform configs (if exist)docs/plan/*/plan.mdâ active plan (look for deploy-related phases/tasks)
Plan-driven deploy: If the active plan contains deploy phases or tasks (e.g. “deploy Python backend to VPS”, “run deploy.sh”, “set up Docker on server”), treat those as primary deploy instructions. The plan knows the project-specific deploy targets that the generic stack YAML may not cover. Execute plan deploy tasks in addition to (or instead of) the standard platform deploy below.
4. Read stack template YAML
Extract the stack name from CLAUDE.md (look for stack: field or tech stack section).
Read the stack template to get exact deploy configuration:
Search order (first found wins):
templates/stacks/{stack}.yamlâ relative to this skill’s plugin root.solo/stacks/{stack}.yamlâ user’s local overrides (from/init)- Search via Glob for
**/stacks/{stack}.yamlin project or parent directories
Extract these fields from the YAML:
deployâ target platform(s):vercel,cloudflare_workers,cloudflare_pages,fly.io,docker,app_store,play_store,localdeploy_cliâ CLI tools and their use cases (e.g.vercel (local preview, env vars, promote))infraâ infrastructure tool and tier (e.g.sst (sst.config.ts) â Tier 1)ci_cdâ CI/CD system (e.g.github_actions)monitoringâ monitoring/analytics (e.g.posthog)database/ormâ database and ORM if any (affects migration step)storageâ storage services if any (R2, D1, KV, etc.)notesâ stack-specific deployment notes
Use the YAML values as the source of truth for all deploy decisions below. The YAML overrides the fallback tier matrix.
5. Detect platform (fallback if no YAML)
If stack YAML was not found, use this fallback matrix:
| Stack | Platform | Tier |
|---|---|---|
nextjs-supabase / nextjs-ai-agents |
Vercel + Supabase | Tier 1 |
cloudflare-workers |
Cloudflare Workers (wrangler) | Tier 1 |
astro-static / astro-hybrid |
Cloudflare Pages (wrangler) | Tier 1 |
python-api |
Fly.io (quick) or Pulumi + Hetzner (production) | Tier 2/4 |
python-ml |
skip (CLI tool, no hosting needed) | â |
ios-swift |
skip (App Store is manual) | â |
kotlin-android |
skip (Play Store is manual) | â |
If $ARGUMENTS specifies a platform, use that instead of auto-detection or YAML.
Auto-deploy platforms (from YAML deploy field or fallback):
vercel/cloudflare_pagesâ auto-deploy on push. Push to GitHub is sufficient if project is already linked. Only run manual deploy for initial setup.cloudflare_workersâwrangler deployneeded (no git-based auto-deploy for Workers).fly.ioâfly deployneeded.
Deployment Steps
Step 1. Git â Clean State + Push
git status
git log --oneline -5
If dirty, commit remaining changes:
git add -A
git commit -m "chore: pre-deploy cleanup"
Ensure remote exists and push:
git remote -v
git push origin main
If no remote, create GitHub repo:
gh repo create {project-name} --private --source=. --push
For platforms with auto-deploy (Vercel, CF Pages): pushing to main triggers deployment automatically. Skip manual deploy commands if project is already linked.
Step 2. Database Setup
Supabase (if supabase/ dir or Supabase deps detected):
# If supabase CLI available:
supabase db push # apply migrations
supabase gen types --lang=typescript --local > db/types.ts # optional: regenerate types
If no CLI: guide user to Supabase dashboard for migration.
Drizzle ORM (if drizzle.config.ts exists):
npx drizzle-kit push # push schema to database
npx drizzle-kit generate # generate migration files (if needed)
D1 (Cloudflare) (if wrangler.toml has D1 bindings):
wrangler d1 migrations apply {db-name}
If database is not configured yet, list what’s needed and continue â don’t block on it.
Step 3. Environment Variables
Read .env.example or .env.local.example to identify required variables.
Generate platform-specific instructions:
Vercel:
# If vercel CLI is available and project is linked:
vercel env ls # show current env vars
# Guide user:
echo "Set env vars: vercel env add VARIABLE_NAME"
echo "Or via dashboard: https://vercel.com/[team]/[project]/settings/environment-variables"
Cloudflare:
wrangler secret put VARIABLE_NAME # interactive prompt for value
# Or in wrangler.toml [vars] section for non-secret values
Fly.io:
fly secrets set VARIABLE_NAME=value
fly secrets list
Do NOT create or modify .env files with real secrets.
List what’s needed, let user set values.
Step 4. Platform Deploy
Vercel (if not auto-deploying):
vercel link # first time: link to project
vercel # deploy preview
vercel --prod # deploy production (after verifying preview)
Cloudflare Workers/Pages:
wrangler deploy # Workers
wrangler pages deploy ./out # Pages (check build output dir)
Fly.io:
fly launch # first time â creates app, sets region
fly deploy # subsequent deploys
SST (if sst.config.ts exists):
sst deploy --stage prod # production
sst deploy --stage dev # staging
Step 5. Verify Deployment
After deployment, verify it actually works:
# 1. HTTP status check
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://{deployment-url})
# 2. Check for runtime errors in page body
BODY=$(curl -s https://{deployment-url} | head -200)
# 3. Check Vercel deployment logs for errors
vercel logs --output=short 2>&1 | tail -30
If HTTP status is not 200, or page contains error messages:
- Check
vercel env lsâ are all required env vars set on the platform? - If env vars missing: add them with
vercel env add NAME production <<< "value" - If env vars set but wrong:
vercel env rm NAME productionthen re-add - After fixing env vars: redeploy with
vercel --prod --yes - Re-check HTTP status and page content
Common runtime errors and fixes:
- “Supabase URL/Key required” â add
NEXT_PUBLIC_SUPABASE_URL+NEXT_PUBLIC_SUPABASE_ANON_KEYto Vercel - “DATABASE_URL not set” â add
DATABASE_URLto Vercel - “STRIPE_SECRET_KEY missing” â add Stripe keys or remove Stripe code if not ready
- Blank page / hydration error â check build logs, may need
vercel --prodredeploy
Do NOT output <solo:done/> until the live URL returns HTTP 200 and page loads without errors. If you cannot fix the issue, output <solo:redo/> to go back to build. Output pipeline signals ONLY if .solo/states/ directory exists.
Step 6. Post-Deploy Log Monitoring
After verifying HTTP 200, tail production logs to catch runtime errors that only appear under real conditions (missing env vars, DB connection issues, SSR crashes, API timeouts).
Read the logs field from the stack YAML to get platform-specific commands:
Vercel (Next.js):
vercel logs --output=short 2>&1 | tail -50
Look for: Error, FUNCTION_INVOCATION_FAILED, EDGE_FUNCTION_INVOCATION_FAILED, 504 GATEWAY_TIMEOUT, unhandled rejections.
Cloudflare Workers:
wrangler tail --format=pretty 2>&1 | head -100
Look for: Error, uncaught exceptions, D1 query failures, R2 access errors.
Cloudflare Pages (Astro):
wrangler pages deployment tail --project-name={name} 2>&1 | head -100
Fly.io (Python API):
fly logs --app {name} 2>&1 | tail -50
fly status --app {name}
Look for: ERROR, CRITICAL, unhealthy instances, OOM kills, connection refused.
Supabase Edge Functions (if used):
supabase functions logs --scroll 2>&1 | tail -30
What to do with log errors:
- Env var missing â fix with platform CLI (see Step 3), redeploy
- DB connection error â check connection string, IP allowlist
- Runtime crash / unhandled error â if
.solo/states/exists, output<solo:redo/>to go back to build with fix; otherwise fix and redeploy - No errors in 30 lines of logs â proceed to report
If logs show zero traffic (fresh deploy), make a few test requests:
curl -s https://{deployment-url}/ # homepage
curl -s https://{deployment-url}/api/health # API health (if exists)
Then re-check logs for any errors triggered by these requests.
Step 7. Post-Deploy Report
Deployment: {project-name}
Platform: {platform}
URL: {deployment-url}
Branch: main
Commit: {sha}
Done:
- [x] Code pushed to GitHub
- [x] Deployed to {platform}
- [x] Database migrations applied (or N/A)
Manual steps remaining:
- [ ] Set environment variables (listed above)
- [ ] Custom domain (optional)
- [ ] PostHog / analytics setup (optional)
Next: /review â final quality gate
Completion
Signal completion
If .solo/states/ directory exists, output this exact tag ONCE and ONLY ONCE â the pipeline detects the first occurrence:
<solo:done/>
Do NOT repeat the signal tag anywhere else in the response. One occurrence only.
If .solo/states/ directory does not exist, skip the signal tag.
Error Handling
CLI not found
Cause: Platform CLI not installed.
Fix: Install the specific CLI: npm i -g vercel, npm i -g wrangler, brew install flyctl, brew install supabase/tap/supabase.
Deploy fails â build error
Cause: Build works locally but fails on platform (different Node version, missing env vars).
Fix: Check platform build logs. Ensure engines in package.json matches platform. Set missing env vars.
Database connection fails
Cause: DATABASE_URL not set or network rules block connection. Fix: Check connection string, platform’s DB dashboard, IP allowlist.
Git push rejected
Cause: Remote has diverged.
Fix: git pull --rebase origin main, resolve conflicts, push again.
Verification Gate
Before reporting “deployment successful”:
- Run
curl -s -o /dev/null -w "%{http_code}"against the deployment URL. - Verify HTTP 200 (not 404, 500, or redirect loop).
- Check the actual page content matches expectations (not a blank page or error).
- Only then report the deployment as successful.
Never say “deployment should be live” â verify it IS live.
Critical Rules
- Use installed CLIs â detect
vercel,wrangler,supabase,fly,sstbefore falling back tonpx. - Auto-deploy aware â if platform auto-deploys on push, just push. Don’t run manual deploy commands unnecessarily.
- NEVER commit secrets â no .env files with real values, no API keys in code.
- Preview before production â deploy preview first, verify, then promote to prod.
- Check build locally first â
pnpm build/uv build(or equivalent) before deploying. - Check production logs â always tail logs after deploy, catch runtime errors before declaring success.
- Report all URLs â deployment URL + platform dashboard links.
- Infrastructure in repo â prefer
sst.config.tsorfly.tomlover manual dashboard config. - Verify before claiming done â HTTP 200 from the live URL + clean logs, not just “deploy command succeeded”.