$npx -y skills add lucifer1004/claude-skill-typst --skill typstTypst document creation and package development. Use when: (1) Working with .typ files, (2) User mentions typst, typst.toml, or typst-cli, (3) Creating or using Typst packages, (4) Developing document templates, (5) Converting Markdown/LaTeX to Typst
| 1 | # Typst |
| 2 | |
| 3 | This skill targets Typst 0.15+ by default. For Typst 0.14.2, use the |
| 4 | `typst-0.14.2` repository tag for the previous skill snapshot, `typst query` |
| 5 | for CLI introspection, or `--channel 0.14.2` with API search. |
| 6 | |
| 7 | ## Compilation |
| 8 | |
| 9 | ```bash |
| 10 | typst compile document.typ # compile once → PDF |
| 11 | typst compile document.typ output.pdf # explicit output path |
| 12 | typst compile document.typ -f png # export as PNG image |
| 13 | typst compile src/main.typ --root . # set project root for /path imports |
| 14 | typst watch document.typ # recompile on change |
| 15 | typst eval --in document.typ 'query(heading).len()' # Typst 0.15+ introspection |
| 16 | ``` |
| 17 | |
| 18 | For command options beyond this quick reference, see [cli.md](cli.md). |
| 19 | |
| 20 | Agent verification — choose by what you need to check (see [debug.md](debug.md) for details): |
| 21 | |
| 22 | | Method | Command | Best for | |
| 23 | | ----------- | ----------------------------------------------------------------------- | ----------------------------------------- | |
| 24 | | HTML export | `typst compile doc.typ /dev/stdout -f html --features html 2>/dev/null` | Text content, structure, headings, tables | |
| 25 | | PNG export | `typst compile doc.typ page-{p}.png -f png` | Visual layout, alignment, spacing, fonts | |
| 26 | | pdftotext | `typst compile doc.typ && pdftotext doc.pdf -` | Fallback for page-specific content | |
| 27 | |
| 28 | ## Minimal Document |
| 29 | |
| 30 | ```typst |
| 31 | #set page(paper: "a4", margin: 2cm) |
| 32 | #set text(size: 11pt) |
| 33 | |
| 34 | = Title |
| 35 | |
| 36 | Content goes here. |
| 37 | ``` |
| 38 | |
| 39 | ## Writing Documents |
| 40 | |
| 41 | **Starting a new document?** Copy the closest recipe from [Examples](#examples) below — it's faster than starting blank and each row names the docs to read next. |
| 42 | |
| 43 | | When you need to... | Read | |
| 44 | | -------------------------------------------------- | ------------------------------ | |
| 45 | | Learn syntax, imports, functions, control flow | [basics.md](basics.md) | |
| 46 | | Learn data types, operators, string/array methods | [types.md](types.md) | |
| 47 | | Style pages, headings, figures, layout | [styling.md](styling.md) | |
| 48 | | Tables, grids, cell spans, borders, data tables | [tables.md](tables.md) | |
| 49 | | Academic papers, bibliography, theorems, equations | [academic.md](academic.md) | |
| 50 | | Convert from Markdown or LaTeX | [conversion.md](conversion.md) | |
| 51 | | Use Typst CLI commands and build options | [cli.md](cli.md) | |
| 52 | | Extract data from documents, multi-pass builds | [query.md](query.md) | |
| 53 | |
| 54 | ## Developing Packages and Templates |
| 55 | |
| 56 | | When you need to... | Read | |
| 57 | | ---------------------------------------------- | -------------------------- | |
| 58 | | State, counters, in-document `query()`, XML | [advanced.md](advanced.md) | |
| 59 | | CLI introspection, metadata export, multi-pass | [query.md](query.md) | |
| 60 | | Create a reusable template function | [template.md](template.md) | |
| 61 | | Create or publish a package | [package.md](package.md) | |
| 62 | | Verify output (HTML/PNG/pdftotext, repr) | [debug.md](debug.md) | |
| 63 | | Profile performance (--timings, hotspots) | [perf.md](perf.md) | |
| 64 | |
| 65 | [basics.md](basics.md) and [types.md](types.md) are also the foundation for developers. |
| 66 | |
| 67 | ## Finding Packages |
| 68 | |
| 69 | Search the embedded index of Typst Universe packages (updated weekly): |
| 70 | |
| 71 | ```bash |
| 72 | python3 scripts/search-packages.py "what you need" |
| 73 | python3 scripts/search-packages.py "chart" --category visualization |
| 74 | python3 scripts/search-packages.py --category cv --top 5 |
| 75 | python3 scripts/search-packages.py --list-categories |
| 76 | ``` |
| 77 | |
| 78 | ## Common Errors |
| 79 | |
| 80 | | Error | Cause | Fix | |
| 81 | | ------------------------------------------------ | ---------------------------- | ---------------------------------------------------- | |
| 82 | | "unknown variable" | Undefined identifier | Check spelling, ensure `#let` before use | |
| 83 | | "expected X, found Y" | Type mismatch | Check function signature in docs | |
| 84 | | "file not found" | Bad import path | Paths resolve relative to current file | |
| 85 | | "unknown font" | Font not installed | Use system fonts or web-safe alternatives | |
| 86 | | "maximum function call depth exceeded" | Deep recursion |