К основному содержанию
скилл CX Codex

secure-ai — скилл для Claude Code: защита LLM от инъекций

Скилл secure-ai для защиты LLM-слоя приложения: инъекции в промпт, проверка вывода модели, zero-trust для агентов с инструментами.

MIT 130 установок ★ 29 обновлён 2026-08-17

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add oakoss/agent-skills --skill secure-ai -a claude-code
Открыть на GitHub

Что делает secure-ai

Скилл разбирает защиту LLM-слоя по слоям: структурное разделение system- и user-сообщений, проверка входа быстрым классификатором до основной модели, валидация вывода как недоверенного ввода. Внутри — таблицы паттернов и типичных ошибок, десять рисков OWASP LLM Top 10 2025 с привязкой каждого к разделу, опора на NIST AI RMF 1.0.

Для агентов zero-trust выглядит так: права по подзадачам, подпись человека на разрушительных действиях, идентичность через OIDC с ротацией ключей. Для серверной части — server-only импорты, схемы Zod на действиях с моделью, лимиты токенов через Redis, вычистка чувствительных строк из стрима. MCP-серверы скилл считает недоверенными: allowlist инструментов и проверка входов и выходов.

Цепочка поставок описана как чек-лист: проверить происхождение модели, вести AI-BOM, гонять gitleaks в CI. Обычную веб-безопасность скилл не трогает — аутентификация и эндпоинты без модели остаются на своих правилах.

Какие задачи решает

  • Закрыть промпт-инъекции в чате поверх LLM
  • Проверить, что вывод модели не уходит в SQL или exec без обработки
  • Выдать агенту только те инструменты, что нужны для текущей подзадачи
  • Срезать внутренние ID и секреты из стрима ответа
  • Составить чек-лист по OWASP LLM Top 10 для своего пайплайна

Примеры запросов агенту

  • Проверь мой RAG-пайплайн на prompt injection и покажи, где system и user сообщения склеены в одну строку.
  • Агент вызывает MCP-инструменты — опиши allowlist и проверку входов и выходов.
  • Нужен чек-лист OWASP LLM Top 10 для серверных экшенов с Zod и лимитами токенов.

Как установить secure-ai

1Через Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill secure-ai -a claude-code

2Вручную: положить файлы

~/.claude/skills/secure-ai/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/secure-ai/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о secure-ai

Как установить secure-ai в Claude Code?

Выполните npx skills add oakoss/agent-skills --skill secure-ai -a claude-code. Файл скилла окажется по пути ~/.claude/skills/secure-ai/SKILL.md.

Что делает secure-ai?

Описывает защиту LLM-слоя: разделение инструкций и пользовательских данных, проверку вывода модели перед использованием, ограничение прав агентов и безопасные MCP-интеграции.

С какими стандартами он соотносится?

С OWASP Top 10 for LLM Applications 2025 и NIST AI RMF 1.0. Каждый из десяти рисков OWASP привязан к конкретному разделу скилла.

Исходный текст

SKILL.md · MIT
---
name: secure-ai
description: 'Secures AI integrations against prompt injection, privilege escalation, and data leakage. Use when implementing defense-in-depth for LLM pipelines, applying zero-trust controls to autonomous agents, hardening server actions that interact with AI services, validating model outputs, securing MCP tool integrations, or auditing AI system access patterns and identity management. Use for OWASP LLM Top 10, prompt injection defense, agentic security, AI supply chain.'
license: MIT
metadata:
  author: oakoss
  version: '1.0'
user-invocable: false
---

# Secure AI

## Overview

Secures AI integration layers through multi-layered defense, structural isolation, and zero-trust orchestration. Covers prompt injection defense, model output validation, agentic security, secure server actions, supply chain integrity, MCP tool security, and audit protocols for applications that interact with LLMs.

Aligned with the OWASP Top 10 for LLM Applications 2025 and the NIST AI Risk Management Framework (AI RMF 1.0). Provides coverage for all ten OWASP LLM risks with concrete defense patterns.

**When to use:** Securing LLM-powered features against prompt injection, validating and sanitizing model outputs before downstream use, implementing zero-trust for autonomous agents, hardening server actions for AI endpoints, securing MCP tool integrations, managing AI supply chain risks, auditing AI access patterns.

**When NOT to use:** General web application security without AI components, frontend-only security concerns, non-AI API hardening, basic authentication or authorization without AI involvement.

## Quick Reference

