What problem does it solve? AI chatbots introduce a new attack surface where users can manipulate LLM behavior through prompt injection, jailbreak attempts, and encoding bypasses, potentially extracting system prompts, leaking other users' data, or causing cost explosions through token exhaustion. ## Core Features & Use Cases - Injection Pattern Blocking: Detects 49 regex patterns covering system prompt overrides, DAN-mode jailbreaks, SQL injection, command injection, and XSS payloads in chat input. - Encoding & DoS Defense: Blocks hex, unicode, and URL-encoded attacks, enforces special character ratio limits, and detects repetitive prompts designed for token exhaustion. - Server-Side Validation with Rate Limiting: The validatePromptServer function adds per-session request limits and suspicious-pattern logging for security monitoring. - Use Case: When building a Next.js API route that sends user messages to OpenAI or Anthropic, wrap the handler with validatePromptServer plus withRateLimit and withCsrf middleware so malicious prompts are rejected with HTTP 400 before ever reaching the LLM. ## Quick Start Use the ai-chat-protection skill to add prompt validation to my AI chat API route.