Back to list
gilberth

anti-hallucination

by gilberth

OpsIdentity - Enterprise Active Directory Hygiene, Architecture & Configuration Drift Platform

0🍴 0📅 Jan 14, 2026

SKILL.md


name: anti-hallucination description: "Validates AI prompts and LLM findings against source data to prevent hallucinations. Use when: (1) Adding new analysis prompts to server.js, (2) Reviewing prompts for hallucination risks, (3) Implementing validation rules in ATTRIBUTE_VALIDATION_RULES, (4) Auditing that findings match source JSON data" license: Proprietary

Anti-Hallucination Validation for OpsIdentity

Overview

This skill ensures LLM-generated findings are grounded in actual data. It prevents the AI from inventing object names, inflating counts, or claiming attributes that don't exist in the source JSON.

When to Use This Skill

Invoke this skill when:

  1. Adding NEW analysis prompts to server.js
  2. Reviewing EXISTING prompts for hallucination risks
  3. Implementing NEW ATTRIBUTE_VALIDATION_RULES
  4. Debugging findings that contain suspicious data

Quick Validation Checklist

Before deploying any prompt changes, verify:

In the Prompt (server.js)

  • Contains ⚠️ REGLA ANTI-ALUCINACIÓN: Solo reporta objetos que aparezcan EXPLÍCITAMENTE en los datos
  • Specifies type_id for each finding type
  • Requires affected_objects con nombres REALES
  • Limits objects: máximo 10, luego "...y X más"

In ATTRIBUTE_VALIDATION_RULES (server.js)

  • Every type_id has a corresponding validation rule
  • Rule includes correct category and identifierField
  • validate function checks actual attributes
  • For nested data, includes validateAffectedObject

Audit Commands

# Check prompts have anti-hallucination rules
grep -c "ANTI-ALUCINACIÓN" server/server.js

# List all validation rules
grep -E "'[A-Z_]+': \{" server/server.js | wc -l

# Check validation is being called
grep "validateFindings\|validateAttributes" server/server.js

# Find hallucination blocking logs
grep "BLOCKING.*HALLUCINATION" server/server.js

Validation Rule Template

'NEW_FINDING_TYPE_ID': {
  category: 'CategoryName',
  identifierField: 'Name',
  validate: (obj) => obj.Enabled && obj.RiskyAttribute === true,
  // For nested data structures:
  validateAffectedObject: (objName, parentObj) => {
    return parentObj.NestedArray?.some(item =>
      item.toLowerCase().includes(objName.toLowerCase())
    );
  }
}

Common Hallucination Patterns

PatternDetectionAction
Invented namesObject not in source data🛑 BLOCK
Inflated countsaffected_count > affected_objects.length⚠️ FIX
Wrong attributesObject exists but attribute value differs🛑 BLOCK
Generic namesContains "test", "ejemplo", "sample"⚠️ FLAG

Integration with Workflow

This skill enforces Step 4 of the mandatory workflow in CLAUDE.md:

PS1 → LLM Prompt → DOCX → [Anti-Hallucination Validation]
                              ↓
                    validateFindings()
                    validateAttributes()
                    validateAffectedObject()

Reference Documentation

Read anti-hallucination.md for complete validation patterns and implementation details.

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon