naman10parikh/turbo/audit-serverless-state

Claude Code and agent skill by naman10parikh/turbo

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Hunt the cross-request state bug — module-scope `new Map()` / mutable state that bleeds one user's data into another under Vercel Fluid Compute. Use when asked to "audit for the Map bug", "check for cross-request state", "find the data-bleed", "why are users seeing each other's data", or before shipping any serverless route. Encodes turbo's S-01 scenario + O-01 opinion + P-02 pitfall — the 🔴 data-bleed class.

Install

npx vskill@latest install naman10parikh/turbo/audit-serverless-state

SKILL.md

The same SKILL.md was published earlier as naman10parikh/turbo/audit-serverless-state.

audit-serverless-state

Encodes scenario S-01 (cross-user data bleed under Fluid Compute), opinion O-01 (always externalize cross-request state; never hold it in process — now for TWO reasons), and pitfall P-02 (new Map() / module-scope state on Vercel is now RACY, not just empty). This is the highest-severity bug turbo guards: 🔴 cross-user data bleed.

Trigger

Invoke when the user (or a coding agent) asks to:

  • "audit for the Map / Fluid bug" / "check for cross-request state" / "find the data bleed"
  • "why are users seeing each other's data" / "category reports show items from other categories"
  • a pre-ship review of any Vercel/serverless route (app/api/**)

Also invoke proactively before shipping any service that has module-scope state.

Steps

  1. Run the detector (don't eyeball it):

``bash turbo audit <service-dir> --json ` The P-02 detector greps app/api/** for new Map() / new Set() / object-as-cache at module scope and lazy-init if (!cachedClient) cachedClient = createClient() above a handler. It reports [{pitfall:"P-02", file, line, severity}]`.

  1. Understand why local testing can't catch it. The bug is invisible in `vercel dev` — emulators don't reuse containers, so the race never fires locally. Never accept "it works locally" as proof. The condition: Vercel Fluid Compute is default-on (2026); one warm instance serves dozens (peaks past 250) of concurrent requests that share and race module state.
  2. For each finding, apply the fix (route, don't rebuild):
  • Treat everything outside the handler as a constant. Move mutable state into function scope.
  • For genuine cross-request cache/session/counter, externalize to Upstash / Supabase / KV / Durable Objects, OR pass the ID from the client (the energy new Map() law).
  • Do NOT build a cache store here — that is echo's seam (rate-limit / cache / KV). turbo's job is to detect the bug and route the fix to externalize, never to implement the cache. rhinobase/hono-rate-limiter is "do NOT wire."
  1. Respect the escape hatch (don't over-flag): a DB connection pool is safe at module scope (it manages its own concurrency). Truly-immutable singletons / constants are fine. The ban is on mutable cross-request state — a raw lazily-assigned client ref is NOT safe; a pool IS.
  2. Prove the fix with a concurrency test: fire parallel requests with distinct inputs; assert each caller gets its own data back. Then re-run turbo audit and confirm zero P-02.

Output

A findings report:

  • the P-02 findings table (file:line, what's at module scope)
  • per finding: the fix (move-to-function-scope / externalize / pass-ID-from-client) — never "build a cache"
  • a note for any false-positive (a connection pool / immutable constant) explaining why it's exempt
  • the concurrency-test result (each caller got its own data)
  • the closing line: "This is not a Fluid Compute bug; it is a pre-existing code smell that isolation was hiding."
  • a pointer: cache/rate-limit/KV is echo's territory, not turbo's.

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

Popularity

7-day trend score
0

Not refreshed yet.

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/naman10parikh/turbo/audit-serverless-state/badge)](https://verified-skill.com/skills/naman10parikh/turbo/audit-serverless-state)

Something wrong with this skill or its page? Tell us.