| Pattern                | Approach                                        | Key Points                                                 |
| ---------------------- | ----------------------------------------------- | ---------------------------------------------------------- |
| Structural isolation   | Separate system/user message roles              | Never mix instructions and user data in one string         |
| Input boundaries       | Delimit user data with markers                  | Helps models identify where untrusted data begins/ends     |
| Guardian model         | Pre-scan input with a fast classifier           | Detect injection patterns before main reasoning model      |
| Output validation      | Treat LLM output as untrusted input             | Context-aware encoding, parameterized queries, CSP headers |
| Least privilege        | Capability-based scopes per sub-task            | Agents get only the tools needed for current work          |
| Human-in-the-loop      | Require human sign-off for destructive actions  | Financial or data-altering events need approval            |
| Non-human identity     | OIDC-based agent authentication                 | Verifiable identity for every agent, rotate keys regularly |
| Server-only AI logic   | `server-only` imports for all AI code           | Keys and reasoning never leak to client bundle             |
| Input validation       | Zod schemas on all AI-facing server actions     | Never pass raw user input to AI services                   |
| Rate limiting          | Per-user/IP token budget via Redis              | Prevent denial-of-wallet attacks on AI endpoints           |
| Stream scrubbing       | Filter sensitive strings from AI output streams | Remove internal IDs, secrets before reaching client        |
| MCP tool security      | Allowlist tools, validate inputs/outputs        | Treat MCP servers as untrusted, enforce least privilege    |
| Supply chain integrity | Verify model provenance, maintain AI-BOM        | Track models, datasets, and dependencies with checksums    |
| Secret management      | Environment variables with CI leak scanning     | Use gitleaks in CI to prevent committed secrets            |

## Core Security Principles

1. **Isolation is absolute** -- user data must never be treated as system instruction
2. **LLM output is untrusted** -- treat all model responses as potentially malicious input before downstream use
3. **Least privilege for agents** -- grant only the tools needed for the current sub-task, revoke after completion
4. **Human verification of destruction** -- destructive or irreversible actions require a human signature
5. **No secrets in client** -- all AI logic and keys reside in server-only environments
6. **Adversarial mindset** -- assume both users and agents will attempt to bypass rules
7. **Defense in depth** -- layer defenses so that bypassing one layer does not compromise the system
8. **Supply chain verification** -- verify provenance and integrity of all models, datasets, and AI tools

## OWASP LLM Top 10 (2025) Coverage

| OWASP Risk                             | Reference                                                  |
| -------------------------------------- | ---------------------------------------------------------- |
| LLM01 Prompt Injection                 | Prompt Injection Defense                                   |
| LLM02 Sensitive Information Disclosure | Secure Server Actions (stream scrubbing, output filtering) |
| LLM03 Supply Chain                     | Supply Chain and MCP Security                              |
| LLM04 Data and Model Poisoning         | Supply Chain and MCP Security                              |
| LLM05 Improper Output Handling         | Output Validation and Encoding                             |
| LLM06 Excessive Agency                 | Agentic Zero-Trust Security (least privilege, HITL)        |
| LLM07 System Prompt Leakage            | Prompt Injection Defense (non-extractable prompts)         |
| LLM08 Vector and Embedding Weaknesses  | Output Validation and Encoding (RAG sanitization)          |
| LLM09 Misinformation                   | Output Validation and Encoding (semantic filtering)        |
| LLM10 Unbounded Consumption            | Secure Server Actions (rate limiting, token budgets)       |

## Common Mistakes

| Mistake                                                            | Correct Pattern                                                                                |
| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| Mixing user input and system instructions in the same prompt field | Use structural isolation with separate system and user message roles                           |
| Trusting LLM output and passing it directly to exec, eval, or SQL  | Treat all model output as untrusted; use parameterized queries and context-aware encoding      |
| Giving agents unlimited tool access for all tasks                  | Apply capability-based scopes granting only tools needed per sub-task                          |
| Using static API keys for AI service authentication                | Use OIDC with dynamic key rotation and short-lived tokens                                      |
| Loading third-party models without provenance checks               | Verify model checksums, use signed artifacts, maintain AI-BOM                                  |
| Granting MCP servers broad permissions without validation          | Allowlist MCP tools, validate all inputs/outputs, enforce human approval for sensitive actions |
| Passing raw user input directly to AI services                     | Validate all input with Zod schemas before AI processing                                       |
| Streaming AI responses without output filtering                    | Scrub sensitive strings from streams before they reach the client                              |

## Key Frameworks

- **OWASP Top 10 for LLM Applications 2025** -- industry standard for LLM vulnerability classification
- **NIST AI Risk Management Framework (AI RMF 1.0)** -- four-function framework (Govern, Map, Measure, Manage) for AI risk
- **NIST Cybersecurity Framework Profile for AI (NISTIR 8596)** -- guidelines for secure AI adoption
- **OWASP MCP Security Cheat Sheet** -- practical guide for securing third-party MCP server integrations
- **CycloneDX 1.6 / SPDX 3.0** -- standards supporting AI Bill of Materials (ML-BOM)

## Delegation

