check-labels-and-refs
Scan LaTeX files for label/reference consistency, orphan labels/refs, and non-pinpoint cross-references
Skill by tdupu
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/tdupu-check-labels-and-refs
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Shell scripts
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/check-labels-and-refs
What's inside
- Skill name
check-labels-and-refs- Description
- Scan LaTeX files for label/reference consistency, orphan labels/refs, and non-pinpoint cross-references
- License
- GPL-3.0
- Instructions
- 107 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (2)
- SKILL.md
- check-labels-and-refs.sh
SKILL.md (first lines)
# Check LaTeX Labels and References
Scans LaTeX documents for `\label{}`, `\ref{}`, `\eqref{}`, `\autoref{}` patterns to identify:
- **Orphan labels**: Labels defined but never referenced
- **Orphan refs**: References to undefined labels
- **Non-pinpoint refs**: Bare text references (e.g., "see Section 2" instead of `\ref{sec:foo}`)
Handles `\input` and `\include` closure up to depth 2.
## Usage
```bash
check-labels-and-refs <tex-file-path> [output-dir]
```
### Arguments
- `<tex-file-path>` — Root LaTeX file to scan (required)
- `[output-dir]` — Output directory for JSON report (optional, defaults to <city-root>/tmp-for-review/)
### Output
Produces `check-labels-and-refs-report.json` with structure:
```json
{
"file": "<path-to-root-file>",
"sha": "<git-sha-of-file>",
"scan_depth": 2,
"verdict": "PASS|FAIL",
"labels": {
"<label-name>": {
"location": "<file>:<line>",
"referenced_from": ["<file>:<line>", ...]
}
},
"references": {
"<label-name>": {
"locations": ["<file>:<line>", ...],
"label_found": true|false,
"reference_type": "ref|eqref|autoref"
}
},
"orphan_labels": ["<label-name>", ...],
"orphan_refs": ["<label-name>", ...],
"non_pinpoint_refs": [
{
"file": "<file>",
"line": <line-number>,
"context": "<quoted-text>",
"pattern": "bare-section|bare-theorem|bare-equation"
}
],
"counts": {
"total_labels": <int>,
"total_refs": <int>,
"orphan_label_count": <int>,
"orphan_ref_count": <int>,
"non_pinpoint_count": <int>
}
}
```
## Implementation
The skill uses bash/grep to scan LaTeX files. For each `.tex` file:
1. **Collect labels**: Extract all `\label{<name>}` patterns
2. **Collect references**: Extract all `\ref{<name>}`, `\eqref{<name>}`, `\autoref{<name>}` patterns
3. **Cross-reference**: Match refs to labels
4. **Detect orphans**: Find labels with no refs and refs with no labels
5. **Detect non-pinpoint**: Grep for bare-text patterns like "Section \d+", "Theorem \d+", "Equation \d+"
6. **Handle closure**: Recursively scan `\input{<file>}` and `\include{<file>}` up to depth 2
## Limitations
- **Depth cap**: Only scans `\input`/`\include` to depth 2. References to depth-3+ files are silently ignored. Report header documents this cap.
- **Comments**: Does not skip LaTeX comments (`%...`), so commented-out `\label{}`/`\ref{}` may be incorrectly counted.
- **\cite{}**: Does NOT scan citation patterns (`\cite{}`). That is the domain of check-citations skill.
- **Macros**: Does not expand LaTeX macros, so references inside macro expansions may be missed.
- **Non-ASCII**: Assumes UTF-8 encoding.
## Notes
- Non-pinpoint detection ships with examples only in v0. FP-converge refines enumeration.
- Verdict = FAIL if any-of: orphan_label_count > 0, orphan_ref_count > 0, non_pinpoint_count > 0.
- Cross-ref-parity-depth-2 is union of three detectors: orphan-label + orphan-ref + non-pinpoint.
---
## Examples
### Example 1: Hyperboloid.tex Test
```bash
ROOT=$HOME/gt/.gc/worktrees/hecke/polecats/gc.run-operator/worktrees/he-d4l
check-labels-and-refs $ROOT/latex/notes/hyperboloid.tex <city-root>/tmp-for-review/he-ja26/
# Produces: <city-root>/tmp-for-review/he-ja26/check-labels-and-refs-report.json
```
Expected checks:
- Scans hyperboloid.tex + \input closure
- Reports orphan labels (labels without refs)
- Reports orphan refs (refs to undefined labels)
- Flags non-pinpoint patterns
- Verdict: PASS (no orphans or non-pinpoint issues) or FAIL (issues found)From tdupu/agent-skills-public, GPL-3.0.
More from tdupu/agent-skills-public
- 0.570score
assemble-recording-series
tdupu
Assemble one lecture or talk video from a folder of raw takes, whatever the capture tool wrote - flat screen-capture files, or per-session folders with the…
SkillAFreshness: AClaude Code +9 - 0.570score
check-paragraph
tdupu
Judge ONE paragraph of prose (LaTeX allowed) as its stated reader and return a fixed six-line verdict — topic sentence, one idea, reader can follow, claim…
SkillAFreshness: AClaude Code +9 - 0.565score
check-documentation-policy
tdupu
Audit mathcity documentation against POLICY-documentation.md.
SkillAFreshness: AClaude Code +9 - 0.565score
behavior-verify
tdupu
Use when an edit to a skill, an instruction file, or a prompt has to be shown to have changed the agent behavior it was meant to fix.
SkillAFreshness: AClaude Code +9 - 0.565score
check-citations
tdupu
Read-only citation audit for .tex files.
SkillAFreshness: AClaude Code +9 - 0.565score
check-grant-format
tdupu
Audit an NSF proposal folder against Grants/GRANT-FORMAT.md (page limits, fonts, margins, required headings, no URLs in the description, prior-support items…
SkillAFreshness: AClaude Code +9 - 0.565score
check-grant-style
tdupu
Audit an NSF Project Description and Summary against Grants/GRANT-STYLE.md (every project has a plan and names what is new; results in prose with citations…
SkillAFreshness: AClaude Code +9 - 0.565score
check-latex
tdupu
Produce the evidence block the human adjudicator needs to approve or reject a notes.tex (or any notes-tier .tex) change before push/merge.
SkillAFreshness: AClaude Code +9 - 0.565score
check-latex-hygiene
tdupu
Audit LaTeX beads, branches, or .tex diffs against the LaTeX Subdomain Policy (mathcity/subdomains/latex/POLICY.md, LX-rules).
SkillAFreshness: AClaude Code +9 - 0.565score
check-lmfdb-hygiene
tdupu
Audit an LMFDB-type bead, diff, experiment proposal, or live type against the LMFDB Subdomain Policy (mathcity/subdomains/lmfdb/POLICY.md) — labels valid…
SkillAFreshness: AClaude Code +9 - 0.564score
behavior-cause
tdupu
Use when a reproduced agent behavior has to be traced to the artifacts whose text produced it.
SkillAFreshness: AClaude Code +9 - 0.561score
adjust-behavior
tdupu
Start here when an agent did something undesired and you suspect the instructions it read — a skill, a project instruction file, a prompt template — rather…
SkillAFreshness: AClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 14, 2026 (15 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- GPL-3.0
- Repository
- github.com/tdupu/agent-skills-public
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from tdupu
- 0.570score
assemble-recording-series
tdupu
Assemble one lecture or talk video from a folder of raw takes, whatever the capture tool wrote - flat screen-capture files, or per-session folders with the…
SkillAFreshness: AClaude Code +9 - 0.570score
check-paragraph
tdupu
Judge ONE paragraph of prose (LaTeX allowed) as its stated reader and return a fixed six-line verdict — topic sentence, one idea, reader can follow, claim…
SkillAFreshness: AClaude Code +9 - 0.565score
check-citations
tdupu
Read-only citation audit for .tex files.
SkillAFreshness: AClaude Code +9 - 0.565score
behavior-verify
tdupu
Use when an edit to a skill, an instruction file, or a prompt has to be shown to have changed the agent behavior it was meant to fix.
SkillAFreshness: AClaude Code +9 - 0.565score
check-documentation-policy
tdupu
Audit mathcity documentation against POLICY-documentation.md.
SkillAFreshness: AClaude Code +9 - 0.565score
check-grant-format
tdupu
Audit an NSF proposal folder against Grants/GRANT-FORMAT.md (page limits, fonts, margins, required headings, no URLs in the description, prior-support items…
SkillAFreshness: AClaude Code +9
Cite this page
check-labels-and-refs skill. Agent Mart. https://agentmart.dev/skills/tdupu-check-labels-and-refs (last updated 2026-10-24)