{"uid":"cap_X5cKdt3EMDFyb3mymhR-J","slug":"opennext-r2-cache-cleanup-b6a25218","name":"OpenNext R2 Cache Cleanup","description":"OpenNext R2 Cache Cleanup for Next.js on Cloudflare — Decides which old build folders of an OpenNext incremental cache on Cloudflare (R2, or Workers KV) can be deleted, from a pasted setup (wrangler config, open-next config, next.config, the public HTML build id, a listing of the cache folders), and never touches the live build. It reads the cache root and the real folder name (a custom prefix, a deploymentId, a constant deploymentId, a no-build-id folder), finds the live build from the public …","url":"https://api.aiskills402.com/v1/skills/opennext-r2-cache-cleanup/file?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD"],"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"ok":true,"file":{"name":"SKILL.md","content":"<the SKILL.md file>","encoding":"utf-8"},"name":"OpenNext R2 Cache Cleanup for Next.js on Cloudflare","skill":"opennext-r2-cache-cleanup","sha256":"<sha256 of SKILL.md>","receipt":{"tx":"0x<settlement transaction>","settled":true},"version":"1.0.0","redownload":{"url":"<api>/v1/purchases/<token>","token":"<64 hex chars>"}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.05","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.05/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_kQkHoaE25_-2tliRVqtgb","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.05","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Analyzes an OpenNext incremental cache setup on Cloudflare R2 or Workers KV and identifies which old build folders are safe to delete without affecting the live build.","exampleAgentPrompt":"I have an OpenNext incremental cache on Cloudflare R2 and want to know which old build folders are safe to delete — here's my wrangler config, open-next config, next.config, the public build ID, and a listing of my cache folders. Which ones can I remove without touching the live build?","exampleUseCases":[{"title":"Post-deploy R2 cache pruning","prompt":"We just redeployed our Next.js app on Cloudflare using OpenNext and I need to clean up the R2 bucket — can you look at my wrangler config, open-next config, next.config, the current public build ID, and this folder listing, and tell me which old build folders I can safely delete?"},{"title":"Workers KV cache folder cleanup","prompt":"I'm using OpenNext with Workers KV instead of R2 for my Next.js incremental cache and the KV namespace is filling up with old deploymentId folders. Here's my wrangler config, open-next config, next.config, the live build ID, and the current folder listing — which ones are orphaned and safe to remove?"},{"title":"Identify live vs stale cache builds","prompt":"I can't tell which folders in my Cloudflare R2 OpenNext cache belong to the live build and which are from old deploys. Can you analyze my wrangler config, open-next config, next.config, the public HTML build ID, and folder listing to identify which ones I should keep and which I can delete?"}],"resultDescription":"Returns a SKILL.md file containing detailed guidance identifying which old build folders in the OpenNext incremental cache (R2 or Workers KV) can be safely deleted, which folder represents the live build, and instructions for safely performing the cleanup without disrupting the active deployment.","failureModes":["Missing or incomplete wrangler config causes incorrect cache root identification","Mismatched build ID in public HTML vs folder listing leads to uncertain live build detection","Unsupported cache folder naming convention (custom prefix vs deploymentId vs constant) may reduce accuracy","Payment not settled results in 402 response before skill file is returned","Malformed or incomplete folder listing may cause incomplete cleanup recommendations"],"whenToPreferThis":"Use this endpoint when managing OpenNext incremental caches on Cloudflare R2 or Workers KV after Next.js redeployments, especially when unsure which folders belong to the live build versus old deploys. Ideal for DevOps automation agents handling post-deploy cache hygiene without risking deletion of active build assets.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T18:30:47.139Z","isFirstParty":false,"canonicalSlug":"opennext-r2-cache-cleanup-b6a25218"}