engineering-conventions

A set of engineering rules for TypeScript and Cloudflare Workers projects. It covers types, input validation, shared code, error handling, testing, and the boundary between Node.js and Workers code.

In plain words
What is it for?
Use it to guide TypeScript code, validate webhook and API inputs, share types, configure package boundaries, handle errors, and define testing expectations.
Why use it?
It prevents inconsistent patterns, unsafe handling of external data, and type conflicts between different JavaScript runtime environments. It also keeps the same operation aligned across command-line, API, web, and MCP surfaces.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/webhook-co/webhook/engineering-conventions
Clone the repo
git clone --depth 1 https://github.com/webhook-co/webhook

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 787 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00787
Opus 5 $0.00000 $0.00394
Sonnet 5 $0.00000 $0.00157
Haiku 4.5 $0.00000 $0.00079

Measured yesterday against content hash 4b097f0ba44e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

engineering-conventions 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 yesterday.

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/engineering-conventions.mdc · 56 lines

How it starts

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

Engineering conventions (TypeScript / Workers)

Language & types

  • TypeScript everywhere, strict on. No any unless justified with a comment; prefer unknown + narrowing. Validate all external input (webhook bodies, API params) at the boundary with a schema.
  • Keep shared/ the home for cross-surface types. The same operation across CLI / API / web / MCP should share types — don't redefine payloads per surface.
  • Node↔Workers tsconfig boundary. Packages export source for live cross-package types, but a Node-typed package (types: ["node"]) and a Workers-typed one (types: ["@cloudflare/workers-types"]) must never recompile each other's source — the lib worlds disagree (e.g. @types/node's Uint8Array<ArrayBufferLike> vs the DOM BufferSource for WebCrypto). So an internal dependency edge that crosses that boundary resolves to the dep's built dist/*.d.ts via tsconfig paths, not its source; same-world edges stay on source. Use the @webhook-co/*dist wildcard when every internal dep crosses (db); use an exact @webhook-co/<pkg> redirect when only some do (api/mcp → db). The tsconfig-boundary guard (scripts/tsconfig-boundary.mjs, wired into lint and CI) fails the build if a cross-boundary edge isn't redirected.

Workers / Durable Objects

  • Workers handlers stay thin: validate → delegate → respond. ACK ingestion fast; do delivery work off the request hot path (via the DO + alarms), not inline.
  • One Durable Object per endpoint is the ordering/isolation primitive — preserve FIFO semantics and never share a DO across endpoints.
  • Schedule retries/backoff with DO Alarms, not hot-path queues. Make delivery idempotent and dedup by event id.
  • Never block on long outbound work in a Worker; route heavy/blocking delivery through the container-delivery seam (don't bypass the interface).
  • Use bindings (KV, R2, Hyperdrive, DO) — never hardcode endpoints or credentials.

Error handling

  • Fail loud internally, fail safe externally. Return Standard-Webhooks-correct status codes; don't leak internal errors, stack traces, secrets, or tenant data to responses or logs.
  • Errors are typed and actionable; wrap with context rather than swallowing. Retryable vs terminal failures must be distinguishable so the retry scheduler does the right thing.

Read the full file on GitHub · 56 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. yesterday First seen · 56 lines · 787 tokens per session scan A 4b097f0ba44e

Subscribe to this mod's changes

engineering-conventions is a cursor rule published in the GitHub repository webhook-co/webhook (0 stars, last pushed 6d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 787 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-31.