typst-writer
БесплатноБез исполняемых скриптовНе проверенWrite correct and idiomatic Typst code for document typesetting. Use when creating or editing Typst (.typ) files, working with Typst markup, or answering…
Об этом скилле
Typst Writer
This skill provides guidance for writing correct Typst code, with emphasis on avoiding common syntax errors from conflating Typst with other languages.
Core Principles
- Never assume syntax from other languages applies - Typst has its own semantics, especially for data structures
- Verify uncertain syntax - When unsure, check official documentation
- Use idiomatic patterns - Follow Typst conventions for clean, maintainable code
Quick Syntax Reference
Critical distinctions:
- Arrays:
(item1, item2)- parentheses - Dictionaries:
(key: value, key2: value2)- parentheses with colons - Content blocks:
[markup content]- square brackets - NO tuples - Typst only has arrays
For detailed syntax rules and common patterns, see references/syntax.md.
Documentation Resources
Official Documentation
- Core language reference: https://typst.app/docs/reference/
- Typst Universe - Central package & template registry:
- main page (JS SPA): https://typst.app/universe
- whole registry is just a regular GitHub repo: https://github.com/typst/packages
Searching for Typst Packages
Typst Universe (the official package registry) doesn't have a programmatic API, but you can search for packages via GitHub:
- Most packages are hosted on GitHub
- Use
gh search, or SearXNG's repos search (see thesearxng-searchSkill) - Example: Search for "typst diagram" or "typst table" in repositories
With GitHub CLI
Direct GitHub search examples:
# Search for typst repos about some topic
gh search repos --language "typst" --json "url,language,description" diagram arrows ...
# List all files in a given repo
gh search code --repo "Jollywatt/typst-fletcher"
# In a repo, search through all files of some type
gh search code --repo "Jollywatt/typst-fletcher" --extension "md" arrow node ...
When to Consult Documentation
- Uncertain about function signatures or parameters
- Need to verify syntax for less common features
- Looking for built-in functions or methods
- Exploring available packages (e.g.,
fletcherfor diagrams,draftingfor margin notes,tablexfor advanced tables)
Use WebFetch when needed to retrieve current documentation for verification.
Workflow
- Before writing: If syntax is unclear, consult references/syntax.md or documentation
- While writing:
- Use proper data structure syntax (arrays with
(), content with[]) - Define functions with
#let name(params) = { ... } - Use
contextblocks when accessing state
- Use proper data structure syntax (arrays with
- After writing: Review for Python/other language syntax leaking in
Common Mistakes to Avoid
- ❌ Calling things "tuples" (Typst only has arrays)
- ❌ Using
[]for arrays (use()instead) - ❌ Accessing array elements with
arr[0](usearr.at(0)) - ❌ Forgetting
#prefix for code in markup context - ❌ Mixing up content blocks
[]with code blocks{}
Example Workflow
// Define custom functions for document elements
#let important(body) = {
box(
fill: red.lighten(80%),
stroke: red + 1pt,
inset: 8pt,
body
)
}
// Use state for counters
#let example-counter = state("examples", 1)
#let example(body) = context {
let num = example-counter.get()
important[Example #num: #body]
example-counter.update(x => x + 1)
}
// Arrays for data
#let factions = (
(name: "Merchants", color: blue),
(name: "Artisans", color: green)
)
// Iterate and render
#for faction in factions [
- #text(fill: faction.color, faction.name)
]
Coding Guidelines
Avoid mixing content and layout
#set, #show and custom functions should be used to avoid mixing content with layout directives, and more importantly to ensure a visual consistency throughout the document.
Prefer conciseness and rely on defaults
Typst functions often have sane default values for layout parameters. When unsure which value a parameter should have, just leave it unspecified.
Likewise, a lot of function parameters admit different types depending on how much control the user wants to have over the layout. For instance:
#table(
columns: 3,
...
)
and
#table(
columns: (auto, auto, auto),
...
)
do the exact same thing. Prefer the first one if you don't want to have finer control over the size of one of the columns.
Use markup shortcuts when available
Use to-emphasize instead of #emph[to-emphasize].
Prefer unicode litterals over expressions
For instance just write π instead of $pi$ or #sym.pi, and just write 🧮 instead of #emoji.abacus.
Reading contents from a Typst file
Besides compiling, the typst CLI command can also run queries against a Typst file with typst query, using Typst selectors,
and get the result as JSON.
For instance, typst query the_document.typ "heading.where(level: 1)" | jq ".[].body.text" will list all the level-1 section
Установить typst-writer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл typst-writer?
Write correct and idiomatic Typst code for document typesetting. Use when creating or editing Typst (.typ) files, working with Typst markup, or answering questions about Typst syntax and features. Focuses on avoiding common syntax confusion (arrays vs content blocks, proper function definitions, state management).
Как установить скилл typst-writer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл typst-writer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic