用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Morrison-Lab/ai-config --skill purge-hallucinations命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | purge-hallucinations |
| description | Verify and purge fake citations. |
| user-invocable | true |
| allowed-tools | ["Bash","Read","Edit","Write"] |
LLM-written content (memories, skills, CLAUDE.md, code, docs, PR
descriptions) drifts into hallucinations: concrete references that read as
authoritative but don't resolve to anything real. This skill checks each
checkable reference against ground truth and, for every one proven fabricated,
proposes a fix interactively.
The prime directive: only purge what you can prove is fake. A reference you can't verify (network down, ambiguous symbol, private resource) is unverifiable, not a hallucination — report it, never silently delete it.
Pick the narrowest target the user named, in this precedence order:
gh pr diff <n> (local) or
mcp__github__pull_request_read method: get_diff (remote/web — see
memories/github-mcp-tools.md); audit only the references the diff introduces.memories/,
skills/, and CLAUDE.md. Find the repo root with
git -C ~/.claude/skills/purge-hallucinations rev-parse --show-toplevel.If the target is genuinely ambiguous, ask once; otherwise proceed with the narrowest reasonable reading and state which you chose.
Scan the target for references that have a definite right/wrong answer. Ignore prose, opinions, and design rationale — those aren't hallucinations, just claims. Pull out, with file + line for each:
| Reference type | Examples |
|---|---|
| File / path | src/foo.R, here("data/x.csv"), a relative link in a .qmd |
| Function / object / symbol | pkg::fn(), an R object, a shell command, a Make target |
| Action ref + version | uses: org/action@v3, @<sha>, a tag/release |
| Skill name | ~/.claude/skills/<name>/, a /slash-command |
| Memory cross-link | [[some-memory-name]] in a memory body |
| URL / link | https://…, a docs anchor, a badge target |
| Citation / package | a CRAN/Bioconductor package, a DOI, a DESCRIPTION dep |
| Flag / option / config key | a CLI flag, an env var, a YAML key the schema defines |
| API / SDK method or model id | an SDK method, a model name, an endpoint |
Use the cheapest check that proves existence or absence. Match the tool to the reference type:
test -e <path>, git ls-files -- <path>, ls.grep -rn "fn <- function" R/); for an exported R fn check NAMESPACE /
Rscript -e 'library(pkg); exists("fn")'. Shell command — command -v.gh api repos/<org>/<repo>/git/refs/tags/<tag> or .../commits/<sha>).ls skills/<name>/ in the local ai-config directory. If
not found locally, check the session's available-skills list (appears in
system reminders) before classifying as ❌; a globally-available system skill
with no local directory is ❓ Unverifiable, not ❌ Fabricated.[[target]] links resolve to skill directories
(ls skills/<target>/); if no matching skill, search memory headings
(grep -rn "^# .*<target>" memories/).curl -sSI -o /dev/null -w '%{http_code}' <url> (local) or
WebFetch (remote). A 404/410 is fabricated; a timeout, 403, 429, or
DNS failure is unverifiable — distinguish them.https://cran.r-project.org/package=<pkg>;
installed: Rscript -e 'find.package("<pkg>")'; dep: check DESCRIPTION.--help, its schema, or
its source; for a YAML key, the consuming code/schema.claude-api
skill rather than guessing.Sort every reference into exactly one bucket:
| Bucket | Meaning | Disposition |
|---|---|---|
| ✅ Resolves | proven to exist | leave it |
| ❌ Fabricated | proven absent (404, no definition, no such tag/file) | propose a fix (Step 4) |
| ❓ Unverifiable | can't be checked here (network, private, ambiguous) | report, do not edit |
When in doubt, it's ❓ not ❌. False deletions are worse than a flagged maybe.
Default action is propose, then apply on confirmation — never bulk-edit silently. For each ❌, present: the reference, where it is, the evidence it's fake, and a proposed fix — exactly one of:
grep/gh for the
nearest real name).Apply each fix only after the user confirms (batch obvious typo-corrections together if the user prefers). Re-verify after editing. If the target is a memory or instruction file, the global "verify before recommending" rule is the reason this matters — a fabricated memory poisons every future session.
Summarize: N references checked → ✅ resolved, ❌ fixed (list before→after), ❓ unverifiable (list, with why each couldn't be checked). The ❓ list is a feature, not a failure — it tells the user exactly what still needs a human eyeball.
Steps 1--3 (resolve target, extract references, verify against ground truth)
have no need for Edit/Write access. Delegate them to the
hallucination-detector custom agent (.claude/agents/hallucination-detector.md)
for a hard, harness-enforced guarantee against Edit/Write tool use before the
report in Step 4 is reviewed --- tighter than this skill's own
instruction-only discipline, though the agent retains Bash for read-only
checks, so avoiding a write-capable shell command is still instruction-level.
Run Step 4 (propose/apply fixes) in the main session afterward.
record-learnings, ums, memorize / remember — these write the
memory/skill/instruction corpus; purge-hallucinations audits it. A
natural hand-off: after a big memory/skills write, run this to catch
fabricated cross-links and stale paths.claude-api — the source of truth for Claude/Anthropic model ids and
params; defer to it instead of guessing when verifying those references.simplify / tidy — clean structure (dead code, redundancy); this
cleans truth (references that don't resolve). Complementary passes.reprexes — if verifying a code reference needs actually running it,
isolate it as a reprex first.check-rendered-refs / crr — the output-side counterpart. This skill
audits source references; crr scans rendered HTML for crossrefs/citations
that broke at render time and leaked into the page as ?@key. Hand a ?@key
hit here to trace the dangling key back to its source line.check-info-quality / ciq — this skill checks whether a reference
exists; ciq's check C checks whether an existing, real reference
actually supports the claim it's attached to. A citation can pass here
and still fail ciq if it resolves but doesn't say what the text claims.claude-api.