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.
git clone --depth 1 https://github.com/adaline/gatewayWrote 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.
[](https://agentmods.dev/rules/adaline/gateway/main)<a href="https://agentmods.dev/rules/adaline/gateway/main"><img src="https://agentmods.dev/badge/rules/adaline/gateway/main/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.
<a href="https://agentmods.dev/rules/adaline/gateway/main"><img src="https://agentmods.dev/badge/rules/adaline/gateway/main.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.03683 | $0.03683 |
| Opus 5.5 | $0.01473 | $0.01473 |
| Sonnet 5.5 | $0.00737 | $0.00737 |
| Haiku 4.5 | $0.00368 | $0.00368 |
Grade A, and why
main 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.
How it starts
The opening of the file, as written. The whole thing — 558 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Adaline Gateway Repository - Main Rules
Repository Overview
This is a TypeScript-based AI gateway service that provides unified interfaces for multiple AI providers (OpenAI, Anthropic, Google, etc.) with features like caching, queuing, analytics, and telemetry.
Core Architecture Principles
1. Type Safety & Schema Validation
Rules
- ALWAYS use Zod schemas for runtime validation
- ALWAYS export both the schema and inferred types
- NEVER use
anytype - use proper generic constraints - ALWAYS validate input/output at runtime using schemas
Instructions
// ✅ CORRECT: Define schema first, then type
import { z } from 'zod';
const UserConfig = z.object({
apiKey: z.string().min(1),
model: z.string().min(1),
temperature: z.number().min(0).max(2).default(1.0),
});
type UserConfigType = z.infer<typeof UserConfig>;
// Export both schema and type
export { UserConfig, type UserConfigType };
// ❌ INCORRECT: Using any type
function processData(data: any): any {
return data; // Unsafe and loses type information
}
// ✅ CORRECT: Proper typing with validation
function processData(data: unknown): UserConfigType {
return UserConfig.parse(data); // Validates at runtime
}
Implementation Steps
- Install Zod:
npm install zod - Define Schema: Create Zod schema with proper constraints
- Infer Type: Use
z.infer<typeof SchemaName>for TypeScript types - Export Both: Export schema for runtime validation, type for compile-time checking
- Validate Input: Use
schema.parse()orschema.safeParse()for validation
2. Error Handling
Rules
- ALWAYS use custom error classes extending
GatewayError - ALWAYS provide meaningful error messages with context
- ALWAYS handle errors gracefully with proper logging
- NEVER let unhandled errors bubble up
Instructions
// ✅ CORRECT: Custom error class with context
import { GatewayError } from "./errors";
export class ProviderConnectionError extends GatewayError {
constructor(
message: string,
public readonly provider: string,
public readonly statusCode: number,
public readonly originalError?: Error
) {
super(`Failed to connect to ${provider}: ${message} (Status: ${statusCode})`, "PROVIDER_CONNECTION_ERROR");
}
}
// Usage in code
try {
await provider.makeRequest();
} catch (error) {
if (error instanceof HttpError) {
throw new ProviderConnectionError("API request failed", "anthropic", error.status, error);
}
throw error;
}
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.
- 1mo ago First seen · 558 lines · 3,683 tokens per session scan A 7ce2d14e8b11
main is a cursor rule published in the GitHub repository adaline/gateway (607 stars, last pushed 2mo ago), licensed MIT. It adds 3,683 tokens to every session, about $0.0147 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-08-30.
Other cursor rules, from other repositories
tsoa-rules
This document outlines comprehensive guidelines and best practices for developing Node.js server-side applications with tsoa, focusing on TypeScript for type safety and OpenAPI specification generation.
tech-stack
This project uses.
backend-rules
A Cursor rule named backend-rules covering backend development, project structure, technology choices, runtime environment, and main process. Cursor is a coding editor with rules that guide how an agent works in a project.
ddd-design-guide
Apply when designing or refactoring domain models, services, stores, or discussing DDD (Domain-Driven Design) architecture. Also apply when working on business logic layers, API modules, or planning domain boundaries and migrations.
backend-python
Cursor rule "backend-python" from coeusyk/inference-x, covering backend python rules, stack assumptions, code style, fastapi conventions and schema conventions.
mcp-server
MCP (Model Context Protocol) server architecture and implementation.