llm-runtime-safety-and-integration

Integrate LLM calls with provider routing, prompt versioning, fallback handling, and trace logging.

Updated Dec 24, 2025
One-click install
npx skills add https://github.com/JoyJoin-Tech-Limited/JoyJoin_app_v0.1 --skill llm-runtime-safety-and-integration-joyjoin-tech-limited
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: llm-runtime-safety-and-integration
Source: https://github.com/JoyJoin-Tech-Limited/JoyJoin_app_v0.1/tree/main/.github/skills/llm-runtime-safety-and-integration
Command: npx skills add https://github.com/JoyJoin-Tech-Limited/JoyJoin_app_v0.1 --skill llm-runtime-safety-and-integration-joyjoin-tech-limited

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Adding LLM-backed features to a live server risks unobservable model calls, silent failures, and AI output leaking into deterministic product logic like matching scores or onboarding gates. This Skill enforces safe runtime integration patterns so every model call is routed, traced, versioned, and fail-safe. ## Core Features & Use Cases - Provider Routing & Fallbacks: Route all model calls through approved surfaces like socialModelRouter.ts and creativeModelRouter.ts, with explicit fallback chains to curated deterministic content. - Observability & Trace Metadata: Emit non-PII AITrace logs with provider, latency, success, promptVersion, fallbackUsed, fromCache, and generatedAt fields. - Shadow-Mode Inference: Run new prompts in parallel with live paths, storing shadow output separately for offline comparison before rollout. - Use Case: When adding an AI match-explanation feature, route the call through the owning AI service, tag it with a promptVersion, log it via logAITrace(...), and keep the deterministic matching decision entirely outside the generated text. ## Quick Start Ask the AI to add a new LLM-backed explanation call to the server that routes through socialModelRouter, logs an AITrace with promptVersion, and falls back to curated content on provider failure.

Frequently Asked Questions about llm-runtime-safety-and-integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add an LLM call to an Express server safely?▼

Route the call through an approved service surface like socialModelRouter.ts rather than instantiating ad-hoc clients in route handlers. Log the call with logAITrace(...), tag it with a promptVersion, and define an explicit fallback path for provider failure or timeout.

How do I implement prompt versioning for LLM features?▼

Thread a promptVersion string through response and cache metadata using semantic versioning like match-explain-v2. Bump the version whenever prompt text, schema constraints, or temperature change, and include it in cache keys so template changes invalidate stale entries.

What is shadow-mode inference and how do I set it up?▼

Shadow mode runs a new prompt in parallel with the live path without affecting production output. Log trace metadata for both paths, store shadow output in a separate column or table, and compare results offline before clearing the rollout gate.

Can AI output influence deterministic matching or routing logic?▼

No. Matching scores, onboarding routing, auth gates, and server-owned phase transitions must remain fully deterministic. AI output belongs in explanation, enrichment, or shadow-only paths; anything else is a boundary violation.

Why does my AI feature have no trace data in production?▼

The call site is likely missing logAITrace(...) instrumentation. Verify the call routes through the owning AI service and that trace fields like provider, latencyMs, success, and promptVersion are populated with non-PII values only.

What fields should LLM trace logging include?▼

Required non-PII fields are provider, latencyMs, success, promptVersion, and fallbackUsed. Optional fields include fromCache, generatedAt, modelName, and tokenUsage. Never log PII or user-generated content in trace payloads.