$npx -y skills add thvroyal/kimi-skills --skill kimi-pdfProfessional PDF solution. Create PDFs using HTML+Paged.js (academic papers, reports, documents). Process existing PDFs using Python (read, extract, merge, split, fill forms). Supports KaTeX math formulas, Mermaid diagrams, three-line tables, citations, and other academic element
| 1 | ## Route Selection |
| 2 | |
| 3 | | Route | Trigger | Route File | |
| 4 | |-------|---------|------------| |
| 5 | | **HTML** (default) | All PDF creation requests | `routes/html.md` | |
| 6 | | **LaTeX** | User explicitly requests LaTeX, .tex, or Tectonic | `routes/latex.md` | |
| 7 | | **Process** | Work with existing PDFs (extract, merge, fill forms, etc.) | `routes/process.md` | |
| 8 | |
| 9 | **Default to HTML.** Only use LaTeX route when user explicitly requests it. |
| 10 | |
| 11 | ### MANDATORY: Read Route File Before Implementation |
| 12 | |
| 13 | <system-reminder> |
| 14 | You MUST read the corresponding route file before writing ANY code. |
| 15 | Route files contain critical implementation details NOT duplicated here. |
| 16 | Skipping this step leads to incorrect output (wrong scripts, missing CSS, broken layouts). |
| 17 | </system-reminder> |
| 18 | |
| 19 | **Before implementation, you MUST:** |
| 20 | 1. Determine the route (HTML / LaTeX / Process) |
| 21 | 2. **Read the route file** (`routes/html.md`, `routes/latex.md`, or `routes/process.md`) |
| 22 | 3. Only then proceed with implementation |
| 23 | |
| 24 | This file (SKILL.md) contains constraints and principles. Route files contain **how-to details**. |
| 25 | |
| 26 | ### Decision Rules |
| 27 | |
| 28 | #### Route Selection |
| 29 | | User Says | Route | |
| 30 | |-----------|-------| |
| 31 | | "Create a PDF", "Make a report", "Write a paper" | HTML | |
| 32 | | "Use LaTeX", "Compile .tex", "Use Tectonic" | LaTeX | |
| 33 | | "Extract text from PDF", "Merge these PDFs", "Fill this form" | Process | |
| 34 | |
| 35 | #### Cover Style Selection (HTML Route) |
| 36 | | Context | Style | |
| 37 | |---------|-------| |
| 38 | | Academic paper, thesis, formal coursework | **Minimal** (white, centered, no decoration) | |
| 39 | | Reports, proposals, professional documents | **Designed** (choose from style reference in html.md) | |
| 40 | | Uncertain | Default to **Designed** — plain text cover = mediocre | |
| 41 | |
| 42 | **Key principle**: Cover background separates "acceptable" from "impressive". See html.md for 11 style options. |
| 43 | |
| 44 | #### Citation Format Selection |
| 45 | | Document Language | Format | |
| 46 | |-------------------|--------| |
| 47 | | Chinese | GB/T 7714 (use [J][M][D] identifiers) | |
| 48 | | English | APA | |
| 49 | | Mixed | Chinese refs → GB/T 7714, English refs → APA | |
| 50 | |
| 51 | --- |
| 52 | |
| 53 | ## Quick Start |
| 54 | |
| 55 | **Use the unified CLI for all operations:** |
| 56 | |
| 57 | ```bash |
| 58 | # Check environment (JSON output, exit code 0=ok, 2=missing deps) |
| 59 | /app/.kimi/skills/kimi-pdf/scripts/pdf.sh check |
| 60 | |
| 61 | # Auto-fix missing dependencies (idempotent, safe to run multiple times) |
| 62 | /app/.kimi/skills/kimi-pdf/scripts/pdf.sh fix |
| 63 | |
| 64 | # Convert HTML to PDF |
| 65 | /app/.kimi/skills/kimi-pdf/scripts/pdf.sh html input.html |
| 66 | |
| 67 | # Compile LaTeX to PDF |
| 68 | /app/.kimi/skills/kimi-pdf/scripts/pdf.sh latex input.tex |
| 69 | ``` |
| 70 | |
| 71 | **Exit codes:** |
| 72 | - `0` = success |
| 73 | - `1` = usage error |
| 74 | - `2` = dependency missing (run `pdf.sh fix`) |
| 75 | - `3` = runtime error |
| 76 | |
| 77 | **Dependencies by route:** |
| 78 | - **HTML route**: Node.js, Playwright, Chromium |
| 79 | - **Process route**: Python 3, pikepdf, pdfplumber |
| 80 | - **LaTeX route**: Tectonic |
| 81 | |
| 82 | --- |
| 83 | |
| 84 | ## Core Constraints (Must Follow) |
| 85 | |
| 86 | ### 1. Output Language |
| 87 | **Output language must match user's query language.** |
| 88 | - User writes in Chinese → PDF content in Chinese |
| 89 | - User writes in English → PDF content in English |
| 90 | - User explicitly specifies language → Follow user's specification |
| 91 | |
| 92 | ### 2. Word Count and Page Constraints |
| 93 | - Strictly follow user-specified word/page count requirements |
| 94 | - Do not arbitrarily inflate content length |
| 95 | |
| 96 | ### 3. Citation and Search Standards |
| 97 | |
| 98 | #### CRITICAL: Search Before Writing |
| 99 | **DO NOT fabricate information. When in doubt, SEARCH.** |
| 100 | |
| 101 | If content involves ANY of these, you **MUST search FIRST** before writing: |
| 102 | - Statistics, numbers, percentages, rankings |
| 103 | - Policies, regulations, laws, standards |
| 104 | - Academic research, theories, methodologies |
| 105 | - Current events, recent developments |
| 106 | - **Anything you're not 100% certain about** |
| 107 | |
| 108 | <system-reminder> |
| 109 | Never proceed with writing if you need statistics, research data, or policy information without searching first. |
| 110 | Making up facts is strictly prohibited. When uncertain, search. |
| 111 | </system-reminder> |
| 112 | |
| 113 | #### When Search is Required |
| 114 | | Scenario | Search? | Notes | |
| 115 | |----------|---------|-------| |
| 116 | | Statistics, data | **Required** | e.g., "2024 employment rate" | |
| 117 | | Policies, regulations | **Required** | e.g., "startup subsidies" | |
| 118 | | Research, papers | **Required** | e.g., "effectiveness of method X" | |
| 119 | | Time-sensitive content | **Required** | Information after knowledge cutoff | |
| 120 | | **Uncertain facts** | **Required** | If unsure, always search | |
| 121 | | Common knowledge | Not needed | e.g., "water boils at 100°C" | |
| 122 | |
| 123 | **Search workflow**: |
| 124 | 1. Identify facts/data requiring verification |
| 125 | 2. Search for authentic sources |
| 126 | 3. If results insufficient, **iterate search** until reliable info obtained |
| 127 | 4. Include real sources in references |
| 128 | 5. **If search fails repea |