PluginBench
Skill
Review
Audit score 70

backward-traceability

lingzhi227/agent-research-skills

Make every number in your PDF traceable to the exact code line that produced it.

What is backward-traceability?

This skill creates hyperlinked traceability between numeric values in a LaTeX PDF and the code that generated them. Use it when you need reproducibility verification and data integrity checking—every number becomes clickable and links back to its source code line.

  • Tag numeric outputs in code with \hypertarget LaTeX commands using a structured label format
  • Create clickable \hyperlink references in paper text that jump to code sources
  • Evaluate derived values at LaTeX compile time using \num{formula} syntax
  • Generate appendix code listings with \hypertarget anchors at relevant lines
  • Scan and verify cross-reference integrity between paper text and code output

How to install backward-traceability

npx skills add https://github.com/lingzhi227/agent-research-skills --skill backward-traceability
Prerequisites
  • LaTeX project with hyperref and listings packages
  • Python environment for running verification scripts
  • Code that outputs numeric results in structured format
Claude Code
Cursor
Windsurf
Cline

How to use backward-traceability

  1. 1.Add \hypertarget tags to every numeric value in your experiment code output using format {prefix}{line_number}{letter}
  2. 2.Create \hyperlink references in your LaTeX paper text pointing to those hypertargets
  3. 3.Use \num{formula, "explanation"} in LaTeX for any values computed from other values
  4. 4.Generate an appendix with your full code listing, adding \hypertarget anchors at relevant lines
  5. 5.Run the verification script to cross-check values between paper text and code output, then click-test hyperlinks in the compiled PDF

Use cases

Good for
  • Verify that reported experimental results in a research paper match the actual code that produced them
  • Create auditable scientific papers where reviewers can click numbers to see their source
  • Detect mismatches between paper values and code outputs during compilation
  • Build reproducible research artifacts with complete numeric provenance
  • Maintain data integrity in multi-author papers by enforcing traceability rules
Who it's for
  • Researchers publishing reproducible science papers
  • Data scientists documenting experimental results
  • Teams requiring audit trails for numeric claims
  • Authors of technical papers with extensive quantitative results

backward-traceability FAQ

What happens if a number in the paper doesn't have a corresponding hypertarget in the code?

The verification script will report it as an orphan reference. The rule is that every numeric result in the paper MUST trace to code output.

Can I manually type numbers into the paper, or must I always use hyperlinks?

Never manually type numbers—always reference tagged outputs via \hyperlink or \num{}. This enforces the traceability requirement.

How do I handle values that are computed from other values?

Use \num{formula, "explanation"} in LaTeX, which evaluates the formula at compile time and creates a traceable derived value.

What label format should I use for hypertargets?

Use {prefix}{line_number}{letter} where prefix is a short identifier, line_number is the code line, and letter (a, b, c...) distinguishes multiple values on the same line.

Which scripts do I run to verify traceability?

Use ref_numeric_values.py with --scan to report all references and orphans, and --verify to cross-check values between paper and code output.

Full instructions (SKILL.md)

Source of truth, from lingzhi227/agent-research-skills.


name: backward-traceability description: Make every number in the final PDF traceable to the exact code line that produced it. Uses \hypertarget/\hyperlink LaTeX commands and \num{formula} evaluated at compile time. Use for reproducibility and data integrity verification. argument-hint: [paper-directory]

Backward Traceability

Make every number in the final PDF hyperlink back to the exact code line that produced it.

Input

  • $0 — Paper project directory containing code and LaTeX files

References

  • Traceability patterns and LaTeX commands: ~/.claude/skills/backward-traceability/references/traceability-patterns.md

Scripts

Scan hypertarget/hyperlink references

python ~/.claude/skills/backward-traceability/scripts/ref_numeric_values.py \
  --scan paper/main.tex --output report.json

Reports: all hypertargets, hyperlinks, orphan references, unreferenced numeric values.

Verify cross-reference integrity

python ~/.claude/skills/backward-traceability/scripts/ref_numeric_values.py \
  --verify paper/main.tex --code-output results.txt

Cross-checks values between paper text and code output. Reports mismatches.

Workflow

Step 1: Tag Code Outputs

For every numeric value produced by experiment code, add hypertarget tags:

# In experiment code output:
print(f"\\hypertarget{{R1a}}{{45.3}}")  # Mean accuracy
print(f"\\hypertarget{{R1b}}{{2.1}}")   # Std deviation

Label format: {prefix}{line_number}{letter} where letter = a, b, c... for multiple values on same line.

Step 2: Reference in Paper Text

Use \hyperlink to create clickable references in the paper:

Our method achieves \hyperlink{R1a}{45.3}\% accuracy
($\pm$\hyperlink{R1b}{2.1}).

Step 3: Use \num for Computed Values

For values derived from other values, use \num{} for compile-time evaluation:

% \num{formula, "explanation"} → evaluated at compile time
The improvement is \num{45.3 - 38.7, "accuracy gain"}\%.

Step 4: Generate Appendix Code Listing

Create an appendix with the full code listing, with \hypertarget anchors at relevant lines:

\section*{Appendix: Code Listing}
\begin{lstlisting}[escapechar=@]
@\hypertarget{code1}{}@result = model.evaluate(test_data)
@\hypertarget{code2}{}@accuracy = result['accuracy']
\end{lstlisting}

Step 5: Verify Traceability

  • Every number in the paper text must have a corresponding \hypertarget in the code
  • Every \num{} formula must evaluate correctly
  • Click-test: every hyperlink in the PDF must jump to the correct code line

LaTeX Setup

Required packages:

\usepackage{hyperref}
\usepackage{listings}

Rules

  • Every numeric result in the paper MUST trace to code output
  • Never manually type numbers — always reference tagged outputs
  • Use \num{} for any derived/computed values
  • Code listing in appendix must match actual executed code
  • Verify all hyperlinks resolve correctly after compilation

Related Skills

  • Upstream: experiment-code, data-analysis
  • Downstream: paper-compilation
  • See also: paper-assembly