gateway
CLAUDE.md608 starsChanged 8 months agoMITView on GitHub
Adaline Gateway is a production-grade unified SDK ("Super SDK") for calling 300+ LLMs through a single TypeScript interface. It is fully local (not a proxy), strongly typed, and isomorphic. It supports batching, retries, caching, callbacks, OpenTelemetry, and tool calling. Repository: https://github.com/adaline/gateway Per-package (run from package directory): When adding a new provider, follow existing providers (e.g., core/providers/openai/) as the template. Internal dependencies use workspace:* protocol. Commits follow conventional commits enforced by commitlint: - Format: type(scope): description - Types: feat, fix, chore,…
- Installs packages
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/gateway.mdcCursor rule
- .cursor/rules/main.mdcCursor rule
- .cursor/rules/provider.mdcCursor rule
- .cursor/rules/providers.mdcCursor rule
- .cursor/rules/types.mdcCursor rule
- add-modelSkill
- review-providerSkill
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 61
Every LLM provider follows the same structure under core/providers/<name>/:
- Very specific: line 66
When adding a new provider, follow existing providers (e.g., core/providers/openai/) as the template.
- Very specific: line 69
All types are defined as Zod schemas in packages/types/
- Distinctive: line 70
Always export both the Zod schema and the inferred TypeScript type
- Very specific: line 71
Never use any — use unknown with Zod validation at boundaries
- Very specific: line 74
Use custom error classes extending GatewayError in core/gateway/src/errors/
- Distinctive: line 75
Always provide meaningful error messages with provider context
- Very specific: line 104
All packages use: { root: true, extends: ["adaline"] } in .eslintrc.js
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md - Adaline Gateway
Project Overview
Adaline Gateway is a production-grade unified SDK ("Super SDK") for calling 300+ LLMs through a single TypeScript interface. It is fully local (not a proxy), strongly typed, and isomorphic. It supports batching, retries, caching, callbacks, OpenTelemetry, and tool calling.
Repository: https://github.com/adaline/gateway
Tech Stack
- Language: TypeScript 5.6
- Runtime: Node.js >=18
- Package Manager: pnpm >=9 (strictly enforced — never use npm or yarn)
- Build: tsup (ESM + CJS dual output)
- Monorepo: Turborepo
- Testing: Vitest
- Linting: ESLint (extends
eslint-config-adaline) - Formatting: Prettier (140 char width, double quotes, ES5 trailing commas)
- Validation: Zod schemas for all runtime types
- Git Hooks: Husky (pre-commit runs lint + test)
- Releases: Changesets
Repository Structure
core/
gateway/ — Main @adaline/gateway package (orchestrator, plugins, handlers)
providers/ — 12 LLM provider implementations (openai, anthropic, google, etc.)
packages/
types/ — @adaline/types — shared Zod schemas (Config, Message, Tool, Content)
provider/ — @adaline/provider — base provider interface and abstract classes
tools/
tsconfig/ — @adaline/tsconfig — shared TypeScript config
eslint-config/ — eslint-config-adaline — shared ESLint config
gateway-experiments/ — experimental toolsCommon Commands
pnpm install # Install all dependencies
pnpm run build # Build all packages (turbo)
pnpm run test # Run all tests (vitest)
pnpm run lint # Lint all packages
pnpm run format # Format with Prettier
pnpm run clean # Remove node_modules, dist, .turbo
pnpm run dev # Start dev mode (watch)Per-package (run from package directory):
pnpm run test # vitest run
pnpm run test:watch # vitest watch
pnpm run build # tsup
pnpm run lint # eslintArchitecture & Patterns
Provider Pattern
Every LLM provider follows the same structure under core/providers/<name>/:
src/configs/— model configuration objectssrc/models/— model schema definitions with Zodsrc/provider/— provider class implementing the base interface from@adaline/provider
When adding a new provider, follow existing providers (e.g., core/providers/openai/) as the template.
Type System
- All types are defined as Zod schemas in
packages/types/ - Always export both the Zod schema and the inferred TypeScript type
- Never use
any— useunknownwith Zod validation at boundaries
Error Handling
- Use custom error classes extending
GatewayErrorincore/gateway/src/errors/ - Always provide meaningful error messages with provider context
Plugin System
The gateway supports plugins in core/gateway/src/plugins/:
- Cache plugins (custom cache implementations)
- Logger plugins (custom logging)
- Telemetry (OpenTelemetry integration)
Build Output
Each package compiles via tsup to:
dist/index.js(CJS)dist/index.mjs(ESM)dist/index.d.ts(types)
Dependencies Between Packages
All providers → @adaline/types + @adaline/provider
@adaline/gateway → @adaline/types + @adaline/provider
All packages → @adaline/tsconfig (build config)Internal dependencies use workspace:* protocol.
Code Style
- Prettier: 140 char width, double quotes, 2-space indent, ES5 trailing commas, LF line endings
- Import order (enforced by prettier plugin): third-party →
@adaline/*→ relative imports - ESLint: extends turbo + TypeScript + Prettier
- All packages use:
{ root: true, extends: ["adaline"] }in.eslintrc.js
Commit Convention
Commits follow conventional commits enforced by commitlint:
- Format:
type(scope): description - Types: feat, fix, chore, docs, refactor, test, perf, ci, build, style, revert
Release Process
Releases are managed via Changesets + GitHub Actions:
- Create changeset:
pnpm run changeset - Version packages:
pnpm run version - Release is triggered manually via GitHub Actions workflow on
main
Environment Variables
HTTP_PROXY,HTTPS_PROXY,NO_PROXY— proxy configurationADX_NODE_ENV— environment modeADX_ANALYTICS_ENABLED— analytics toggle- Provider-specific API keys are passed at runtime, not via env vars
Important Notes
- This is an npm-distributed library, not a deployed service — no Docker
- Pre-commit hooks run
pnpm run lintandpnpm run test— ensure both pass - Turbo caches build outputs in
dist/**— runpnpm run cleanif you see stale artifacts - The
.changeset/directory manages release versioning — don't modify manually
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

