Skip to content
⚠️ This document is AI-translated. The Chinese version is the authoritative source.

Direct Template Invocation with AI + Skills ​

What This Tutorial Teaches ​

You'll learn to use AI to directly call Presto templates, converting Markdown to Typst without opening the Presto application. Just say a sentence in Claude Code, and AI will automatically find the template, read the file, and perform the conversion.

  • Estimated time: 15-20 minutes
  • Final deliverable: Complete a Markdown -> Typst conversion using AI from the command line
  • Prerequisites: Presto installed (with templates), Claude Code installed

Ready? Let's begin.


Part 1: Install the Presto Skill ​

Claude Code's Skill mechanism enables AI to automatically recognize your intent and call the appropriate tool. We need to place the presto-convert Skill where Claude Code can read it.

Best when you frequently use Presto conversion in a specific project:

bash
mkdir -p .claude/skills/presto-convert
cp ~/Developer/Presto-io/Presto-doc/skills/presto-convert/SKILL.md \
   .claude/skills/presto-convert/SKILL.md

Option 2: Install to Global Directory ​

Best when you want to use it from any directory:

bash
mkdir -p ~/.claude/skills/presto-convert
cp ~/Developer/Presto-io/Presto-doc/skills/presto-convert/SKILL.md \
   ~/.claude/skills/presto-convert/SKILL.md

Verify Installation ​

Open Claude Code and mention something related to Presto templates, like "Help me see what Presto templates are available." If AI recognizes the Skill and starts scanning the ~/.presto/templates/ directory, the installation was successful.


Part 2: View Installed Templates ​

After installing the Skill, let's see which templates are available locally.

Conversation Replay ​

You: Help me see what Presto templates are installed locally?

AI: Let me scan your templates directory.

bash
ls ~/.presto/templates/

You have the following templates installed:

Template NameDirectory
letter~/.presto/templates/letter/
report~/.presto/templates/report/

Let me check the detailed information for each template.

bash
~/.presto/templates/letter/presto-template-letter --manifest
json
{
  "name": "letter",
  "version": "0.1.0",
  "description": "Chinese business letter template",
  "author": "Presto"
}
bash
~/.presto/templates/report/presto-template-report --manifest
json
{
  "name": "report",
  "version": "0.1.0",
  "description": "Technical report template",
  "author": "Presto"
}

You have two templates:

  • letter — Chinese business letter template
  • report — Technical report template

Which template would you like to use for document conversion?

Verification Point ​

You should be able to see template names and descriptions. If the ~/.presto/templates/ directory is empty, it means no templates are installed yet. You'll need to install some through the Presto application first.


Part 3: Convert Documents with AI ​

Now let's do a complete conversion. Let's say you have a Markdown file you want to convert to Typst.

Conversation Replay ​

You: Use the letter template to convert ./notes/meeting-2026-03.md to Typst

AI: Let me first check the contents of this file.

bash
cat ./notes/meeting-2026-03.md
markdown
---
to: Manager Zhang
from: Li Ming
date: 2026-03-01
subject: Q1 Project Progress Report
---

Dear Manager Zhang,

The project has progressed smoothly this quarter. The following work has been completed:

1. Core module development completed
2. Passed security audit
3. Positive user testing feedback

Please review.

Content confirmed. Now converting with the letter template.

bash
cat ./notes/meeting-2026-03.md | ~/.presto/templates/letter/presto-template-letter > ./notes/meeting-2026-03.typ

Conversion complete. The generated Typst file is saved at ./notes/meeting-2026-03.typ. Let me check the output:

bash
cat ./notes/meeting-2026-03.typ
typst
#import "@preview/letter:0.1.0": *

#show: letter.with(
  to: "Manager Zhang",
  from: "Li Ming",
  date: "2026-03-01",
  subject: "Q1 Project Progress Report",
)

Dear Manager Zhang,

The project has progressed smoothly this quarter. The following work has been completed:

+ Core module development completed
+ Passed security audit
+ Positive user testing feedback

Please review.

Typst source code generated. If you have the typst CLI installed locally, I can compile it further to PDF.

Verification Point ​

Check that the output .typ file exists and contains Typst-formatted code.


Part 4: Advanced Usage ​

Now that you've mastered the basics, here are some practical tips.

Batch Convert Multiple Files ​

You: Convert all .md files in ./notes/ using the report template

AI will iterate through the directory and perform conversions one by one:

bash
for f in ./notes/*.md; do
  cat "$f" | ~/.presto/templates/report/presto-template-report \
    > "${f%.md}.typ"
done

Specify Output Path ​

You: Convert draft.md using the letter template, output to ./output/draft.typ

AI will automatically create the directory and output to the specified location:

bash
mkdir -p ./output
cat draft.md | ~/.presto/templates/letter/presto-template-letter \
  > ./output/draft.typ

View Template's Example Document ​

Want to know what format a template expects? Use --example to view:

bash
~/.presto/templates/letter/presto-template-letter --example

This outputs a sample Markdown demonstrating the frontmatter fields and body structure that the template supports.

Compile to PDF ​

If you have the typst CLI installed, you can go straight to PDF in one step:

bash
cat input.md | ~/.presto/templates/letter/presto-template-letter \
  | typst compile - output.pdf

Or do it in two steps:

bash
# First convert to Typst
cat input.md | ~/.presto/templates/letter/presto-template-letter > output.typ
# Then compile to PDF
typst compile output.typ output.pdf

Next Steps ​

This tutorial covered the complete workflow from installing the Skill to completing a conversion. Next, you can:

Presto — Markdown to PDF