hono-gateway

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

Rules for building Hono HTTP gateway Workers, which are small server programs that handle web requests on Cloudflare. They define the order of request checks and how routes call other services.

In plain words
What is it for?
They guide middleware order, request IDs, security headers, cross-origin access, CSRF protection, body limits, input validation, thin handlers, and service bindings.
Why use it?
They keep request handling consistent and ensure security, validation, limits, timeouts, and logging happen before business logic.

Cursor rule for Cursor

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

Good fit They guide middleware order, request IDs, security headers, cross-origin access, CSRF protection, body limits, input validation, thin handlers, and service bindings.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/hono-gateway"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/hono-gateway.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 2,742 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.02742
Opus 5.5 $0.00000 $0.01097
Sonnet 5.5 $0.00000 $0.00548
Haiku 4.5 $0.00000 $0.00274

Measured 1mo ago against content hash 01a43cd2e2e1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

hono-gateway 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 1mo 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/hono-gateway.mdc · 76 lines

How it starts

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

Hono Gateway (Workers) Rules

worker-api and sibling worker-* / webhook-* apps run Hono on Cloudflare Workers. Depth: skills hono, workers-best-practices.

Middleware order (src/index.ts)

Register in this order; "before" logic runs top-down, response mutation bottom-up. Steps 1-4 and the error handlers are individual exports of @repo/hono-middleware (AGENTS.md); each app registers them itself so the order stays visible in its index.ts.

Root app (every route):

  1. requestIdMiddleware - first, so every later middleware, errorHandler, and response can reference it. Mints crypto.randomUUID() into c.get("requestId"), tags request_id on the Sentry scope (withSentry opens the per-request isolation scope around app.fetch, before any middleware), and sets X-Request-Id after next(), so onError / notFound responses carry it. It never reads an inbound X-Request-Id: a caller-supplied id could carry a user identifier, and a shared id would no longer name one invocation.
  2. sentryMiddleware(app, { release }) - wraps sentry() from @sentry/hono/cloudflare, whose direct import oxlint blocks in apps. It reports c.error 5xx even when onError handles the error: never add captureException there. The locked-down dataCollection (no user info, cookies, headers, bodies, query params, frame variables, database query data, queue payloads, AI, GraphQL, or MCP inputs and outputs) and the console-breadcrumb drop live in the package; never loosen them per app.
  3. jsonMethodNotAllowed(app) - 405 plus Allow when the path exists but the method does not.
  4. apiSecureHeaders (hono/secure-headers) - defaults (HSTS, nosniff, no-referrer, COOP/CORP, X-Powered-By removed) plus CSP default-src 'none'; frame-ancestors 'none' (harmless for JSON, hardening if a response is ever rendered - keep it) and a permissionsPolicy denying camera/mic/geolocation/payment. CORP same-origin is fine for CORS-mode fetch from front-app; never disable it to fix SPA reads.
  5. cors() on /api/* (gateway-local src/middlewares/cors.ts) - preflight OPTIONS clears before auth/routes. Read the allowlist from c.env.CORS_ORIGINS per request (env is unavailable at module scope on Workers). exposeHeaders is CORS_EXPOSED_HEADERS from @repo/enums-common, so browsers can read X-Request-Id and X-Worker-Version-Id. An empty allowlist is permissive (*) in dev only; any other ENVIRONMENT (staging, production, typos) must set origins or /api/* returns 503. A single-label prefix wildcard (https://*-front-app-production.<subdomain>.workers.dev, three or more labels after the wildcard label) is honored only when ENVIRONMENT is AppEnvironment.PREVIEW; anywhere else it returns 503. CORS and the CSRF gate share the matcher in src/middlewares/cors-origins.ts.
  6. Origin / CSRF gate on /api/* (gateway-local) - unsafe methods only, any Content-Type including application/json; never blocks preflight. Allows when Origin is on the allowlist or Sec-Fetch-Site is same-origin / same-site. Hono's csrf() covers only form content-types, so never rely on it alone here. Browser JSON mutations rely on this gate plus CORS: never reintroduce a permissive CSRF in strict environments.

Read the full file on GitHub · 76 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. 1mo ago Changed 01a43cd2e2e1
  2. 1mo ago Changed · +1 lines 1c56d032e9de
  3. 2mo ago Changed · -42 lines f6914cad46a7
  4. 2mo ago Changed · +11 lines 9759e8980eaf
  5. 2mo ago Changed · +3 lines fd74b0764f69
  6. 2mo ago Changed · +12 lines 815f285d4bab
  7. 3mo ago First seen · 91 lines · 0 tokens per session scan A 708f7890a854

Subscribe to this mod's changes

hono-gateway is a cursor rule published in the GitHub repository louisbrulenaudet/monorepo-template (19 stars, last pushed 7d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,742 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-08-30.

Related

hono-gateway compared with cursor rules from other repositories

hono-gateway next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
hono-gatewaylouisbrulenaudet/monorepo-templateCursor rule197d agoApache-2.0A0Cursor
cloudflare-workers-autousrrname/cursorrulesCursor rule117mo agoISCA0Cursor
cloudflare-workers-hono-autousrrname/cursorrulesCursor rule117mo agoISCA0Cursor
cloudflare-email-telegram-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A720Cursor
knative-istio-typesense-gpu-cursorrules-prompt-filPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A613Cursor
netlify-official-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0C9,048Cursor
serverlessgirijashankarj/cursor-handbookCursor rule333mo agoMITA378Cursor