agentleFS
prasadmogulothuprasadmogulothu/agent-skills/ai-proxy-guard/SKILL.md

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.

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
  1. Distinctive:

    Stop apps from calling LLM providers directly from the client (which leaks keys and blows up cost).

    line 8
  2. Distinctive:

    ONLY in server env vars — never in the client bundle.

    line 13
  3. Distinctive:

    No key is in any client bundle.

    line 25

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. 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.
  2. Auth check — only authenticated/authorised callers can hit the proxy.
  3. Input validation — validate and bound the request (schema + max input size). Treat user free-text as untrusted (consider prompt-injection).
  4. Context cap — trim the input to the minimum needed (e.g. a recent window), not everything.
  5. Caching — cache responses for inputs that repeat or change slowly; serve cache hits cheaply.
  6. Rate-limiting — per-user/IP limits to stop abuse-driven spend.
  7. Cost logging — log tokens + cost per call so spend is observable and capped.
  8. 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.