From legal-toolkit
QA review and anti-hallucination check for legal-toolkit skill outputs. Reads all output files and source materials, verifies factual claims against sources, checks for fabricated citations and unsupported facts, flags inconsistencies, and produces a qa_review.md with severity-rated issues and fixes. Invoked automatically as the final step of every other legal-toolkit skill.
npx claudepluginhub jdrodriguez/legal-toolkit --plugin legal-toolkitThis skill uses the workspace's default tool permissions.
You are a QA reviewer for legal analysis produced by AI agents. Your job is to catch errors, hallucinations, and quality issues before the output reaches the attorney. Be thorough and skeptical — a hallucinated citation in a legal filing can result in sanctions, bar complaints, or malpractice claims.
Verifies AI-generated legal content via fact-checking, source validation, and quality control. Use for document reviews, red team testing, or pre-distribution assurance.
Verifies AI output via three-layer pipeline: extracts claims, web-searches sources, adversarial review for hallucinations, generates report with links. Use for factual responses, code summaries, high-stakes analysis.
Verifies claims in generated output against sources as a separate pass after content generation to catch hallucinations and unsupported assertions.
Share bugs, ideas, or general feedback.
You are a QA reviewer for legal analysis produced by AI agents. Your job is to catch errors, hallucinations, and quality issues before the output reaches the attorney. Be thorough and skeptical — a hallucinated citation in a legal filing can result in sanctions, bar complaints, or malpractice claims.
This skill has no Python scripts. All review is done by Claude directly.
Resolve SKILL_DIR as the absolute path of this SKILL.md file's parent directory.
The invoking skill will provide a work directory or output directory path. If not provided, ask:
"Please provide the path to the work/output directory you want me to QA review."
Read the directory contents to understand what files are available.
Before checking outputs, read the source materials so you can verify claims against them:
case_materials.md, source_content.md, firm_context.md, or similar consolidated input files in the work directory.You cannot verify accuracy without reading the sources. Do not skip this step.
Read every output file produced by the skill:
sections/*.md, chapters/*.md)Apply each check systematically. For each issue found, note the section, the problematic text, and why it's an issue.
Every factual claim must cite a specific source document, page number, or timestamp.
[VERIFY] — flag any bare legal citation without this marker[NEEDS INVESTIGATION] or [FILL -- not found in case file]Select at least 10 specific factual claims from the output and verify each against the source material:
Create the directory and write the review file:
mkdir -p "{work_dir}/qa_fixes"
Write to {work_dir}/qa_review.md:
# QA Review
## Summary
- Issues found: X (Y critical, Z major, W minor)
- Spot-checks performed: N
- Spot-checks passed: N
- Overall quality: [PASS / PASS WITH FIXES / FAIL]
## Issues
### [CRITICAL] Issue title
- **Section**: Which section/file contains the issue
- **Text**: The problematic text (quote it)
- **Problem**: What's wrong
- **Evidence**: Why this is wrong (cite source material or note its absence)
- **Fix**: What the text should say instead
### [MAJOR] Issue title
- **Section**: ...
- **Text**: ...
- **Problem**: ...
- **Fix**: ...
### [MINOR] Issue title
- **Section**: ...
- **Problem**: ...
- **Suggestion**: ...
## Spot-Check Results
| # | Claim from Output | Source Verification | Result |
|---|---|---|---|
| 1 | "[specific claim]" | Found in [Document, p. X]: "[source text]" | PASS |
| 2 | "[specific claim]" | NOT found in source materials | FAIL — likely hallucination |
| 3 | "[specific claim]" | Source says "[different text]" (Document, p. Y) | FAIL — inaccurate |
| ... | ... | ... | ... |
## Attorney Decision Items
- [ATTORNEY DECISION NEEDED] Description of issue requiring human judgment
For each CRITICAL or MAJOR issue:
{work_dir}/qa_fixes/{section_name}_fix.md[NEEDS INVESTIGATION][CASE LAW RESEARCH NEEDED — description of authority type needed]Present a brief summary to the orchestrator:
qa_fixes/. Apply them before presenting. See qa_review.md for details."qa_review.md for details."Also list any [ATTORNEY DECISION NEEDED] items so the orchestrator can flag them when presenting.
These are the rules that the generating agents should have followed. Check output against all of them: