Anti-Hallucination Verification
Skill0 starsChanged 49 days agoMITView on GitHub
Verify code and claims locally with Ollama before external tools
In this repository20 other files it gives its agents.
- examples/CLAUDE.mdCLAUDE.md
- backup-snapshotSkill
- Multi-Agent BrainstormSkill
- Browser UATSkill
- ci-cd-builderSkill
- Code Patterns ReferenceSkill
- Conventional Commits WorkflowSkill
- Context Curator AdministrationSkill
- email-composerSkill
- git-detectiveSkill
- imap-emailSkill
- ollama-model-managerSkill
- Ollama Code VerificationSkill
- project-bootstrapperSkill
- prompt-engineerSkill
- refactor-analyzerSkill
- release-managerSkill
- scheduleSkill
- skill-creatorSkill
- Work LogSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Verify technical claims, code correctness, and implementation details using LOCAL-FIRST strategy with Ollama before falling back to …
- Distinctive: line 115
Check Ollama output for clear PASS/FAIL
- Distinctive: line 166
Never assume Ollama knows current API versions: - Always verify with WebSearch if version-specific
- Distinctive: line 171
If Ollama says "I'm not sure", escalate to human review
- Distinctive: line 172
If WebSearch returns conflicting info, note both sources
- Distinctive: line 226
Use context from previous verifications
- Distinctive: line 230
If Ollama is down:
- Distinctive: line 244
Never trust either tool alone for critical decisions
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Anti-Hallucination Verification
Verify technical claims, code correctness, and implementation details using LOCAL-FIRST strategy with Ollama before falling back to external tools.
Decision Tree
Is this a verification task?
├─ YES: Can Ollama verify this locally?
│ ├─ YES (code patterns, syntax, logic, APIs)
│ │ └─ Use: ollama run qwen3-coder "<analysis prompt>"
│ │ ├─ Extract key findings
│ │ ├─ Log verification result
│ │ └─ Return with confidence: LOCAL_VERIFIED
│ │
│ └─ NO (needs current info, external APIs, real-time data)
│ ├─ Use: WebSearch or WebFetch
│ ├─ Extract facts from authoritative sources
│ ├─ Return with confidence: EXTERNAL_VERIFIED
│ └─ Cache result for future queries
│
└─ NO: Continue normal task executionVerification Scope
Local Verification (Ollama) - Use First
- Code syntax correctness
- Python/TypeScript/JavaScript conventions
- REST API design patterns
- Docker best practices
- Git workflow correctness
- Library API compatibility (cached knowledge)
- Regex pattern validation
- SQL query structure
- Algorithm correctness
- Design pattern application
- Security patterns (standard practices)
Command:
ollama run qwen3-coder "Verify this code pattern: [code]. Check for: syntax errors, best practices, performance issues. Return: PASS/FAIL with specific findings."External Verification (WebSearch/WebFetch) - Fall Back
- Current API documentation (versions released in last 6 months)
- Real-time CVE data
- Current pricing/features of services
- Breaking changes in recent releases
- Live service status
- Recent framework versions
- Current best practices (if framework is < 1 year old)
Workflow
1. Identify Claim
Parse user request or code review task:
- Is this a claim about code/syntax?
- Is this about implementation patterns?
- Is this about external information?
2. Choose Verification Path
# Pattern 1: Syntax/Logic Verification
ollama run qwen3-coder "TASK: Verify Python code correctness
CODE:
\`\`\`python
async def fetch_data(url: str) -> dict:
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
return await resp.json()
\`\`\`
CHECKS:
1. Is syntax correct?
2. Are there potential bugs?
3. Does it follow async/await patterns?
4. Type hints valid?
RESPOND: PASS/FAIL with specific findings."# Pattern 2: Architecture Review
ollama run qwen3-coder "TASK: Review REST API design
ENDPOINT: POST /api/users/{id}/settings
REQUEST: {\"theme\": \"dark\", \"notifications\": true}
RESPONSE: {\"status\": \"success\", \"user_id\": 123}
CHECKS:
1. HTTP method appropriate?
2. Status codes correct?
3. Request/response structure follow REST?
4. Any security concerns?
RESPOND: PASS/FAIL with findings."3. Verify Results
- Check Ollama output for clear PASS/FAIL
- Extract specific findings
- Note any uncertainties (Ollama will indicate)
- Log verification decision
4. Return Result
{
"claim": "The async function is correct",
"verification_method": "LOCAL_VERIFIED",
"tool": "ollama:qwen3-coder",
"confidence": "HIGH",
"findings": [
"Syntax is correct",
"Async/await pattern is proper",
"Type hints are valid"
],
"decision": "PASS"
}Integration with Tools
When to Use Grep + Ollama
# Find similar code patterns in codebase
grep -r "async def" . --include="*.py" | head -5
# Verify pattern with Ollama
ollama run qwen3-coder "Review these async patterns and suggest improvements: [patterns]"When to Use Read + Ollama
# Read implementation
grep -l "def verify" src/**/*.py | xargs -I {} sh -c 'echo "=== {} ===" && head -20 {}'
# Verify with Ollama
ollama run qwen3-coder "Review this verification implementation: [code]"When to Use WebSearch (Fallback)
# Only if Ollama cannot verify
# Usually for: breaking changes, deprecated features, very new releasesAnti-Hallucination Rules
- Trust Ollama for logical verification - It has strong code understanding
- Use WebSearch for factual/temporal claims - APIs change, versions matter
- Never assume Ollama knows current API versions - Always verify with WebSearch if version-specific
- Combine tools strategically:
- Ollama: "Is this pattern correct?"
- WebSearch: "Is this API still available?"
- Document uncertainty:
- If Ollama says "I'm not sure", escalate to human review
- If WebSearch returns conflicting info, note both sources
Example Task
User: "Does this Docker compose config handle container networking correctly?"
# Step 1: Read the file
read_file docker-compose.yml
# Step 2: Verify with Ollama
ollama run qwen3-coder "TASK: Review Docker compose file for networking
FILE:
services:
api:
image: myapp:latest
ports:
- \"3000:3000\"
networks:
- app-net
db:
image: postgres:15
networks:
- app-net
networks:
app-net:
driver: bridge
CHECKS:
1. Network definition correct?
2. Service connectivity valid?
3. Port mapping correct?
4. Any security issues?
RESPOND: PASS/FAIL with findings."
# Step 3: Return verification
echo 'Verification: LOCAL_VERIFIED via ollama:qwen3-coder
Findings:
- Network definition correct
- Services can communicate via app-net
- Port mapping allows external access
- No security issues found
Decision: PASS'Performance Tuning
- Ollama requests: 5-30s for code analysis
- Cache repeated verifications (same code = same result)
- Batch multiple checks in one request when possible
- Use context from previous verifications
Error Handling
If Ollama is down:
if ! curl -s http://127.0.0.1:11434/api/tags > /dev/null 2>&1; then
echo "Ollama unavailable, falling back to WebSearch for verification"
# Use WebSearch instead
fiSummary
Local-First Strategy:
- Try Ollama for logical/pattern verification (fast, local)
- Fall back to WebSearch for factual/temporal verification (authoritative)
- Combine results with confidence levels
- Never trust either tool alone for critical decisions
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

