typst-author
它能做什么
这项技能帮助智能体创建、编辑和排查 Typst 文件,并回答关于 Typst 语法的问题。适合喜欢 Typst 而不是 LaTeX 的写作者和学生。
适用场景
- ✓当你想创建新的 Typst 文档或报告时。
- ✓当你需要修复 Typst 文件中的错误,或让它能够编译的时候。
- ✓当你对 Typst 的格式、样式或包有疑问时。
技能链接
https://github.com/jihe520/MathModelAgent/blob/main/skills/typst-author/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我的笔记整理成一份 Typst 报告,包含页码、标题和两个小节标题,并修复所有编译错误。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能为智能体提供初始版式,以及创建、编辑和格式化 Typst 文件的工作流程。它还会让智能体在修改前参考 Typst 参考页面,以核对语法。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
typst-author skill
Overview
This skill helps agents generate, edit, and reason about Typst documents. It provides quick‑start examples, detailed workflows, and links to the full Typst documentation (guides, tutorials, reference).
Minimal document example
#set document(title: "My Document", author: "Author Name")
#set page(numbering: "1")
#set text(lang: "en")
// Enable paragraph justification and character-level justification
#set par(
justify: true,
justification-limits: (
tracking: (min: -0.012em, max: 0.012em),
spacing: (min: 75%, max: 120%),
)
)
#title[My Document]
= Heading 1
This is a paragraph in Typst.
== Heading 2
#lorem(50)
Workflows
- Creating a new Typst project: Use the "Minimal document example" above as a starting point. Skim the tutorial for the basics (docs/tutorial/writing-in-typst.md), then create the
.typfile(s). After each.typedit, follow the post-edit formatting checks below whentypstyleis available. - Editing existing content: Locate the target text and apply changes; confirm syntax against the reference when needed (docs/reference/). After each modified
.typfile, follow the post-edit formatting checks below. - Formatting & Styling: Consult the styling guide (docs/reference/styling.md) for
set rule,show rule, and custom themes.
Documentation
- Syntax & foundations:
docs/reference/syntax.md - Styling & show/set rules:
docs/reference/styling.md - Scripting & runtime behavior:
docs/reference/scripting.md - Page setup & tables:
docs/guides/page-setup.mdanddocs/guides/tables.md - Task-oriented authoring help:
docs/tutorial/writing-in-typst.md,docs/guides/*.md, anddocs/reference/**/*.md
Detailed instructions
- PRIORITY: Trust local documentation. Your internal training data regarding Typst may be outdated or hallucinated. Always verify function names, parameters, and syntax against the local
docs/folder before generating code. - Read the relevant documentation using local file search and open tools on the paths above.
- Use local docs for syntax and reference questions. Verify syntax, function names, parameters, and reference behavior from the bundled docs. Run a minimal Typst probe only when runtime or evaluation behavior remains unclear after checking the docs.
- Generate or modify the
.typsource according to the user's request. - Run the post-edit formatting checks below for every
.typfile you created or edited in that pass. - Validate with
typst compileafter the formatting decision is complete when you created or edited.typfiles, or when the user explicitly asks for verification (if tool access is allowed). - Summarize touched files and outcomes. Provide full
.typcontent only when the user requests it or when direct editing is not possible, and optionally include a rendered preview (PDF/HTML).
Probing uncertain behavior
- Use a probe when the bundled docs do not settle runtime or evaluation behavior.
- Model the case with Typst scripting as described in docs/reference/scripting.md.
- When a probe is necessary, prefer a fileless probe through stdin instead of creating scratch
.typfiles. Expose the value withmetadata(...) <probe>and read it withtypst query - "<probe>" --field value --one. See docs/reference/introspection/query.md and docs/reference/introspection/metadata.md. - Example:
printf '#metadata(1 + 2) <probe>\n' | typst query - "<probe>" --field value --one
Post-edit formatting checks
- Check whether
typstyleis available withcommand -v typstyle. If it is unavailable, skip the remaining formatting checks. - After each
.typfile modification, runtypstyle --check <file>for the file you just created or edited. - If
typstyle --checkfails, inspect the formatter changes withtypstyle --diff <file>before deciding what to do. - Apply formatting with
typstyle -i <file>only when the formatter changes are limited to a newly created file or to code you created or edited in the current task. - Stop and ask the user when formatting would change untouched pre-existing code. If the diff reaches outside your own edits, or if you cannot confidently prove that e
常见问题
什么是 Typst?
Typst 是一种用于编写文档的标记语言,用途与 LaTeX 相近。
它会格式化我的文件吗?
技能包含格式检查,在可用 typstyle 工具时,会在编辑后运行。
它能帮忙处理模板吗?
可以。描述中说明,它涵盖模板工作和包的使用。
详情
作者的原始描述
Generate idiomatic Typst (.typ) code, edit and troubleshoot Typst documents and projects, and answer Typst syntax/reference questions. Use when working with .typ files or when the user explicitly asks for Typst document creation, editing, debugging, compilation, formatting, template work, or package usage.
repo: jihe520/MathModelAgent
热度
- GitHub 星标
- 6.3k
- 排名
- #14376
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …