Check Typst Files for Errors
Use this skill to get diagnostics (errors, warnings) from Typst files.
Error Sources (try in order)
1. VS Code Diagnostics (preferred when in VS Code)
If mcp__ide__getDiagnostics is available, use it first:
- •Returns real-time LSP diagnostics from tinymist running in VS Code
- •Includes errors, warnings, and hints with line/column locations
- •No need to save the file first
2. Tinymist CLI (fallback)
If VS Code diagnostics unavailable, run tinymist directly:
bash
tinymist compile --check <file.typ> 2>&1
Note: --check validates without producing output PDF.
Auto-detect file
- •If a specific
.typfile is mentioned, use it - •Otherwise, search for
.typfiles in current directory using Glob - •If multiple files found, check the most recently modified or ask user
- •If exactly one file found, use it automatically
Output format
Report diagnostics clearly:
- •Group by severity (errors first, then warnings)
- •Include file path, line number, column
- •Quote the problematic code if possible
- •Suggest fixes based on the
/typstskill knowledge
Common errors and fixes
- •“Unknown variable” → Check spelling, ensure
#letbefore use - •“Expected content” → Wrap value in brackets:
[#value] - •“Cannot apply” → Check function signature and argument types
- •“Unexpected end” → Check for unclosed brackets
{,[,(