Backward Traceability

作者 lingzhi2279e6c085d65e3無授權條款386 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

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.

AI 產生的概覽

為程式碼中的數值結果加上標籤,並與 LaTeX 論文中的數字建立可追溯連結。

功能
此技能讓編譯後 PDF 中的數值可以回溯到產生它們的程式碼行。它指導在實驗輸出中加入 hypertarget 標籤、在 LaTeX 中以 hyperlink 指令引用這些標籤,並對衍生值使用編譯期求值的公式。它也附帶一支 Python 指令碼,可掃描 LaTeX 檔案中的 hypertarget 與 hyperlink,回報孤立或未被引用的數值,並將論文中的數值與程式碼輸出交叉比對。
適用情境
適用於撰寫需要讓數字可對照產生程式碼進行核驗的研究論文。適合可重現性與資料完整性檢查,以及驗證每個回報數值都能連結到特定程式碼行。
執行需求
需要具備 hyperref 與 listings 巨集套件的 LaTeX 工具鏈,以及可執行隨附指令碼 scripts/ref_numeric_values.py 的 Python 環境。它作用於包含程式碼與 LaTeX 檔案的論文專案目錄;未說明需要憑證或網路存取。

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

bash
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

bash
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:

python
# In experiment code output:print(f"\\hypertarget{{R1a}}{{45.3}}")  # Mean accuracyprint(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:

latex
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:

latex
% \num{formula, "explanation"} → evaluated at compile timeThe 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:

latex
\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:

latex
\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

來源與署名

來源:lingzhi227/agent-research-skills位於skills/backward-traceability提交9e6c085

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架