Hallucination Prevention logo

Hallucination Prevention

Organization
DevelopersGlobal
hallucination-prevention

Detects and mitigates LLM hallucinations in production pipelines. Validates AI-generated facts, code, and decisions before they reach end users or downstream systems.

Overview

PublisherDevelopersGlobal
Repositoryai-agent-skills
Skill namehallucination-prevention
Stars
212
Forks
33
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by DevelopersGlobal on GitHub. Read the source before you install it.

Installation

Install the Hallucination Prevention AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/DevelopersGlobal/ai-agent-skills/tree/main/skills/hallucination-prevention
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/DevelopersGlobal/ai-agent-skills.git /tmp/ai-agent-skills
mkdir -p .claude/skills
cp -r /tmp/ai-agent-skills/skills/hallucination-prevention .claude/skills/hallucination-prevention
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Hallucination Prevention in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Hallucination Prevention on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Hallucination Prevention is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Overview

LLMs hallucinate — they generate plausible-sounding but factually incorrect content with high confidence. In production systems, hallucinations cause incorrect medical advice, broken code, wrong legal citations, fabricated API calls, and erroneous financial data.

This skill builds hallucination detection and mitigation into your AI pipeline architecture — before output reaches users or downstream systems.

When to Use

  • Any AI pipeline where factual accuracy matters
  • When agents generate code, SQL, or API calls that will be executed
  • When agents retrieve information that will influence decisions
  • RAG (Retrieval-Augmented Generation) systems
  • Agentic pipelines with tool use and multi-step reasoning

Process

Step 1: Classify Your Hallucination Risk

  1. Map all AI outputs in your system. For each, classify:
    • Critical: Incorrect output causes harm (medical, legal, financial, code execution)
    • High: Incorrect output wastes significant user/system resources
    • Medium: Incorrect output is annoying but recoverable
    • Low: Incorrect output is cosmetic
  2. Apply this skill's full rigor to Critical and High outputs. Lighter checks for Medium and Low.

Verify: Every AI output in your pipeline has a hallucination risk classification.

Step 2: Ground LLM Outputs

  1. For factual queries: always provide source documents in the prompt (RAG pattern). Instruct the model to cite sources and refuse to answer if the information isn't in the provided documents.
  2. For code generation: run the code in a sandbox and verify it produces the expected output before returning to the user.
  3. For structured outputs (JSON, SQL, etc.): validate against a schema before using.
  4. For numerical claims: require the model to show its work step-by-step and verify key calculations independently.

Verify: Every Critical/High output is grounded in provided sources or verified by execution.

Step 3: Build Verification Layers

  1. Self-consistency checking: Ask the model the same question 2–3 ways and compare answers. Divergent answers signal uncertain ground.
  2. Chain-of-thought with verification: Prompt the model to reason step-by-step, then verify the reasoning chain, not just the conclusion.
  3. Separate generation from verification: Use one prompt to generate, a different prompt to critically evaluate. Never use the same model call for both.
  4. Human-in-the-loop for Critical outputs: Require human review before Critical AI-generated content reaches end users.

Verify: Critical outputs have at least two independent verification mechanisms.

Step 4: Design Fail-Safe Defaults

  1. When the model is uncertain, it should say so — never present uncertain information as confident fact.
    • Prompt pattern: "If you're not sure, say 'I don't know' rather than guessing."
  2. Confidence scores: Where available, expose confidence thresholds. Route low-confidence outputs to human review.
  3. Graceful degradation: If the AI cannot answer accurately, show the user relevant source documents instead.

Verify: The system has a defined behavior for when AI confidence is low.

Step 5: Monitor for Hallucinations in Production

  1. Log all AI inputs and outputs.
  2. Implement feedback mechanisms (thumbs up/down, explicit corrections).
  3. Regularly audit a sample of outputs for accuracy.
  4. Track and alert on: sudden changes in output patterns, high user correction rates, model responses contradicting grounded sources.

Verify: A feedback mechanism exists and hallucination incidents are tracked.

Common Rationalizations (and Rebuttals)

ExcuseRebuttal
"This model is highly accurate"All LLMs hallucinate. Accuracy ≠ 100%. Design for the failure case.
"Users will catch errors"Users often can't distinguish hallucinated content from real content. Don't rely on them.
"It's a demo/MVP"Hallucinations that reach demos become the baseline expectation. Fix them early.
"We'll add verification in v2"Hallucinations that cause harm in v1 may not give you a v2.

Red Flags

  • AI-generated code is executed without testing or sandbox verification
  • AI-generated facts are displayed without source citations
  • No human review for medical, legal, or financial AI outputs
  • The same model is used to generate and verify its own output
  • No logging or monitoring of AI outputs in production

Verification

  • All AI outputs classified by hallucination risk
  • Critical/High outputs are grounded in source documents or execution
  • At least two independent verification mechanisms for Critical outputs
  • System has a defined low-confidence fallback behavior
  • Human-in-the-loop for Critical outputs
  • Production monitoring and feedback mechanism in place

References

Frequently asked questions

What does the Hallucination Prevention AI skill do?

Detects and mitigates LLM hallucinations in production pipelines. Validates AI-generated facts, code, and decisions before they reach end users or downstream systems.

Why use Hallucination Prevention on TypingMind?

Because you install it once and use it with any model. Hallucination Prevention is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Hallucination Prevention in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/DevelopersGlobal/ai-agent-skills/tree/main/skills/hallucination-prevention. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Hallucination Prevention?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Hallucination Prevention?

As many as you like. As long as a model supports skills, you can use Hallucination Prevention with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Hallucination Prevention AI skill free?

Yes. It is published on GitHub by DevelopersGlobal under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