This skill checks whether all tools required for the complete mathematical modeling workflow are ready, and helps the user install missing items.This skill runs only when explicitly triggered by the user, and does not execute automatically.
Checklist
Core Tools
| Tool | Purpose | Detection Command |
|---|---|---|
typst |
Paper compilation (5writing, 6verity, Typst engine) | command -v typst |
xelatex |
Paper compilation (5writing, 6verity, LaTeX engine, required for Chinese templates) | command -v xelatex |
python3 |
Numerical computation and charts (3coding-visual) | command -v python3 |
drawio / draw.io |
DrawIO flowchart export to PDF (4drawio) | command -v drawio || command -v draw.io |
pdftoppm |
PDF to PNG visual check (6verity) | command -v pdftoppm |
mutool |
PDF to PNG fallback (6verity) | command -v mutool |
magick |
PDF to PNG fallback (6verity) | command -v magick |
Python Packages
| Package | Purpose |
|---|---|
numpy |
Numerical computation |
scipy |
Scientific computing, optimization solving |
pandas |
Data processing |
matplotlib |
Chart generation |
scikit-learn |
Machine learning modeling |
openpyxl |
Read and write Excel data attachments |
Workflow
Step 1: Detect the current platform
case "$(uname -s)" in
Darwin) echo "PLATFORM=mac" ;;
Linux) echo "PLATFORM=linux" ;;
MINGW*|MSYS*|CYGWIN*) echo "PLATFORM=windows" ;;
*) echo "PLATFORM=unknown" ;;
esac
On Windows, prefer winget, with scoop or choco as fallback. On Linux, prefer apt (Debian/Ubuntu), with dnf (Fedora/RHEL) or pacman (Arch) as fallback.
Detect package manager:
# Linux 发行版检测
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "DISTRO=$ID"
fi
# Windows 包管理器检测(在 Git Bash / PowerShell 中)
command -v winget >/dev/null 2>&1 && echo "PKG=winget"
command -v scoop >/dev/null 2>&1 && echo "PKG=scoop"
command -v choco >/dev/null 2>&1 && echo "PKG=choco"
Step 2: Check all tools
check_cmd() {
if command -v "$1" >/dev/null 2>&1; then
echo "OK $1 ($(command -v "$1"))"
else
echo "MISS $1"
fi
}
check_cmd typst
check_cmd xelatex
check_cmd python3 || check_cmd python # Windows 上可能是 python
command -v drawio >/dev/null 2>&1 || command -v draw.io >/dev/null 2>&1 \
&& echo "OK drawio" || echo "MISS drawio"
check_cmd pdftoppm
check_cmd mutool
check_cmd magick
python3 - <<'PYEOF'
import importlib
pkgs = ["numpy", "scipy", "pandas", "matplotlib", "sklearn", "openpyxl"]
for p in pkgs:
try:
importlib.import_module(p)
import importlib.metadata as meta
try:
ver = meta.version(p if p != "sklearn" else "scikit-learn")
except Exception:
ver = "?"
print(f"OK {p} ({ver})")
except ImportError:
print(f"MISS {p}")
PYEOF
Step 3: Output the check report
Organize and display the results:
状态 工具/包 说明
---- -------- ----
✓ typst 0.13.0 论文编译
✗ drawio DrawIO 导出 PDF(可选)
✓ python3 3.11.x 数值计算
✗ scipy 科学计算(可选)
...
Required items: typst or xelatex (at least one paper compiler), python3, numpy, pandas, matplotlib
Optional items: drawio, one of pdftoppm/mutool/magick, scipy, scikit-learn, openpyxl
Step 4: Provide installation commands (by platform)
Output commands for the corresponding platform only for missing items.
typst
| Platform | Command |
|---|---|
| macOS | brew install typst |
| Linux (apt) | snap install typst or download the binary from GitHub Releases |
| Linux (arch) | pacman -S typst |
| Windows (winget) | winget install Typst.Typst |
| Windows (scoop) | scoop install typst |
| General | cargo install --locked typst-cli(requires Rust) |
xelatex (TeX distribution)
xelatex is included in mainstream TeX distributions (TeX Live / MiKTeX / MacTeX). Installing the distribution provides xelatex.
| Platform | Command |
|---|---|
| macOS | brew install --cask mactex or brew install texlive |
| Linux (apt) | sudo apt install texlive-full |
| Linux (dnf) | sudo dnf install texlive-scheme-full |
| Linux (arch) | sudo pacman -S texlive |
| Windows (winget) | winget install MiKTeX.MiKTeX or winget install TeXLive |
| Windows (scoop) | scoop install latex(requires adding the extras bucket first) |
Note:texlive-full is relatively large (about 5GB); if you need a slimmed-down install, you can install only texlive-xetex + texlive-lang-chinese(Chinese support).
Python 3
| Platform | Command |
|---|---|
| macOS | brew install python |
| Linux (apt) | sudo apt install python3 python3-pip |
| Linux (dnf) | sudo dnf install python3 python3-pip |
| Windows | winget install Python.Python.3 or download the installer from python.org |
Python packages (batch install missing items)
pip3 install <缺失的包>
# Windows: pip install <缺失的包>
# 例如: pip3 install scipy scikit-learn openpyxl
drawio
| Platform | Command |
|---|---|
| macOS | brew install --cask drawio |
| Linux | From https://github.com/jgraph/drawio-desktop/releases download the AppImage or deb |
| Windows | winget install JGraph.Draw or download the installer from the above page |
pdftoppm (from poppler)
| Platform | Command |
|---|---|
| macOS | brew install poppler |
| Linux (apt) | sudo apt install poppler-utils |
| Linux (dnf) | sudo dnf install poppler-utils |
| Windows | winget install oschwartz10612.poppler or scoop install poppler |
mutool (from mupdf)
| Platform | Command |
|---|---|
| macOS | brew install mupdf |
| Linux (apt) | sudo apt install mupdf-tools |
| Windows | scoop install mupdf Or download from mupdf.com |
ImageMagick
| Platform | Command |
|---|---|
| macOS | brew install imagemagick |
| Linux (apt) | sudo apt install imagemagick |
| Linux (dnf) | sudo dnf install imagemagick |
| Windows | winget install ImageMagick.ImageMagick or choco install imagemagick |
Step 5: Ask the user whether to install
After listing all missingrequired items, ask the user:
The above required items are missing. Install them now? (y/N)
- If the user confirms, execute the installation commands in order according to the detected platform, and print the result after each step.
- If the user declines or only optional items are missing, print the list of commands that can be run manually and exit.
- After installation is complete, rerun Step 2 to confirm it has taken effect.
Step 6: Final summary
Doctor 检查完成(macOS)
必须项:5/5 ✓
可选项:2/4(drawio、scipy 缺失)
工作流就绪状态:
1start-mathmodel ✓
2analysis-modeling ✓
3coding-visual ✓(scipy 缺失,部分功能受限)
4drawio ⚠ drawio 未安装,PDF 导出将跳过
5writing ✓(typst ✓,xelatex ✓)
6verity ⚠ 无 PDF 转 PNG 工具,视觉检查将跳过
Notes
- Explicit user confirmation must be obtained before performing installation; do not install silently.
- On Windows, it is recommended to run in PowerShell (Administrator) or Git Bash; some commands require administrator privileges.
- Linux's
sudocommand will request a password; inform the user before executing. - Missing drawio and PDF-to-PNG tools do not affect the core workflow, only the export quality.
- If the platform is detected as unknown, print the commands for all platforms for the user to choose manually.