docs-stale-reference-guardrails
Prevent deleted workflow/path references from creeping back into live docs by combining strict scans, legacy allowlists, and shared regex helpers.
Best use case
docs-stale-reference-guardrails is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Prevent deleted workflow/path references from creeping back into live docs by combining strict scans, legacy allowlists, and shared regex helpers.
Teams using docs-stale-reference-guardrails should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/docs-stale-reference-guardrails/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How docs-stale-reference-guardrails Compares
| Feature / Agent | docs-stale-reference-guardrails | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Prevent deleted workflow/path references from creeping back into live docs by combining strict scans, legacy allowlists, and shared regex helpers.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Docs Stale-Reference Guardrails
Use when a repo has migrated away from old workflow paths (for example `scripts/work-queue/*`, `scripts/agents/*`, `specs/wrk/*`, `.Codex/work-queue/*`) and you need to stop live docs from reintroducing those paths.
## When to use
- Historical session logs show repeated reads of deleted paths
- You have already cleaned some docs and want regression protection
- A few legacy/reference docs still need to mention deleted paths intentionally
- You want to shrink the exception surface over time
## Core pattern
Build 3 layers:
1. Strict banned-reference scan for current high-value docs
2. Allowlist-confinement scan for legacy/reference docs only
3. Explicit allowlist-lock test so exceptions cannot quietly grow
## Implementation steps
### 1. Start with a strict curated set
Create a pytest that scans only the cleanest, highest-value live docs first.
Good initial candidates:
- `AGENTS.md`
- `AGENTS.md`
- `README.md`
- `docs/README.md`
- `docs/plans/README.md`
- workflow templates under `.planning/templates/`
- recently cleaned live docs under `docs/`
Do NOT start by scanning generated reports, archives, or known legacy reference docs.
### 2. Centralize stale-path patterns in a helper
Create a shared test helper, e.g.:
- `tests/helpers/stale_reference_docs.py`
Export:
- `CORE_BANNED_STALE_REFERENCE_PATTERNS`
- `scan_stale_reference_hits(relative_path, patterns=...)`
Core banned families to encode:
- `scripts/work-queue/new-spec.sh`
- `scripts/work-queue/parse-session-logs.sh`
- `scripts/agents/`
- `specs/wrk/WRK-(\d+|NNN)/plan.md`
- deleted work-queue gate scripts, expressed as current guardrail regex families rather than live execution guidance
- deleted lifecycle helpers:
- `close-item.sh`
- `whats-next.sh`
- `archive-item.sh`
- `claim-item.sh`
- `.Codex/work-queue/`
- deleted work-queue skill paths
Keep test-specific extra patterns local to the test that needs them.
### 3. Add a strict banned-reference test
Create or maintain a test like:
- `tests/docs/test_banned_stale_references.py`
Pattern:
- curated `STRICT_FILES = [...]`
- loop through each file
- assert `scan_stale_reference_hits(relative_path)` returns no violations
Use this for live/current docs only.
### 4. Add an allowlist-confinement test
Create or maintain a test like:
- `tests/docs/test_legacy_reference_allowlist.py`
Pattern:
- broader `SCAN_FILES = [...]` covering live docs and explicit legacy/reference docs
- tiny `ALLOWED_LEGACY_REFERENCE_FILES = {...}`
- assert stale references appear only in those allowlisted files
This catches stale-path spread while still allowing redirect/reference docs to mention old paths intentionally.
### 5. Lock the allowlist
Add a separate explicit test:
- assert `ALLOWED_LEGACY_REFERENCE_FILES == {...expected files...}`
This is important. Behavioral tests alone do not prevent quiet allowlist growth.
### 6. Expand strict coverage gradually
Workflow:
1. Find next best live docs with the broader scan
2. Clean those docs with minimal wording changes
3. Move them from allowlist/broader scan into strict scan
4. Re-run tests
Good cleanup strategy:
- replace explicit deleted-path mentions with generic wording where possible
- keep the redirect/reference meaning intact
- reserve explicit deleted-path strings only for true legacy mapping docs
## Practical wording pattern for cleanup
Instead of:
- "the old `scripts/agents/*` wrappers are deleted legacy paths"
Prefer:
- "older wrapper-based entrypoints are deleted legacy paths"
Instead of:
- "Do not invoke `scripts/work-queue/close-item.sh`"
Prefer:
- "Do not invoke any legacy local closure helper"
This preserves guidance while satisfying strict stale-path bans.
## Recommended exception docs
In a migrated workflow repo, the allowlist should usually be tiny. Example steady state:
- `docs/ops/legacy-Codex-reference-map.md`
- `docs/modules/ai/AGENT_EQUIVALENCE_ARCHITECTURE.md`
If more files are allowlisted, treat that as debt to reduce.
## Verification
Run targeted tests repeatedly while expanding coverage:
- `uv run pytest tests/docs/test_banned_stale_references.py tests/docs/test_legacy_reference_allowlist.py -q`
If there is related audit/export logic, include those tests too.
## Pitfalls
- Do not scan generated reports or archives in the strict test
- Do not rely only on an allowlist behavior test; lock the allowlist explicitly
- Do not duplicate regex lists across tests; centralize them in a helper
- Do not leave live docs in the allowlist just because cleanup is inconvenient; clean and move them into strict coverage when possible
## Outcome to aim for
- Most current docs under strict no-stale-reference enforcement
- Only 1–2 intentional legacy/reference docs allowlisted
- Shared helper owns the core stale-path policy
- Allowlist changes require an explicit reviewed test updateRelated Skills
recover-from-stale-git-locks
Diagnose and recover from stale git lock files caused by crashed background processes
multi-repo-stale-lock-recovery
Diagnose and recover from stale git lock files in multi-repo workspaces, especially with submodules
multi-layer-stale-state-debugging
Detect and clear stale state persisting across multiple storage layers (auth files, cache, code logic)
git-stale-lock-recovery
Diagnose and recover from git stale lock files and corrupted rebase states in multi-repo workflows
overnight-worktree-uv-warmup-and-log-path-guardrails
Prevent false stalls and missing-log failures in overnight Codex worktree batches by pre-warming uv environments, using exact log-path directory creation, and interpreting buffered logs correctly.
iterative-plan-redraft-semantic-guardrails
Harden a repeatedly re-reviewed documentation/contract plan after adversarial reviewers keep finding semantic gaps despite new test rows.
interactive-issue-execution-worktree-guardrails
Execute approved GitHub issues in isolated worktrees with interactive Codex/Codex runs, while containing agent drift and salvaging progress when provider/runtime problems occur.
diagnose-stale-pycache-import-mismatch
Diagnose Python ImportError cases where a symbol cannot be imported even though the source file already defines it; verify live source, interpreter/venv selection, clear stale __pycache__, and rerun targeted imports/tests.
bulk-docstring-addition
Add Google-style docstrings to all public functions and classes in a Python package. Uses AST parsing for precise gap detection, priority ranking by coverage ratio, and multi-file patching.
aqwa-reference
AQWA solver stages (RESTART), OPTIONS keywords, FIDP/FISK external damping/stiffness cards, backend bugs, and MCP tool integration patterns.
office-docs
Automate Microsoft Office and PDF document workflows including generation, manipulation, and template-based document processing.
repo-cleanup-references-to-remove
Sub-skill of repo-cleanup: References to Remove.