Claude Code 與 Cursor 如何把 SaaS 樣板開發的 token 消耗削減 50%
How I cut Claude Code & Cursor's SaaS boilerplate token burn by 50%..!
vstacks 以 4-command CLI 和 SKILL.md,將 Claude Code 與 Cursor 開發 SaaS 樣板時的 token 消耗削減 50%,每個工作階段約節省 45,000–60,000 tokens。它提供程式碼庫導覽、免 API key 的本機測試、支付及 AI 供應商切換,以及部署前檢查。
If you build SaaS apps with Claude Code, Cursor, Codex, or Antigravity, you've probably noticed the same expensive loop on every new project:
- Your agent burns 20,000+ tokens just running
grepand reading 30 files to figure out where routes, auth, and DB helpers live. - It burns another 35,000–50,000 tokens writing and debugging payment webhooks, credit deduction logic, and auth middleware from scratch—and half the time, it hallucinates an outdated SDK method or breaks when you don't have live API keys ready.
After watching my agent rewrite the exact same auth + credits + webhook loop across multiple projects, I stripped the entire workflow down into a 4-command CLI and SKILL.md called vstacks.
Here is the architecture behind how it keeps coding agents on rails and saves ~45,000–60,000 tokens per session.
1. Replacing 30 File Reads with a 229ms Orientation Map (vstacks map)
Instead of letting an agent explore your directory tree on every new chat session, running:
vstacks map
scans any JS/TS repository in ~229ms and generates .vstacks/MAP.md.
Along with the installed SKILL.md (which registers automatically across Claude Code, Cursor, Codex, and Antigravity), the agent reads .vstacks/MAP.md on Turn 1. It immediately knows:
- Every installed route and API endpoint
- Database tables and schema conventions
- Active payment/AI facades (
src/config.ts) - Required environment keys
Zero blind grepping.
2. The "Zero API Key" Local Money Loop (vstacks new)
Most boilerplates crash locally the second you run npm run dev without configuring 12 .env keys for Supabase, Stripe/Dodo, and OpenAI.
vstacks new MySaas --payments dodo-payments --yes
This scaffolds a clean Next.js App Router + Supabase + Tailwind project controlled by a single src/config.ts (appConfig for branding, plans, credits, AI config, and waitlistMode).
More importantly, it runs before you add a single API key:
- Uses
.vstacks/dev-db.jsonfor local state when keys are blank. - Includes an interactive Dev Control Panel on
src/app/page.tsxwhere you can test credit deductions, fire a 1-click simulated payment webhook (POST /api/payments/dev-simulate-webhook) to upgrade a mock user to Pro, and test simulated AI chat responses immediately. - Pre-wires
/terms,/privacy,sitemap.xml,robots.txt, and a toggleable Waitlist mode.
3. 1-Second Provider Hot-Swapping via Facades (vstacks swap)
Usually, if you start with Stripe and want to switch to Dodo Payments, Polar, or LemonSqueezy (or switch AI providers between OpenAI, Anthropic, Gemini, and OpenRouter), your agent has to rewrite your API routes and UI components.
Because vstacks isolates providers behind clean facades and ambient TypeScript definitions, you can run:
vstacks swap payments stripe
# or
vstacks swap payments dodo-payments
In under a second, it swaps the underlying slot files, updates .vstacks/MAP.md, retains your DB migrations, and passes tsc --noEmit with 0 TypeScript errors and zero changes to your application code.
4. Pre-Ship Guardrails (vstacks check)
Coding agents love forgetting "use client" at the top of interactive components or accidentally importing a raw server SDK inside client UI code.
-
vstacks check --fixautomatically prepends missing"use client"directives, syncs.envkeys, and flags facade bypasses (W_FACADE_BYPASS). -
vstacks check --shipruns a pre-deployment security audit checking for leaked live secrets (sk_live_,whsec_), client-side private env access, hardcodedlocalhostURLs, and unverified webhook routes.
Try It Out
I packaged the entire CLI + multi-agent SKILL.md installer as a one-time download (no subscriptions, no accounts) at vyomirtha.com/vstacks (currently $9.99 for the first 25 spots).

來源:DEV Community · dev.to