Legal Hallucination Validator: Verifying Legal Statutes and Case Numbers in AI Text Using Authoritative Sources

Introduction

When using Large Language Models (LLMs) to draft legal opinions, contract clauses, or research summaries, citations often appear complete and read like authentic provisions. However, they may be fabricated, misattributed, or based on invalid regulations. Manually verifying these against legal databases one by one is costly and prone to omissions. The following introduces the community Skill “Legal Hallucination Verifier” (法律幻觉校验器) on SkillHub, which delegates the workflow of “Extracting citations → Comparing with authoritative text → Providing a verdict” to an Agent to execute according to a fixed process.

What is this

“Legal Hallucination Verifier” is an Agent Skill following the standard SKILL.md format. Its coordinates are @user_0e939208/legal-verify, with the current version 1.0.0, categorized as professional, sourced from the community, and maintained by the publisher user_0e939208.

It addresses the following problem: verifying whether laws, regulations, specific legal articles, cases, and case numbers appearing in text under review are semantically consistent with authoritative sources, while also checking whether the regulations are still valid. It ultimately outputs verdicts such as “Consistent,” “Inconsistent,” or “Miss” (unmatched), and attempts to attach the authoritative original text to facilitate manual review.

Official Entrances:

  • SkillHub Page: https://www.skillhub.cn/skills/user_0e939208/legal-verify
  • Skill Package URL: https://api.skillhub.cn/user_0e939208/legal-verify

Core Features

The following capabilities are derived from the SkillHub description and page details; details not present in the materials are not expanded upon.

  1. Auto-extract citations: Identify legal citation elements such as regulation names, article numbers, cases, and case numbers from the given text.
  2. Authoritative comparison: Compare extraction results against authoritative sources to perform semantic consistency verification.
  3. Validity check: Check whether the cited regulations are still in valid status (e.g., whether they have been amended or repealed).
  4. Structured conclusions: Output verdicts such as “Consistent,” “Inconsistent,” and “Miss”; provide authoritative original text when a match is found to aid in correction.
  5. Trigger convention: The Skill description requires that this Skill must be enabled when users request review, verification, or checking of legal citation accuracy, ask if there are hallucinations in legal text, or request the AI to draft legal documents containing legal citations.

The page tags indicate requires_api_key=true; API Token configuration must be completed on the SkillHub side before use.

Installation and Enablement

SkillHub provides two common paths: letting the Agent fetch the skill according to official installation documentation within a supported client, or using the CLI to install it to the current Agent’s skills directory.

Method 1: Let the Agent install via official documentation

The prompt for similar Skills on SkillHub is: Send the installation instructions to the AI and cite the official installation documentation and skill coordinates. For this Skill, you can phrase it as:

Please install @user_0e939208/legal-verify according to https://skillhub.cn/install/skillhub.md.

Cursor’s skills directory is generally ~/.cursor/skills/; Claude Code is ~/.claude/skills/; Codex is ~/.codex/skills/ or .agents/skills/ under the project. Refer to your current client for specifics; after installation, it must reside in a directory recognizable by the client.

Method 2: SkillHub CLI

If the CLI is not installed on your machine, you can first check the version:

command -v skillhub && skillhub --version

If not installed, follow the official documentation to perform a “CLI-only” installation:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only

Login (replace Token with the API key you created in your SkillHub personal center):

skillhub login \
  --key YourFullTokenHere \
  --host https://api.skillhub.cn

When installing the skill, you must use --dir to point to the current Agent’s skills directory; otherwise, it defaults to ./skills/ and may not be loaded by the client:

skillhub install @user_0e939208/legal-verify --dir ~/.cursor/skills/

Replace ~/.cursor/skills/ with the path you are actually using. For the API Token creation process, see the SkillHub tutorial: https://www.skillhub.cn/tutorials

Differences between clients (Cursor, Claude Code, Codex CLI, etc.) are mainly reflected in the skills directory location; the installation command itself follows SkillHub documentation. Do not write client-specific parameters that cannot be verified.

Typical Usage

The materials do not provide fixed CLI subcommands or example JSON. The reproducible usage is: assuming the skill is installed and the API Key is configured, hand the text to be checked to the Agent and clearly state the verification intent in the conversation. Typical phrasing in the Skill description includes:

Please use the Legal Hallucination Verifier to review whether the legal articles and case numbers in the following paragraph are accurate, marking inconsistent items and providing the authoritative original text.

[Paste contract clauses, legal opinion, or model-generated research summary]

In drafting scenarios, you can perform a verification before and after generation, for example:

Draft a liability for breach of contract clause containing references to the "Civil Code," and after writing, use the Legal Hallucination Verifier to check if the citations contain hallucinations.

The Agent follows the Skill workflow to extract citations, compare them with authoritative sources, and return “Consistent / Inconsistent / Miss” along with original text fragments; you make the final manual ruling on “Miss” or “Inconsistent” items.

Applicable Scenarios & Notes

Who it is for

  • Legal professionals, paralegals, compliance personnel: Quickly screen citations in AI-drafted or organized documents and memos.
  • Teams doing legal-related development with Cursor, Claude Code, etc.: Solidify “citation verification” as a Skill to reduce missed verbal reminders.

Usage Notes

  • This Skill is from a community source; conclusions should be used as auxiliary verification and cannot replace professional judgment and formal legal opinions.
  • SkillHub API Key configuration is required (requires_api_key=true); backend capabilities cannot be called as designed without login or configuration.
  • “Miss” indicates failure to align with the authoritative library; this does not necessarily mean the citation in the text is incorrect, requiring manual judgment based on context.
  • The rating shown on the SkillHub page is 100000, with approximately 7626 downloads (based on page statistics, subject to change over time).

Conclusion

The Legal Hallucination Verifier transforms the check of “whether legal articles and case numbers hold up” from relying solely on visual inspection into a repeatable Agent workflow: extracting, comparing, checking validity, and outputting three types of verdicts all in one go. If you frequently ask models to write legal text with citations in conversations, you can install @user_0e939208/legal-verify on SkillHub and configure the API Key. Official page: https://www.skillhub.cn/skills/user_0e939208/legal-verify

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye