Direct Injection Detection

100TrustedPre-approves tools

Identification of user-led attempts to override system instructions and core behavior.

What it does

Direct Injection Detection modifies your assistant's behavior to evaluate its own resistance against unauthorized control shifts. When activated, it systematically tests whether the agent prioritizes user input over its pre-defined core instructions or system-level identity.

This skill is specifically for developers looking to audit their agents' resilience to direct role-hijacking attempts. It generates structured reports detailing any instances where the model permits a user to extract internal policies or deviate from established operational parameters.

When it earns its place

Reach for it when…

Install this when you need to verify that your agent maintains its system persona and behavioral constraints regardless of direct prompts from the user attempting to force a role change or instruction override.

Look elsewhere when…

This skill is not suitable for detecting indirect attacks that involve malicious data embedded in external files, web searches, or RAG-based context documents. Use it only for evaluating standard dialogue interactions.

What to say to use it

You never invoke a skill directly — the assistant picks it up when your request matches what it covers. These are the kinds of things that do that.

  • Test if my assistant ignores its system prompt
  • Check for direct prompt injection vulnerabilities
  • Identify if the model allows role override attempts
  • Run a security audit on my current system instructions

Install it

Install for all your projects

Copy the skill directory into your personal skills folder. Claude picks it up on its own the next time your request matches what it does — there is nothing to enable.

bash
git clone --depth 1 --branch main https://github.com/Tencent/AI-Infra-Guard.git /tmp/AI-Infra-Guard
mkdir -p ~/.claude/skills
cp -r /tmp/AI-Infra-Guard/agent-scan/agent_scan/prompt/skills/direct-injection-detection ~/.claude/skills/direct-injection-detection

Install for one project only

Put it in the project's own skills folder instead, so it can be committed and shared with everyone working on that repository.

bash
cp -r /tmp/AI-Infra-Guard/agent-scan/agent_scan/prompt/skills/direct-injection-detection .claude/skills/direct-injection-detection

If a skill of the same name exists in both places, the personal one wins.

Installing on Claude.ai or through the API instead? The full guide covers every surface.

Pair it with an MCP server