- **Scan codebase for prompt injection vulnerabilities**: Use `Explore` agent to search for user data flowing into system prompts and unvalidated inputs
- **Implement zero-trust agent orchestration**: Use `Task` agent to add identity verification, sandboxing, and human approval gates
- **Audit model output handling**: Use `Explore` agent to find LLM outputs passed to exec, eval, SQL, or rendered as HTML without sanitization
- **Review MCP tool configurations**: Use `Explore` agent to check MCP server permissions, tool allowlists, and authentication setup
- **Design secure AI integration architecture**: Use `Plan` agent to map trust boundaries, agent scopes, and audit requirements
- **Assess supply chain risks**: Use `Explore` agent to inventory third-party models, datasets, and MCP servers with provenance records
- **Set up security monitoring**: Use `Task` agent to configure audit logging, anomaly detection, and incident response alerts

> For general application security (OWASP Top 10, auth patterns, security headers, input validation), use the `application-security` skill. For database-layer security (RLS policies, audit trails, Postgres hardening), use the `database-security` skill.

## References

- [Prompt Injection Defense](references/prompt-injection-defense.md) -- multi-layered isolation, guardian models, input boundaries, indirect injection
- [Output Validation and Encoding](references/output-validation.md) -- zero-trust output handling, context-aware encoding, RAG sanitization
- [Agentic Zero-Trust Security](references/agentic-security-zero-trust.md) -- non-human identity, resource isolation, anomaly detection
- [Secure Server Actions](references/secure-server-actions.md) -- server-only patterns, input validation, rate limiting, stream security
- [Supply Chain and MCP Security](references/supply-chain-mcp.md) -- model provenance, AI-BOM, MCP tool hardening, data poisoning defense
- [Security Audit Protocols](references/security-audit-protocols.md) -- monitoring agent behavior, compliance checklists, incident response

© oakoss · MIT · oakoss/agent-skills

Похожие скиллы

Все скиллы по теме «Безопасность» →
detecting-ai-model-prompt-injection-attacks mukul975 Скилл detecting-ai-model-prompt-injection-attacks выявляет попытки инъекции в запросы к ИИ-моделям через регулярные выражения, анализ структуры и трансформатор DeBERTa. CX Codex +1 280установок llm-ai-hunter H-mmer Скилл llm-ai-hunter для Claude Code берёт на себя роль специалиста по безопасности LLM и агентных систем. Покрывает OWASP LLM Top 10 v2025 и OWASP Agentic AI Top 10 — от prompt injection до атак на MCP-серверы. CX Codex +1 ★ 1 298звёзд репо llm-security semgrep Скилл llm-security для Claude Code проверяет приложения с LLM на риски OWASP Top 10 for LLM 2025. Проверяет чат-боты, RAG, агентов и LLM API. CX Codex +1 1 800установок prompt-injection-test OWASP Скилл prompt-injection-test для Claude Code проверяет ИИ-приложение на промпт-инъекции по таксономии Arcanum PI Taxonomy. Проверяет защиту своего приложения. CX Codex +1 220установок ai-threat-testing transilienceai Скилл ai-threat-testing для Claude Code автоматически проверяет LLM-приложения на уязвимости OWASP Top 10 с помощью 10 специализированных агентов. CX Codex +1 210установок prompt-injection briiirussell Скилл prompt-injection для Claude Code проверяет приложения с LLM и агентов: где в промпт попадает чужой текст и что агент может сделать по чужой инструкции. CX Codex +1 481установок

Из того же набора106

Весь набор →
frontend-builder Скилл frontend-builder помогает спроектировать и собрать интерфейс на React или Next.js: от компонентов и состояния до форм, стилей и обработки ошибок. Пригодится при создании веб-приложения или выборе архитектуры. CX Codex +1 134установок mise Обучает агента работать с mise — менеджером версий инструментов, переменных окружения и задач. CX Codex +1 133установок data-visualizer Скилл data-visualizer помогает строить графики и дашборды на Recharts, Chart.js или D3.js с учётом адаптивности и доступности. CX Codex +1 133установок knowledge-base-manager Скилл knowledge-base-manager для Claude Code помогает выбрать архитектуру базы знаний и выстроить её поддержку. Охватывает отбор контента, контроль качества и версионирование. CX Codex +1 131установок python-uv Скилл python-uv обучает ИИ-агента вести Python-проекты через uv: от uv init и управления зависимостями до рабочих пространств и сборки пакетов. Помогает отказаться от связки pip и poetry. CX Codex +1 129установок rust Скилл подсказывает паттерны Rust для ownership, async-кода, веб-сервисов, CLI и тестов. Пригодится при разработке и ревью Rust-проектов. CX Codex +1 128установок github-cli Скилл github-cli обучает ИИ-агента шаблонам работы с утилитой gh: создание PR, разбор задач, запуск экшенов и запросы к GraphQL API прямо в терминале. CX Codex +1 128установок resend Помогает агенту настроить отправку писем через Resend API, шаблоны React Email, верификацию доменов и вебхуки Svix. CX Codex +1 127установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой