Comprehensive single-file review. Generates preview with variables replaced, finds and replaces hardcoded values, adds _latex equations, validates consistency.
Comprehensive single-file review covering: variable consistency, content quality, and reader engagement.
/review-qmd knowledge/appendix/incentive-alignment-bonds-paper.qmd
/review-qmd economics.qmd
If no file specified, ask which file to review.
cd E:/code/obsidian/websites/disease-eradication-plan
.venv/Scripts/python.exe scripts/preview-qmd-with-variables.py <file> -o _analysis/<basename>-preview.md
.venv/Scripts/python.exe scripts/preview-qmd-with-variables.py <file> --numbers-only
Read preview to understand rendered state. Note inconsistencies (e.g., "$2.4T" vs "$2.72T").
REPLACE with variables:
KEEP hardcoded:
1% treaty concept, years in citationsVariable lookup:
grep -i "keyword" _analysis/parameter-summary.md
grep "value_pattern" _variables.yml
Key variables:
| Pattern | Variable | Value |
|---|---|---|
| Military spending | global_military_spending_annual_2024 |
$2.72T |
| Treaty funding | treaty_annual_funding |
$27.2B |
| War costs | global_annual_direct_indirect_war_cost |
$11.4T |
| DALYs | global_annual_daly_burden |
2.88B |
| Household wealth | global_household_wealth_usd |
$454T |
| IAB BCR | iab_mechanism_benefit_cost_ratio |
230:1 |
Replace with _latex versions for $$ blocks containing calculations.
Check for useful auto-generated charts:
# List variables used in file
grep -o "{{< var [a-z_]* >}}" <file> | sed 's/{{< var //;s/ >}}//' | sort -u
# For each variable, check if charts exist in knowledge/figures/
ls knowledge/figures/*<variable_name>*.qmd
Charts available per calculated variable:
tornado-<var>.qmd - Sensitivity analysis (which inputs matter most)mc-distribution-<var>.qmd - Monte Carlo probability distributionexceedance-<var>.qmd - Probability of exceeding thresholdssensitivity-table-<var>.qmd - Regression coefficientsAdd charts where they enhance understanding - especially for key metrics like ROI, BCR, costs. Include with:
{{< include ../figures/tornado-<variable_name>.qmd >}}
Read through the preview and evaluate:
_latex vars automatically)forward_pearson_correlation_coefficient → $r_{forward}$═══, ───) - use markdown tablesUse Edit tool to fix identified issues. Track changes with TodoWrite.
Common fixes:
{{< var variable_cite >}}$$ blocks with {{< var variable_latex >}}Run pre-render validation to catch automated issues:
.venv/Scripts/python.exe scripts/pre-render-validation.py 2>&1 | grep -A2 "<filename>"
.venv/Scripts/python.exe scripts/preview-qmd-with-variables.py <file> --line-range "1-50"
Automated checks include:
[MISSING: variable] - undefined variables_latex variables (redundant equations)If duplicate _latex variables found:
## Review Complete: <filename>
### Preview: `_analysis/<basename>-preview.md`
### Variable Replacements
| Line | Old | New Variable |
|------|-----|--------------|
### Content Improvements
- [x] Added plain English summary to Section X
- [x] Fixed weak opening in intro
- [x] Added concrete example for BCR concept
### Kept Hardcoded (Intentional)
- Copenhagen Consensus data, calibration params, 1% treaty
### Validation: PASSED
1% treaty concept