service-bindings

service-bindings is a cursor rule for Cursor from louisbrulenaudet/monorepo-template. It costs 640 tokens per session, scanned A, original, Apache-2.0.

A set of rules for calling one Cloudflare Worker from another through a named service connection. A Worker is a small program that runs on Cloudflare; the rules cover asynchronous calls, exported entry points, and request identifiers.

In plain words
What is it for?
Use it when implementing or reviewing Worker-to-Worker remote procedure calls and their payload types.
Why use it?
It prevents common mistakes such as calling the wrong method, forgetting to wait for a result, or losing the request ID used to trace a request across services.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions AGENTS.md.

Good fit Use it when implementing or reviewing Worker-to-Worker remote procedure calls and their payload types.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/louisbrulenaudet/monorepo-template/service-bindings
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 service-bindings

README.md
[![agentmods](https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/service-bindings/github.svg)](https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/service-bindings)
Your own site
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/service-bindings"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/service-bindings/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 service-bindings

Your own site · 80×15
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/service-bindings"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/service-bindings.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 640 This file is loaded in full into every session.
When invoked 640 The same file — it is already loaded in full.
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.00640 $0.00640
Opus 5.5 $0.00256 $0.00256
Sonnet 5.5 $0.00128 $0.00128
Haiku 4.5 $0.00064 $0.00064

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

Security

Grade A, and why

service-bindings 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 16d ago.

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/backend/service-bindings.mdc · 30 lines

How it starts

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

Service Bindings (Worker-to-Worker RPC)

Caller

  • Bind by Worker-name string in the caller's env: FOO: bindings.worker({ worker: "worker-foo-production" }), the name taken from the Deployment table so each mode binds the callee's matching Worker. exportName selects a named WorkerEntrypoint export (default: the default export) and is required when binding a named class.
  • A string reference types the binding as a plain Fetcher, without RPC method types. The cf docs' typed form passes the callee's defineWorker config, which imports another app's cloudflare.config.ts and fails pnpm boundaries (boundaries.mdc). Typed cross-Worker RPC is deferred to the first worker-*; decide it in that change. Never augment Env by hand to type a binding.
  • Call env.BINDING.method() from a route handler or service module, and await every call: RPC client methods are always async. Never env.BINDING.fetch() when RPC methods are the goal; the exception is a cacheable hot read path (workers-cache.mdc).
  • Payload schemas live in @repo/dtos-common/rpc (contracts.mdc).
  • Cloudflare propagates no custom id across a binding: pass requestId as an explicit RPC argument (or queue message field) and log it the same way; traces nest on their own.

Callee

  • Extend WorkerEntrypoint from cloudflare:workers and add public methods - those are what callers invoke. RPC methods cannot live on a plain export default { fetch } handler.
  • Default-export the entrypoint class, or export a named class and set exportName on the caller.
  • Bindings are this.env (a class property of WorkerEntrypoint: this.env.GREETING, this.env.D1); RPC methods take only their own arguments, no request / env parameters.

After a binding change

  1. Callee: exported WorkerEntrypoint class with public RPC methods.
  2. Caller: bindings.worker() in cloudflare.config.ts, named per mode.
  3. Shared payload schemas in dtos-common/rpc if needed.
  4. pnpm types, then pnpm check-types.
  5. The first worker-* binding also adds the createTestHarness Node suite (checklist in packages/vitest-config/AGENTS.md), keeping the pool suites.

Read the full file on GitHub · 30 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. 16d ago First seen · 30 lines · 640 tokens per session scan A aeb5e2ab0f8a

Subscribe to this mod's changes

service-bindings is a cursor rule published in the GitHub repository louisbrulenaudet/monorepo-template (19 stars, last pushed today), licensed Apache-2.0. It adds 640 tokens to every session, about $0.0026 per session on Opus 5.5. 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-30.