moonlight-lupin/agent-skills

document-converter

Convert between document formats: Markdown↔HTML, CSV↔JSON, YAML↔TOML, JSON↔YAML, CSV↔Markdown table, HTML→plain text, JSON→CSV (flattening nested objects), Excel→CSV, Markdown→PDF.

View source
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Document Converter

Overview

Use this skill when you need to convert common document and data formats while preserving as much structure as the source format allows. The bundled CLI covers lightweight, local conversions between Markdown, HTML, CSV, JSON, YAML, TOML, plain text, Excel, and PDF output.

The core conversions use the Python standard library: JSON, CSV, HTML parsing, Markdown heuristics, TOML reading via tomllib, and custom TOML/YAML writers. PDF output uses pandoc and Excel reading uses openpyxl — both are required dependencies for those conversion paths. If a dependency is missing, the tool exits with a clear installation hint instead of failing with a traceback.

Conversion matrix

FromToCommand shapeDependencyNotes
MarkdownHTML--from markdown --to htmlstdlibHeaders, paragraphs, lists, fenced code, bold/italic/code, links.
HTMLMarkdown--from html --to markdownstdlibCommon block/inline tags; complex CSS/layout is discarded.
HTMLtext--from html --to textstdlibStrips tags, decodes entities, preserves paragraph/list breaks.
CSVJSON--from csv --to jsonstdlibHeader row becomes object keys; values remain strings.
JSONCSV--from json --to csvstdlibFlattens nested objects with dot notation; arrays are JSON strings.
CSVMarkdown--from csv --to markdownstdlibProduces a GitHub-style pipe table.
MarkdownCSV--from markdown --to csvstdlibReads the first pipe table.
YAMLJSON--from yaml --to jsonstdlib fallback; PyYAML optionalBasic YAML only without PyYAML.
JSONYAML--from json --to yamlstdlib2-space YAML, no anchors.
YAMLTOML--from yaml --to tomlstdlib fallback; PyYAML optionalSingle YAML document; TOML-compatible values only.
TOMLYAML--from toml --to yamlstdlibTOML tables become nested YAML mappings.
TOMLJSON--from toml --to jsonPython 3.11+ tomllibTOML dates/times become strings for JSON.
JSONTOML--from json --to tomlstdlibStrings, numbers, bools, arrays, and nested tables.
XLSXCSV--from xlsx --to csvopenpyxlReads the first worksheet only.
MarkdownPDF--from markdown --to pdfpandocWrite-only PDF target; requires --output.

See references/conversion-matrix.md for limitations and data-loss risks per conversion.

Quick start

Run from the skill directory or call the script by path:

bash
python scripts/convert.py --input notes.md --from markdown --to html --output notes.html

Format auto-detection uses the input file extension when --from is omitted:

bash
python scripts/convert.py --input notes.md --to html --output notes.html

Examples for each supported conversion:

bash
# Markdown ↔ HTML
python scripts/convert.py --input page.md --to html --output page.html
python scripts/convert.py --input page.html --to markdown --output page.md

# HTML → plain text
python scripts/convert.py --input page.html --to text --output page.txt

# CSV ↔ JSON
python scripts/convert.py --input people.csv --to json --output people.json
python scripts/convert.py --input records.json --to csv --output records.csv

# CSV ↔ Markdown table
python scripts/convert.py --input people.csv --to markdown --output people-table.md
python scripts/convert.py --input people-table.md --to csv --output people.csv

# JSON ↔ YAML
python scripts/convert.py --input config.json --to yaml --output config.yaml
python scripts/convert.py --input config.yaml --to json --output config.json

# YAML ↔ TOML
python scripts/convert.py --input config.yaml --to toml --output config.toml
python scripts/convert.py --input config.toml --to yaml --output config.yaml

# JSON ↔ TOML
python scripts/convert.py --input config.json --to toml --output config.toml
python scripts/convert.py --input config.toml --to json --output config.json

# Excel → CSV, first sheet only; requires openpyxl
python scripts/convert.py --input workbook.xlsx --to csv --output sheet.csv

# Markdown → PDF; requires pandoc
python scripts/convert.py --input report.md --to pdf --output report.pdf

If --output is omitted for text formats, the converted content is written to stdout.

Edge case handling

  • Nested JSON→CSV flattening: nested objects are flattened with dot notation, e.g. {"user": {"name": "Ada"}} becomes a user.name column. Lists and non-scalar nested values are serialized as compact JSON strings because CSV has no native nesting.
  • CSV type loss: CSV values are strings. A CSV→JSON→CSV roundtrip does not recover original numbers, booleans, or dates unless the source encoded them explicitly and a downstream process re-types them.
  • HTML entity decoding: HTML→Markdown and HTML→text decode entities such as &,  , and numeric entities. Whitespace is normalized; exact browser layout is not preserved.
  • YAML support: PyYAML is used if installed. Without it, a minimal parser handles common block-style mappings, lists, nested dicts, strings, numbers, booleans, and nulls. Complex YAML features are not supported in fallback mode: anchors, aliases, tags, flow style, merge keys, and multi-document streams.
  • YAML multi-document: the converter treats YAML input as a single document. Split multi-document YAML into separate files before conversion.
  • TOML type limitations: TOML output supports basic scalar values, arrays of scalar values, and nested tables. Mixed arrays, arrays of tables, tagged values, and arbitrary objects are rejected with a clear message.

