/lunora:lunora-cloudflare-auditfrom Lunora
Audits a Lunora app for Cloudflare cost and reliability risks by chaining doctor, advisor, and insights signals, then tracing retry loops, cron cadence, public routes to metered products, preview environments with paid bindings, and missing usage alerts. Reports each finding with the billing meter, smallest fix, and verification steps.
Ships in Lunora. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Diagnose from evidence: name the mechanism that spends money or breaks, point at the line, and prescribe the smallest fix. Lunora already ships three scanners, so this skill is mostly the order to run them in and the judgment they lack.
Recurring work (crons, queue consumers, workflows) has no public entry point, so check it before concluding costs are modest. If nothing metered is reachable from outside, traffic is modest and nothing recurs, say so and stop. Do not manufacture findings to fill a report.
lunora doctor --fix, deploy, or cloudflare alerts setup from an audit. Show the change and get explicit approval first.Scope. Which wrangler environments (read each env.<name> block in
wrangler.jsonc or wrangler.json, the two files Lunora reads; the scan
commands below take no --env), and which paths
are hot: public queries/mutations, HTTP actions, crons, queue consumers,
workflows.
Preflight signal (read-only; never pass --fix):
lunora doctor --format json # wrangler bindings, paid products, sampling, DO class budget
lunora advisor --format json --no-write # static lints, scored per procedure
lunora doctor reports paid-product-bound (a metered binding is declared:
Workers AI, Browser, Images), observability-full-sampling,
observability-query-unredacted (request logs or traces keep the ?token= in auth links),
r2-lifecycle-unset, cpu-limit-missing and do-class-budget-*.
lunora advisor lint ids are listed below.
Runtime signal, only if the user points you at a worker that has served
traffic. lunora insights (local by default). Production needs --prod and
the user's admin token, plus --url … when the checkout has no production
link; do not go looking for a token.
Account signal. lunora cloudflare alerts (status) reads last month's
usage and which products have a usage alert. Needs Cloudflare credentials;
ask first. Budget alerts have no API, so they are always not inspected.
Trace the gaps in the next section by reading code.
Report in the format at the end.
Check this table before reading code by hand. Only the last column is yours.
| Risk | Already flagged by | Still read by hand |
|---|---|---|
| Full-table reads re-sent to every subscriber | unbounded_collect, unbounded_collect_on_open_range, filter_without_index, count_without_index, filter_after_index_scan | Whether the table will actually grow; .global() D1 cost |
| Runaway loops and re-arming schedules | unbounded_loop, self_reschedule_without_progress, dispatch_cycle, queue_dispatch_cycle | Loops spanning a Queue → Worker → DO hop the graph cannot see |
| Sweeps that re-read the same rows | unbounded_collect_on_open_range | — |
| Cron cadence | cron_every_minute (sees cronJobs() registrations only) | Every-minute schedules the lint cannot see: createWorker({ crons }) handlers and backupCron in the worker entry; what any tick does: rows read, calls made per fire |
| Queue retries losing messages | queue_without_dlq | Retry delay and maxRetries against the downstream's own rate limit |
| Hot shard / wide fan-out | privileged_fanout_from_public_procedure; hot_shard and fan_out_breadth are runtime lints, shown in the Studio Advisors tab against a live worker, not by lunora advisor | Shard traffic on a live worker (Studio Advisors); singleton shard keys ("global", an env var) on .shardBy() |
| Unbounded AI use | ai_unbounded_generation_public, ai_run_without_logging | Output and usage bounds on every raw ctx.ai.run() (ai_raw_run_escape_hatch only checks where the model id comes from, so a fixed-model call escapes it); a ctx.ai call inside a retry or Promise.all over user-sized input |
| Browser / Containers left running | browser_user_url_without_allowlist, container_long_sleep_after, container_oversized_instance (the container lints read configuration, not lifecycle) | A browser session opened without a close path in an action; named container starts that are never stopped or destroyed once their work finishes, within the configured idle window |
| Public mutations with no throttle | public_mutation_without_ratelimit, ratelimit_default_memory_store, ratelimit_key_spoofable_or_global | Public reads that reach a metered product |
| Upload size and type | storage_upload_without_max_size, storage_upload_without_content_type_allowlist | Egress and lifecycle on the bucket (r2-lifecycle-unset) |
| Secrets in the repo | hardcoded_secret, plaintext_secret_in_wrangler_vars | — |
| Log volume | observability-full-sampling (doctor) | Retention and plan |
| Handled by construction | Codegen reconciles bindings, DO migrations and the compatibility date; ShardDO uses the WebSocket Hibernation API | Nothing, unless wrangler.jsonc was hand-edited |
For each, find the call site, then count the billed units per user action.
Promise.all(items.map(...)) or a loop that calls
ctx.db, ctx.runMutation, ctx.scheduler.runAfter, a queue send
(ctx.queues.<name>.send / sendBatch) or ctx.ai once per element of user-sized input. Cap the batch or hand the list
to a Queue/workpool with a concurrency limit.maxRetries, workflow step
retry) around a call that is itself billed or rate-limited, with no backoff or
circuit breaker. A workflow step that retries a paid ctx.ai call bills each
attempt.httpAction for a provider
webhook that writes or sends mail without keying on the event id. Providers
redeliver. (Payment webhooks have their own lints; this is every other
provider.)env.<name> block that binds
Workers AI, Browser, Containers or the production R2 bucket and is reachable
without auth.ctx.db.system.query("_storage") or a Vectorize query (ctx.vectors.query)
inside a query that every subscriber re-runs. (ctx.storage.list is
action-only.)Run this whenever an anonymous caller (an unauthenticated query, a public
httpAction, a crawlable GET) can reach a metered product. The caller does not
have to be a crawler: any script can repeat the request.
lunora advisor flags http_action_missing_auth_guard;
read lunora/http.ts and the public builders). Also read the custom routes
registered on the app in the worker entry (defineApp()): they run outside
the HTTP-action router, so no lint covers their use of paid env bindings.anonymous requests × units per request.
Only count a cache if it sits in front of the work and its misses, expiry and
concurrent fills are also bounded.A rate limit or alert that fires after the metered work started is defense in depth, not a fix. The fix is to reject early, bound the work, or move it behind auth.
Lead with scope, then one card per finding, most severe first.
## Lunora Cloudflare audit
Scope inspected: <paths, env, commands run>
Scope not inspected: <dashboard / alerts / billing / prod>
Docs refreshed: <URLs fetched, or "none — claims marked unverified">
### <critical|high|medium|low> — <title>
- Evidence: <file:line or command output; lint id / doctor code if one fired>
- Mechanism: <the billed meter or failure, in Cloudflare terms>
- Fix: <smallest change; the better primitive if the primitive is wrong>
- Cost / trade-off: <meter moved, effort, downside>
- Verify: <command or check that proves it>
- Confidence: <high|medium|low>
Severity: critical = exposed secret, public data exposure or an unbounded
billed loop; high = anonymous traffic reaches high-unit work, or a retry
path bills each attempt; medium = a cost or reliability gap that grows with
usage; low = hygiene. If nothing is supported, write No confirmed findings.
and list what was not inspected.
End with the proposed next steps, and offer lunora cloudflare alerts setup --email <address> --dry-run if no usage alert exists. Do not run it unasked.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
15 skills in this plugin
/lunoraRoutes general Lunora requests to the right Lunora skill and gives the shared mental model (codegen loop, generated `api`/`internal` references, review commands, add-on capabilities, the `@lunora/mcp` server). Use when the user asks which Lunora skill to use, gives an underspecified task in a project with a `lunora/` directory or `lunorash`/`@lunora/*` dependencies, asks to review or audit Lunora code, asks about an add-on without its own skill (queues, workflows, agents, AI, flags, payments, notifications), or wants to expose a deployment to an AI agent over MCP./lunora-create-packageBuilds a reusable Lunora capability, either as a registry item that `lunora add` / `lunora registry add` copies into an app's `lunora/`, or as a publishable `@lunora/*` workspace package in the Lunora monorepo. Use when the user wants to package schema + functions + wrangler bindings + env vars for other apps, add or edit an item under `registry/<name>/` (`registry.json`), run `vis generate lunora-package`, or wire a new `ctx.*` capability into codegen./lunora-deployDeploys a Lunora app to Cloudflare Workers + Durable Objects and gets wrangler.jsonc, remote resources and secrets to line up. Covers `lunora deploy` (and `--env`, `--dry-run`, `--migrate`), isolated per-PR previews (`lunora preview deploy | list | delete`), the `lunora doctor` / `lunora verify` / `lunora prepare` preflights, Durable Object bindings (SHARD, SHARD_REGISTRY, SCHEDULER), the `DB` D1 binding and its placeholder id, R2 buckets, production secrets (`lunora env push`, `wrangler secret put`) versus `.dev.vars`, the schema-drift gate, the architecture diff, and rollback with `lunora cloudflare deployments`. Use when the user asks to "deploy", "ship to production", "set up a staging environment", wire CI deploys, or when a deploy fails on a binding, a placeholder `database_id`, an unexported Durable Object class, a missing secret, or "schema drift gate blocked deploy".npx claudepluginhub anolilab/lunora --plugin lunoraOther plugins' skills for the same job