CGPT Quarto Debugger
Use this skill for Quarto build failures caused by document source, project configuration, or scholarly apparatus. Keep it distinct from cgpt-quarto-render-windows, which handles Windows PATH, PATHEXT, spawned-shell, and stale-render environment hardening.
Triage Boundary
Use this skill when symptoms point to:
- YAML/front matter syntax, nesting, duplicate keys, or wrong format options.
- Citation failures: missing bibliography, bad
.bib path, missing keys, malformed entries, or CSL path issues.
- Cross-reference failures: unresolved
@fig-*, @tbl-*, @eq-*, @sec-*, duplicate labels, wrong prefixes, or rendered ???.
- Include/filter/project issues: missing
_quarto.yml, _metadata.yml, _variables.yml, partials, Lua filters, custom templates, or extension paths.
- Pandoc, Typst, LaTeX, knitr, or Jupyter errors that trace back to source content or chunk code.
If cmd, quarto, R, Python, or output freshness fails only in Codex/PowerShell/scheduled tasks, switch to cgpt-quarto-render-windows.
Workflow
- Capture the exact render command, target format, error text, and expected output path.
- Read the relevant
.qmd plus nearby config files: _quarto.yml, _metadata.yml, include files, bibliography files, CSL files, filters, and referenced assets.
- Classify the failure before editing: YAML, citations, crossrefs, includes, filters/templates, engine/chunk, or target-format incompatibility.
- Make the smallest source/config fix that explains the observed failure.
- Re-render the requested target when feasible.
- Hand the resulting artifact to
cgpt-render-check for final output validation.
Fast Checks
YAML
- Front matter starts and ends with
---.
- Indentation uses spaces, not tabs.
- Format options are nested under the target format.
- Values with colons or special characters are quoted.
- Common keys are spelled correctly:
bibliography, csl, crossref, number-sections, reference-doc, include-before-body, include-after-body.
- Project-level config does not conflict with document-level config.
Citations
bibliography: exists when citations appear.
- Bibliography paths resolve relative to the rendering document or project.
- Citation keys in text match
.bib entry keys exactly, including case.
.bib entries have balanced braces and valid field syntax.
- CSL files exist and are appropriate for the target style.
Crossrefs
- Every
@fig-*, @tbl-*, @eq-*, and @sec-* reference has exactly one matching label.
- Labels use the right prefix and include the leading
# where Quarto expects it.
- Figure/table captions are present when the target format requires them for crossrefs.
- Labels are not duplicated across included files.
- Reference text does not mix underscores and hyphens by accident.
Includes, Assets, And Filters
- Include paths, image paths, reference docs, and templates exist.
- Paths with spaces are quoted in YAML.
- Lua filters and Quarto extensions are installed or vendored into the project.
- Format-specific raw blocks are guarded with Quarto conditional content when rendering to multiple targets.
Useful Commands
Run from the project directory when possible:
quarto render "path\to\file.qmd" --to html --log debug
quarto render "path\to\file.qmd" --to docx --log debug
quarto check
For source inventory, prefer rg:
rg "@(fig|tbl|eq|sec)-|#(fig|tbl|eq|sec)-" "path\to\project"
rg "@[A-Za-z0-9_:-]+" "path\to\file.qmd"
rg "bibliography:|csl:|include-|filters:|reference-doc:" "path\to\project"
Rules
- Do not rewrite manuscript prose while fixing build mechanics unless the prose contains the broken reference, citation, or include.
- Do not treat a successful exit code as final validation; inspect output and run
cgpt-render-check.
- Do not make Windows environment fixes in this skill; route those to
cgpt-quarto-render-windows.
- Report the root cause, changed files, render command, and remaining warnings.
1---2name: cgpt-quarto-debugger3description: Diagnose and fix Quarto source problems in `.qmd` projects, especially YAML/front matter, citations, cross-references, includes, filters, and Pandoc/engine errors. Use when Quarto renders fail, output shows unresolved references, citations do not resolve, includes are missing, or a user shares a Quarto error and asks what it means.4---56# CGPT Quarto Debugger78Use this skill for Quarto build failures caused by document source, project configuration, or scholarly apparatus. Keep it distinct from `cgpt-quarto-render-windows`, which handles Windows PATH, PATHEXT, spawned-shell, and stale-render environment hardening.910## Triage Boundary1112Use this skill when symptoms point to:1314- YAML/front matter syntax, nesting, duplicate keys, or wrong format options.15- Citation failures: missing bibliography, bad `.bib` path, missing keys, malformed entries, or CSL path issues.16- Cross-reference failures: unresolved `@fig-*`, `@tbl-*`, `@eq-*`, `@sec-*`, duplicate labels, wrong prefixes, or rendered `???`.17- Include/filter/project issues: missing `_quarto.yml`, `_metadata.yml`, `_variables.yml`, partials, Lua filters, custom templates, or extension paths.18- Pandoc, Typst, LaTeX, knitr, or Jupyter errors that trace back to source content or chunk code.1920If `cmd`, `quarto`, R, Python, or output freshness fails only in Codex/PowerShell/scheduled tasks, switch to `cgpt-quarto-render-windows`.2122## Workflow23241. Capture the exact render command, target format, error text, and expected output path.252. Read the relevant `.qmd` plus nearby config files: `_quarto.yml`, `_metadata.yml`, include files, bibliography files, CSL files, filters, and referenced assets.263. Classify the failure before editing: YAML, citations, crossrefs, includes, filters/templates, engine/chunk, or target-format incompatibility.274. Make the smallest source/config fix that explains the observed failure.285. Re-render the requested target when feasible.296. Hand the resulting artifact to `cgpt-render-check` for final output validation.3031## Fast Checks3233### YAML3435- Front matter starts and ends with `---`.36- Indentation uses spaces, not tabs.37- Format options are nested under the target format.38- Values with colons or special characters are quoted.39- Common keys are spelled correctly: `bibliography`, `csl`, `crossref`, `number-sections`, `reference-doc`, `include-before-body`, `include-after-body`.40- Project-level config does not conflict with document-level config.4142### Citations4344- `bibliography:` exists when citations appear.45- Bibliography paths resolve relative to the rendering document or project.46- Citation keys in text match `.bib` entry keys exactly, including case.47- `.bib` entries have balanced braces and valid field syntax.48- CSL files exist and are appropriate for the target style.4950### Crossrefs5152- Every `@fig-*`, `@tbl-*`, `@eq-*`, and `@sec-*` reference has exactly one matching label.53- Labels use the right prefix and include the leading `#` where Quarto expects it.54- Figure/table captions are present when the target format requires them for crossrefs.55- Labels are not duplicated across included files.56- Reference text does not mix underscores and hyphens by accident.5758### Includes, Assets, And Filters5960- Include paths, image paths, reference docs, and templates exist.61- Paths with spaces are quoted in YAML.62- Lua filters and Quarto extensions are installed or vendored into the project.63- Format-specific raw blocks are guarded with Quarto conditional content when rendering to multiple targets.6465## Useful Commands6667Run from the project directory when possible:6869```powershell70quarto render "path\to\file.qmd" --to html --log debug71quarto render "path\to\file.qmd" --to docx --log debug72quarto check73```7475For source inventory, prefer `rg`:7677```powershell78rg "@(fig|tbl|eq|sec)-|#(fig|tbl|eq|sec)-" "path\to\project"79rg "@[A-Za-z0-9_:-]+" "path\to\file.qmd"80rg "bibliography:|csl:|include-|filters:|reference-doc:" "path\to\project"81```8283## Rules8485- Do not rewrite manuscript prose while fixing build mechanics unless the prose contains the broken reference, citation, or include.86- Do not treat a successful exit code as final validation; inspect output and run `cgpt-render-check`.87- Do not make Windows environment fixes in this skill; route those to `cgpt-quarto-render-windows`.88- Report the root cause, changed files, render command, and remaining warnings.