document-export
Skill33 starsChanged 2 months agoMITView on GitHub
Create a PDF, Excel (.xlsx), or Word (.docx) file from content. Use for "/document-export", "make a PDF", "export to Excel", "put this in a spreadsheet", "save this as a Word doc", or when the user needs a shareable office document rather than a note or a raw HTML page.
In this repository19 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-agentSkill
- build-listSkill
- chart-tufteSkill
- councilSkill
- handoverSkill
- index-memorySkill
- log-decisionSkill
- mcp-debugSkill
- meeting-prepSkill
- memory-debtSkill
- merge-contactsSkill
- morning-briefSkill
- post-callSkill
- reflectSkill
- system-auditSkill
- tasksSkill
- visual-explainerSkill
- weekly-reviewSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 77
Keep numbers as numbers in the JSON so Excel treats them as numeric.
- Distinctive: line 123
Delete any temporary spec file you created.
- Distinctive: line 125
If the user wants to share the file, that is an outward action: hand it over, do not send it anywhere yourself.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Document Export
Turn content into a real office file: a PDF, an Excel workbook, or a Word document. The skill ships three helper scripts that do the file writing deterministically; your job is to assemble the content and call the right one.
These scripts use the Python standard library only, so there is nothing to install for Excel and Word. PDF needs a browser or a PDF tool on the machine (the script finds it, or tells the user what to install).
Save every output to reports/ as YYYY-MM-DD-<slug>.<ext>, then tell the user
the path.
PDF is produced by rendering an HTML file. Two cases:
- Rich, visual page (architecture, dashboard, comparison): use the
visual-explainerskill to build the HTML, then convert it. - Plain document (a letter, a report, a write-up): wrap the content in this
minimal template and save it as an
.htmlfile:
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>TITLE</title>
<style>
@page { margin: 2cm; }
body { font: 11pt/1.55 -apple-system, "Segoe UI", Roboto, sans-serif;
color: #1a1a1a; max-width: 46em; margin: 0 auto; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.8em; } h2 { font-size: 1.35em; margin-top: 1.6em; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ccc; padding: 6px 10px; text-align: left; }
code { background: #f4f4f4; padding: 1px 4px; border-radius: 3px; }
</style></head><body>
<!-- CONTENT -->
</body></html>Then convert:
python3 .claude/skills/document-export/to_pdf.py <input.html> reports/<YYYY-MM-DD>-<slug>.pdfIt tries headless Chrome first, then weasyprint, then wkhtmltopdf. If it reports that no engine is found, relay its install hint to the user; do not try to work around it.
Excel (.xlsx)
Build a JSON spec, write it to a temporary file, and run the writer.
Spec shape:
{
"sheets": [
{
"name": "Results",
"header": true,
"rows": [["Name", "Score"], ["Alice", 90], ["Bob", 85]],
"widths": [24, 10]
}
]
}header: truebolds the first row.widths(column widths in characters) is optional. Multiple sheets are allowed.- Cell values may be strings, numbers, booleans, or
null(an empty cell). Keep numbers as numbers in the JSON so Excel treats them as numeric.
Run it:
python3 .claude/skills/document-export/to_xlsx.py /tmp/export-spec.json reports/<YYYY-MM-DD>-<slug>.xlsxYou can also pipe the spec on stdin by passing - instead of a file path.
Word (.docx)
Build a JSON spec of blocks, then run the writer.
Spec shape:
{
"title": "Optional document title",
"blocks": [
{"type": "heading", "level": 2, "text": "A section"},
{"type": "paragraph", "text": "A plain paragraph."},
{"type": "paragraph", "runs": [
{"text": "mixed ", "bold": true},
{"text": "formatting", "italic": true}
]},
{"type": "bullets", "items": ["first point", "second point"]},
{"type": "numbered", "items": ["step one", "step two"]},
{"type": "table", "header": true, "rows": [["Col A", "Col B"], ["1", "2"]]}
]
}headinglevels are 1 to 3. Aparagraphcarries plaintext(with optionalbold/italicfor the whole paragraph) or a list ofrunsfor mixed formatting.tablerows are lists of cell strings;header: truebolds the first row.
Run it:
python3 .claude/skills/document-export/to_docx.py /tmp/export-spec.json reports/<YYYY-MM-DD>-<slug>.docxAfter exporting
- Delete any temporary spec file you created.
- Give the user the exact path of the file.
- If the user wants to share the file, that is an outward action: hand it over, do not send it anywhere yourself.
Scope
These writers cover the structure that carries content: values, headings,
formatting, lists, simple tables, column widths. They do not do Excel formulas,
charts, or merged cells, or Word images, footnotes, or page headers. If a
request needs those, say so and either extend the script or, if the user has the
openpyxl or python-docx library available, write a one-off script with it
instead.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

