previews

previews is a cursor rule for Cursor from louisbrulenaudet/monorepo-template. It costs 0 tokens per session (1,589 once invoked), scanned A, original, Apache-2.0.

A set of rules for creating isolated preview deployments of Cloudflare Workers, which are small programs that run on Cloudflare's network. It covers preview configuration, environment values, access control, cross-origin browser requests, and pull-request testing.

In plain words
What is it for?
Use it when setting up or reviewing Cloudflare Worker previews for branches and pull requests, including their variables, bindings, URLs, and deployment workflow.
Why use it?
It prevents branch previews from using shared production resources or the wrong environment, and keeps preview commands and configuration consistent.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: reads .claude/ paths.

Good fit Use it when setting up or reviewing Cloudflare Worker previews for branches and pull requests, including their variables, bindings, URLs, and deployment workflow.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/louisbrulenaudet/monorepo-template/previews
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/louisbrulenaudet/monorepo-template

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for previews

README.md
[![agentmods](https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/previews/github.svg)](https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/previews)
Your own site
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/previews"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/previews/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for previews

Your own site · 80×15
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/previews"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/previews.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,589 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01589
Opus 5.5 $0.00000 $0.00636
Sonnet 5.5 $0.00000 $0.00318
Haiku 4.5 $0.00000 $0.00159

Measured today against content hash f70dd332ba6b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

previews scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/ops/previews.mdc · 40 lines

How it starts

The opening of the file, as written. The whole thing — 40 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Worker Previews

Branch and PR testing uses Worker Previews: an isolated Preview under the production Worker (<app>-production), with its own bindings, URL (<preview>-<app>-production.<subdomain>.workers.dev), and observability, built from each app's ctx.isPreview branch (workers-config.mdc, Preview branch) and deployed with cf previews deploy. The pipeline is .github/workflows/preview.yml, the scripts .github/actions/previews/; read them for the steps. Never use Version URLs (cf workers versions create --preview-alias) or an extra mode for branch testing: both run on shared resources.

Build, deploy, delete

  • Every cf Preview command that reads cloudflare.config.ts carries --mode production (cf build, cf previews deploy). cf previews delete and the Wrangler-only preview secret put read no config and name the Worker instead (--worker / --worker-name <app>-production).
  • deploy-previews.sh walks the apps in monorepo.deployOrder. Each app is built without credentials - env -u CLOUDFLARE_API_TOKEN -u CLOUDFLARE_ACCOUNT_ID -u CF_ACCESS_CLIENT_ID -u CF_ACCESS_CLIENT_SECRET CLOUDFLARE_PREVIEW_BUILD=true pnpm --filter=<app> exec cf build --mode production, plus the VITE_* values for a frontend - then deployed with credentials: pnpm --filter=<app> exec cf previews deploy <name> --prebuilt --mode production.
  • CLOUDFLARE_PREVIEW_BUILD=true is cf's internal, undocumented variable that makes a build a Preview build (ctx.isPreview, recorded as buildContext.isPreview). cf previews deploy --prebuilt refuses Build Output that is not a Preview build, so if cf drops the variable the deploy fails loudly instead of shipping production values to a Preview; conversely cf deploy, cf workers versions create, and cf workers triggers deploy refuse a Preview build.
  • cf previews deploy prints one JSON object on stdout (type: "preview", preview_urls, deployment_id, …) and build logs on stderr; the URL is .preview_urls[0]. It takes no --message.
  • The SPA's VITE_API_BASE_URL is the gateway Preview URL, which is why the gateway is previewed first and the frontend built afterwards.
  • One smoke, after the last deploy: deploy-previews.sh hands every Preview URL to .github/actions/lib/smoke.mjs, the same smoke as CD and skill run-app, so the gateway check also proves its CORS allowlist admits the SPA Preview origin. A --url target is retried for ~25 s on an error, a 404, or a 52x while the new hostname starts serving. A broken gateway therefore costs one SPA build before the run fails.
  • The PR comment is changesets/action/pr-comment (update-id: worker-previews), fed by the deploy step's body output; locally the same URL table goes to stdout. It searches only the first 30 comments (quality-report.mdc).
  • delete-previews.sh runs pnpm exec cf previews delete <preview> --worker <app>-production --force from the repo root for every app, attempting each even when one fails, with no config file. --force is required: without a TTY, cf exits 1 on an unconfirmed destructive command. Locally it authenticates through cf (pnpm run login, or exported CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID).

Read the full file on GitHub · 40 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed f70dd332ba6b
  2. 13d ago Changed · +2 lines 6d7d6aedcf20
  3. 16d ago Changed · -5 lines · -1,528 tokens per session 314c0a4fb1f8
  4. 17d ago Changed · -12 tokens per session be89dc7493ea
  5. 18d ago Changed · +125 tokens per session 0556ba7101c1
  6. 20d ago First seen · 43 lines · 1,415 tokens per session scan A b4e200e84ef9

Subscribe to this mod's changes

previews is a cursor rule published in the GitHub repository louisbrulenaudet/monorepo-template (19 stars, last pushed today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,589 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-26.