From docs-hygiene
Sweep stale references after renames — the syntactic forms token-only grep misses (slash-tokens, paths, chain prose, numbered table rows, frontmatter chains and globs). Use when: 'rename X to Y', 'I renamed X', 'audit rename', 'find stale refs', 'check for stragglers', 'after git mv', 'sweep references', 'rename impact preview', 'find half-renamed state', 'broken refs after rename', 'pre-PR rename check' — actions: audit, audit blast, audit half-rename, audit orphans, apply, preview, blocklist; not for framework migrations or repo-wide dead-reference audits.
How this skill is triggered — by the user, by Claude, or both
Slash command
/docs-hygiene:rename-references [action] [<old> [to <new>]] [--include-historical|--include-memory|--include-plan-docs] (e.g., /rename-references audit, /rename-references audit blast /verify to /verify-changes, /rename-references audit half-rename /a to /b, /rename-references audit orphans /a to /b, /rename-references blocklist)[action] [<old> [to <new>]] [--include-historical|--include-memory|--include-plan-docs] (e.g., /rename-references audit, /rename-references audit blast /verify to /verify-changes, /rename-references audit half-rename /a to /b, /rename-references audit orphans /a to /b, /rename-references blocklist)The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Working tree status: !`git status --porcelain 2>/dev/null | head -20 || echo "clean"`
Working tree status: !git status --porcelain 2>/dev/null | head -20 || echo "clean"
Rename pairs (git): !{ git diff --name-status -M HEAD 2>/dev/null; git diff --cached --name-status -M 2>/dev/null; } | grep '^R' | head -15 || echo "none"
Current branch: !git branch --show-current 2>/dev/null || echo "unknown"
Renames are deceptively hard. After renaming a skill, file, or identifier, references survive in 7+ syntactic forms beyond the obvious token. Token-only grep (/old) catches 50–70%; the rest hide in chain prose (→ old →), comma-lists (Test, Old, Retro), numbered table rows (| 7. Old |), frontmatter chain strings (description: "...→ old → retro process."), frontmatter globs ({a,b,old,c}), cross-skill mode references, and content-file paths (context/old.md style).
This skill makes "find every reference" one invocation instead of 4 manual sweep passes. Runs the full pattern library, triages matches into 3 buckets, surfaces ambiguity (English-verb collisions like confirm/test/review) for user confirmation rather than auto-applying blindly.
This skill is self-contained — the pattern library, triage classifier, and audit modes below need only git and the Grep tool. Where prose names an adjacent capability (a verification workflow, an issue tracker, a codebase-audit routine), treat it as optional: if your environment provides it, invoke it; otherwise proceed without. Consumer-specific conventions (work-notes locations, commit policy, naming rules) come from the consuming repository's own CLAUDE.md and rules — read them; this skill does not assume them.
Parse $ARGUMENTS first token to determine action. Subsequent tokens are the rename pair (with to/→/->/into separator) or single token for reverse-mode.
| Argument shape | Action | Read |
|---|---|---|
| (empty) | Smart default | inline below — detect rename pair from conversation/git/staged |
audit | Audit (read-only sweep — alias for audit blast) | context/audit.md + audit-modes.md |
audit <old> or audit <old> to <new> | Audit with explicit pair | context/audit.md |
audit blast [<old> [to <new>]] | Audit Blast — pre-rename impact (counts + per-file + bucket distribution; inline-only) | audit-modes.md |
audit half-rename <old> to <new> | Audit Half-Rename — files mentioning BOTH old AND new (incomplete-rename hygiene) | audit-modes.md |
audit orphans <old> to <new> | Audit Orphans — refs at old name OR vanished path AFTER rename (REQUIRES pair) | audit-modes.md |
<old> to <new> | Apply full rename | context/apply.md |
preview <old> to <new> | Preview dry-run | context/apply.md (skip Edit phase) |
<old> (single token, no separator) | Reverse — find refs, ask what to replace with | context/audit.md |
blocklist | Print English-verb blocklist (read-only introspection of triage-bucket safety mechanism) | inline below |
Pattern library is the load-bearing component — the full form registry lives in context/patterns.md; execute sweeps with the Grep tool. Read it before any sweep. Triage logic is in context/triage.md. Audit sub-mode detail (Blast / Half-rename / Orphans) is in context/audit-modes.md.
Three flags toggle auto-exclusions ON. Defaults preserve safety (rename-documenting plan docs / frozen historical notes / memory entries excluded). Long-form only, position-agnostic.
| Flag | Effect | Apply mode? |
|---|---|---|
--include-historical | Sweep archived/completed work notes and frozen records of past work | OK |
--include-memory | Sweep Claude Code auto-memory files (~/.claude/projects/*/memory/*.md) and MEMORY.md indices | OK |
--include-plan-docs | Sweep the active plan/work-notes documents that document THIS rename | AUDIT-MODE ONLY — apply mode rejects with explicit error (footgun prevention; the plan doc documents the rename — both names appear by design) |
Multiple flags compose. Unknown flags raise an error. Detail in audit-modes.md "Override flags" section.
/rename-references blocklist prints the English-verb blocklist literal from context/triage.md. Read-only — no edits, no sweeps. Use to inspect which tokens force the ambiguous-bucket safety path. To extend, edit triage.md directly.
Detect rename pairs in this priority order:
git diff --name-status -M HEAD and git diff --cached --name-status -M; R<score> lines map old path → new pathD <path> + ?? <similar-path> in git status --porcelain (heuristic — Levenshtein-similar basenames within same dir)If multiple candidates surface, present via AskUserQuestion — user picks which pair to audit.
If zero candidates: report "No rename detected in conversation or git state. Provide /rename-references <old> to <new> or /rename-references audit <old> to invoke explicitly."
The argument string after the action keyword can be:
| Form | Example | Parses to |
|---|---|---|
<old> to <new> | /verify to /verify-changes | old=/verify, new=/verify-changes |
<old> to <new> (mode) | /verify to /verify-changes outcome | old=/verify outcome, new=/verify-changes outcome |
<old> → <new> | test live → test e2e | old=test live, new=test e2e |
<old> -> <new> | foo -> bar | old=foo, new=bar |
<old> into <new> | legacy into modern | old=legacy, new=modern |
<path/old.md> to <path/new.md> | confirm/SKILL.md to verify/SKILL.md | path rename — skill applies extra path-form patterns |
Multi-word old/new is fine — separator is the only delimiter. Quote characters ("foo bar") optional. Old/new taken verbatim — leading slashes preserved (/confirm stays /confirm, not confirm).
context/patterns.md in parallel against tracked text files; aggregate per-file hit counts. For a skill/identifier rename, FIRST enumerate coupled-sibling renames (dot-form behavior point-IDs, internal mode names, content-file basenames that changed in lockstep) and queue EACH as its own rename pair — they carry no primary token, so the primary sweep never reaches them (see Gotchas "coupled-rename")context/triage.md:
confirm/test/review/fix/clean/build/lint/verify/plan/etc.)AskUserQuestion:
context/patterns.md, re-iterate.Audit mode runs phases 1-3 only and reports — no Edit calls. Preview mode runs 1-4 and reports planned edits — no Edit.
Paths skipped from sweeps automatically:
.git/, node_modules/, bin/, obj/, .venv/, dist/, build/~/.claude/projects/*/memory/ describing past renames| Stage | How | Why |
|---|---|---|
| Pre-rename impact analysis | /rename-references audit <old> | Read-only sweep, see blast radius before changing anything |
| Rename execution | /rename-references <old> to <new> | Sweep → triage → edit → re-sweep |
| Post-rename verification | the consuming repository's build/test/lint workflow | Confirm no semantic regression |
| Cleanup near rename sites | a separate simplification/refactor pass | Opportunistic refactor (separate concern) |
confirm, test, review, clean, fix, build, lint, plan, run, view, start, stop, merge, split, sort, filter, group, head, body, link, list, work, log, watch, monitor. Triage forces these into ambiguous bucket regardless of regex hit position. User confirms each.confirm inside confirmation MUST NOT match. All bare-token patterns use \b./confirm should match but not /confirmation or path/confirm. Use \B/<old>\b (non-word-boundary before slash, word-boundary after).multiline: true on the Grep tool.test → test e2e is a substring expansion. Apply most-specific match first, mark already-edited regions to prevent double-edit.context/patterns.md, re-iterate. Do NOT silently apply.git branch -m. Operates on file content, not git refs.audit orphans is STRICTLY pair-driven (post-rename hygiene only). For repo-wide dead-link / dead-reference checks unrelated to a specific rename, use a codebase-audit workflow or documentation link checker if your environment provides one. Charter boundary preserves single responsibility./rename-references audit.context/patterns.md, add an eval case. Future renames benefit immediately.git mv changes directory depth, relative refs inside the moved files (source ../../lib.sh, # shellcheck source=../../../../tests/..., relative markdown links) silently break — they carry no renamed token, so every token-keyed pattern returns clean while the moved file itself is broken. After any depth-changing move: grep -nE '\.\./' <moved-files> + re-run the moved code from its new location (tests, --help). Real example: a directory promotion left a # shellcheck source= directive pointing four levels up when the new home was two.verify.runtime-affecting-paths — Form 12), internal mode names (quality mode), content-file basenames (context/quality.md style paths). A phase-scoped, skill-only grep on the primary token (/verify) leaves these EXTERNAL refs — in skill bodies, config files, and other skills' dispatch tables — unverified. A slash-anchored token sweep can return "clean" while <old>.id / <old-mode> / <old>.md-path refs survive elsewhere. Before declaring a rename complete: enumerate the coupled identifiers (Survey phase) and run a sweep per pair./rename-references is invocable mid-workflow whenever a rename happens — typically during implementation (when the work includes a rename) or as a precursor to final verification, to confirm no stragglers before declaring done.
Skill chaining:
| Condition | Action |
|---|---|
| User says "I renamed X to Y" mid-implementation | Invoke /rename-references <X> to <Y> to sweep before continuing |
git mv just executed | Invoke /rename-references audit to surface stragglers |
| Pre-PR: working tree contains R-status files | Suggest /rename-references audit before final verification |
/rename-references finds 0 matches | Proceed to verification (or done if already past it) |
/rename-references finds NEW form not in pattern library | Update context/patterns.md, add eval case, re-iterate |
npx claudepluginhub melodic-software/claude-code-plugins --plugin docs-hygieneGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.
Dispatches multiple subagents concurrently for independent tasks without shared state. Use when facing 2+ unrelated failures or subsystems that can be investigated in parallel.