Agent skill
modern-doc
Create, improve, and debug professional LuaLaTeX documents using KOMA-Script + the moderndoc package (and the legacy modern-doc shim). Use for: generating new documents from a goal, improving typography/layout, producing PDF/A-4-friendly output, setting up minted/biblatex/tabularray/tikz, converting Mermaid → TikZ, and debugging compilation logs.
Install this agent skill to your Project
npx add-skill https://github.com/tychota/moderndoc/tree/main/skill/modern-doc
SKILL.md
ModernDoc Skill
This skill helps users (beginners and advanced) produce high‑quality PDFs using:
- LuaLaTeX (Unicode + OpenType fonts)
- KOMA‑Script for layout and headings
- moderndoc style package
Workflow
0) If the user wants “a beautiful document fast”
Use the Template Picker below, then generate a complete, compilable template.
1) Template picker (choose the best starting point)
Ask only if missing:
- What are you writing? (paper/report/book/letter/etc.)
- Single vs two‑column?
- Any institutional constraints? (margin rules, spacing rules, required styles)
- Need code highlighting? (minted)
- Need bibliography? (biblatex)
Mapping:
| User goal | KOMA class | moderndoc doctype |
|---|---|---|
| Short article / documentation | scrartcl |
article |
| Conference paper (two‑column) | scrartcl + twocolumn |
paper |
| Technical/business report | scrreprt |
report |
| Thesis / dissertation | scrbook (preferred) |
thesis |
| Book / long-form | scrbook |
book |
| Formal letter | scrlttr2 |
letter |
Then generate from: references/templates.md.
2) Configure options safely
- Keep defaults unless the user asks.
- Use
references/options.mdto select: language, font, CJK strategy, citations, minted.
3) Add content features
- Bibliography: see
references/bibliography.md - Code: see
references/code-minted.md - Tables: see
references/tables-tabularray.md - Diagrams: see
references/diagrams-tikz.md(+ Mermaid conversion inreferences/mermaid.md)
4) Typography improvement pass (when editing existing LaTeX)
Must check:
- Paragraph style: indent OR skip (not both)
- Widows/orphans penalties enabled
- Two-column layout: KOMA typearea aware (
twocolumn=truebefore\recalctypearea) - No fake small caps by default (fallback to letterspaced caps)
5) Build and verify
Preferred build:
latexmk -lualatex --shell-escape main.tex
If minted disabled:
latexmk -lualatex main.tex
Debugging protocol (LaTeX compilation issues)
When user provides logs, follow this exact order:
- Identify the first real error in
.log(ignore cascaded errors). - Classify:
- Missing package (
*.sty not found) - Wrong engine (pdfTeX vs LuaLaTeX)
- Minted issue (shell escape / latexminted / pygmentize)
- Biber/biblatex mismatch
- Font not found (fontspec)
- Missing package (
- Provide:
- Root cause (1–2 lines)
- Exact fix command(s)
- Exact rebuild command(s)
If logs are not provided:
- Ask for
build/*.logor the terminal error output. - Suggest:
latexmk -lualatex -interaction=nonstopmode -file-line-error ...
Output style rules
- Provide complete, compilable snippets when generating documents.
- Prefer short patches (diff-style) when improving existing code.
- Explain why a change improves readability/robustness (1–2 sentences per change).
References index
references/templates.mdreferences/options.mdreferences/project-structure.mdreferences/luatex-koma.mdreferences/bibliography.mdreferences/code-minted.mdreferences/tables-tabularray.mdreferences/diagrams-tikz.mdreferences/mermaid.mdreferences/install-and-troubleshooting.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
git-guardrails-claude-code
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
scaffold-exercises
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
migrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
Didn't find tool you were looking for?