agentleFS
RidhuanDEVRidhuanDEV/claude-skills/shadow-ai-eng/SKILL.md

shadow-ai-eng

Skill1 starsChanged 7 days agoMITView on GitHub

Use when building LLM runtimes, structured outputs, tool calling, MCP servers, agent approvals, and provider fallback. Not for eval (/shadow-eval).

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 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.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill whenever the Monarch builds or troubleshoots production LLM features, multi-provider AI gateways, structured outputs, …

    line 8
  2. Very specific:

    Static Prefix Prompt Caching & Context Compaction: Keep [Static System + Tool Schemas] strictly byte-identical at the prefix (never inject …

    line 14
  3. Very specific:

    Run offline checks (L0/L1, zero LLM API calls) before claiming VERIFIED-LOCAL:

    line 20
  4. Distinctive:

    Do not load unrelated references unnecessarily.

    line 43

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Shadow AI Engineering (/shadow-ai-eng) — Production LLM, Agents & MCP Systems

Use this skill whenever the Monarch builds or troubleshoots production LLM features, multi-provider AI gateways, structured outputs, tool-calling agents, context compaction, hybrid RAG runtimes, streaming SSE chat UX, or hardened MCP servers.

1. Core Production AI Engineering Non-Negotiables

  1. Zero-Trust Structured Outputs & Tool Boundaries: Use provider native Structured Outputs + runtime Zod/Pydantic validation (zero regex JSON parsing or as Type casts). NEVER expose tenantId, userId, rawSql, or shellCommand as LLM tool args — inject session.tenantId server-side, wrap untrusted RAG/tool outputs as passive data, and require HITL confirmation + idempotency_key on mutating/financial tools.
  2. Bounded Gateways, Loops & Token Caps: Pin immutable model snapshots behind an AiGatewayPort with explicit timeouts, bounded Full-Jitter retries, circuit breakers, eval-verified fallbacks, MAX_STEPS <= 8–10 loop guards, and hard max_output_tokens + thinking_budget ceilings.
  3. Static Prefix Prompt Caching & Context Compaction: Keep [Static System + Tool Schemas] strictly byte-identical at the prefix (never inject timestamps/UUIDs at line 1!), truncate giant tool outputs, compact long histories without dropping position 0, and scope memory strictly by (tenantId, userId).
  4. Cancellable SSE Streaming & Stdio-Clean MCP: Emit X-Accel-Buffering: no + Cache-Control: no-cache, no-transform + AbortController linked to client disconnect. For stdio MCP servers: keep stdout 100% JSON-RPC only (redacted logs strictly to stderr), enforce canonical realpathSync path jails, and exit cleanly on stdin EOF (Rule #29).
  5. Cross-Skill Ownership: Delegate retrieval indexing/ranking to /shadow-search, RAG/agent evals & OWASP LLM red-teaming to /shadow-eval, and FOCUS token-cost governance to /shadow-finops.

2. Deterministic Verification CLI & Scenario Benchmarks

Run offline checks (L0/L1, zero LLM API calls) before claiming VERIFIED-LOCAL:

python "shadow-ai-eng/scripts/ai_runtime_verifier.py" --self-test
python "shadow-ai-eng/scripts/ai_runtime_verifier.py" --check-tool-spec path/to/tools.json
python "shadow-ai-eng/scripts/ai_runtime_verifier.py" --check-prompt-layout path/to/prompt_cfg.json
python "shadow-ai-eng/scripts/ai_runtime_verifier.py" --check-mcp-config path/to/mcp_cfg.json
python -m unittest discover -s "shadow-ai-eng/tests" -v

Graded specialist scenarios live in evaluations.md (8 scenarios covering slow RAG TTFT + indirect tool injection, LLM-supplied tenantId/rawSql, broken prefix caching, uncancelled SSE streams, context compaction, and stdio MCP stdout corruption).

Reference Guide

Load only the 1–2 modules matching the active subtask (never load all 6 at once):

Task / ScenarioTierLoad Reference
Multi-provider AI gateways, pinned models, circuit breakers, eval-verified fallbacks & quotasCOREreferences/01-llm-app-architecture-and-gateways.md
Structured Outputs, Zod/Pydantic validation, server-injected tenantId, HITL & untrusted tool outputsCOREreferences/02-structured-outputs-and-tool-trust-boundaries.md
Bounded agent step loops (MAX_STEPS), context compaction, tool truncation & tenant memory privacyCOREreferences/03-agent-state-compaction-and-memory-privacy.md
Hybrid RAG runtime, static prefix prompt caching, <retrieved_context> delimiters & 5-stage TTFTADVANCEDreferences/04-hybrid-rag-runtime-and-prompt-caching.md
Cancellable SSE streaming (AbortController), Nginx zero-buffering headers & typed stream framesADVANCEDreferences/05-streaming-sse-ux-and-cancellation.md
Hardened stdio/HTTP MCP servers (stderr logs, realpathSync jail, EOF exit) & incident triageSPECIALISTreferences/06-mcp-server-engineering-and-troubleshooting.md

Do not load unrelated references unnecessarily.

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.