Dependencies

Most conversions use only the Python standard library. Two conversion paths need external tools:

Pandoc for Markdown→PDF

Markdown→PDF shells out to pandoc. If pandoc is missing, the CLI prints:

text
Markdown to PDF requires pandoc. Install pandoc and ensure it is on PATH.

Install pandoc through your operating system package manager or from <https://pandoc.org/installing.html>. A PDF output path is required because PDF is binary and cannot be written to stdout.

openpyxl for Excel→CSV

Excel reading requires openpyxl:

bash
python -m pip install openpyxl

If it is absent, the CLI prints an installation hint and exits non-zero. The converter reads only the first worksheet; use a spreadsheet tool or a small custom script when you need a named sheet, formulas evaluated by Excel, formatting, or multiple CSV files.

Common pitfalls

  1. Expecting lossless CSV roundtrips. CSV has no schema, nesting, or reliable types. JSON→CSV flattening is practical for inspection/import, not a reversible archival format.
  2. Assuming HTML layout survives. HTML→Markdown/text keeps content structure, not CSS, scripts, tables with spans, or exact browser whitespace.
  3. Using fallback YAML for advanced YAML. Anchors, aliases, tags, flow-style maps/lists, merge keys, and multi-document streams need a real YAML parser and may still lose anchor identity when written back out.
  4. Writing all JSON to TOML. TOML cannot represent every JSON shape. Arrays must be scalar and consistent enough for TOML consumers; objects become tables.
  5. Forgetting dependencies. PDF requires pandoc and Excel requires openpyxl. Install both before relying on automation.
  6. Mixing Markdown prose and tables. Markdown→CSV reads the first pipe table it can find and ignores surrounding prose.

What this skill does not do

  • No OCR. Scanned PDFs and images need an OCR pipeline before text conversion.
  • No PDF extraction. PDF is write-only here via Markdown→PDF. Use a dedicated PDF/OCR skill for extracting text or tables from PDF.
  • No binary Office editing. .docx, styled .xlsx generation, and mail-merge workflows are outside this converter. Use fill-template for filling Word/Excel templates.
  • No preservation of styling-heavy layouts. It is intended for portable text/data transformations, not pixel-perfect publishing.

Verification checklist

  • [ ] Confirm the source and target formats are in the matrix.
  • [ ] Use --output for file output; omit it only when stdout text is acceptable.
  • [ ] Inspect a sample output before batch-converting many files.
  • [ ] For JSON→CSV, check flattened column names and list serialization.
  • [ ] For YAML/TOML, confirm advanced features were not required or silently lost.
  • [ ] For PDF/Excel, verify pandoc and openpyxl are installed before relying on automation.
from this repository

More skills

All skills
moonlight-lupin
Community

claude-plugin-converter

Convert Claude Code plugins into self-contained Hermes plugins — discovery analysis then full conversion

installs
1
GitHub stars
62
Updated
Sep 7
moonlight-lupin
Community

clips-studio

Use when the user wants to "make a video/clip", "generate a video from text", "animate this image/photo", "create a marketing reel / social video / teaser", "do a 3D / parallax move", "pan/zoom/orbit a shot", or mentions fal.ai, Kling, Veo or Seedance for video. Staged fal.ai workflow — brainstorm, draft cheaply, produce the final at quality. Three modes: text-to-video, animate (still to motion), camera-move (push-in/pan/orbit). Not for still images (image-studio), slide decks, or charts. Honesty discipline: never depict real identifiable subjects via text-to-video.

installs
1
GitHub stars
62
Updated
Sep 7
moonlight-lupin
Community

decision-log

ADR-style decision journal for agents and teams. Create numbered decision records, track superseding chains, schedule periodic reviews, and search past decisions to avoid re-litigating settled questions.

installs
1
GitHub stars
62
Updated
Sep 7
moonlight-lupin
Community

deep-research

Autonomous multi-step deep research engine implementing an iterative Think → Search → Extract → Synthesize → Stop loop. The LLM drives every decision: what to search, what's relevant, what's missing, and when to stop. Produces a cited, magazine-quality report with inline citations, category- specific formatting, and research stats. Trigger when the user asks for "deep research", "research report on", "comprehensive analysis of", "look into X in depth", "write a report on X", or any question needing multi-source synthesis beyond a single search. For entity vetting/dossiers use entity-research; for news digests use news-monitoring; for source-grounded Q&A use notebooklm-mode.

installs
1
GitHub stars
62
Updated
Sep 7