ai-proxy-guard
Skill0 starsChanged 5 months agoMITView on GitHub
Build a server-side proxy for LLM calls with response caching, rate-limiting, context caps, and per-call cost logging — keeping API keys off the client. Use whenever an app calls an LLM.
In this repository7 other files it gives its agents.
- consent-complianceSkill
- context-checkpointSkill
- monorepo-bootstrapSkill
- review-gateSkill
- rls-securitySkill
- security-reviewSkill
- test-and-fixSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Stop apps from calling LLM providers directly from the client (which leaks keys and blows up cost).
- Distinctive: line 13
ONLY in server env vars — never in the client bundle.
- Distinctive: line 25
No key is in any client bundle.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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
ai-proxy-guard
Stop apps from calling LLM providers directly from the client (which leaks keys and blows up cost). Route every model call through a small server-side proxy with guardrails.
Build
- Server-side route that forwards requests to your LLM provider. The provider API key lives ONLY in server env vars — never in the client bundle.
- Auth check — only authenticated/authorised callers can hit the proxy.
- Input validation — validate and bound the request (schema + max input size). Treat user free-text as untrusted (consider prompt-injection).
- Context cap — trim the input to the minimum needed (e.g. a recent window), not everything.
- Caching — cache responses for inputs that repeat or change slowly; serve cache hits cheaply.
- Rate-limiting — per-user/IP limits to stop abuse-driven spend.
- Cost logging — log tokens + cost per call so spend is observable and capped.
- Batch where possible — prefer scheduled/batched calls over per-keystroke calls for non-interactive features.
Done when
No key is in any client bundle; cache + rate-limit + cost-cap are verified by tests; a sample call logs its cost.
Token tactics
This skill IS token optimisation: caching + context caps + batching are the levers. Build the proxy once; every feature reuses it. Bake any static prompt templates as files (built once), not regenerated at runtime.
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.

