The skill metadata had drifted: every SKILL.md name field lacked the mpi- prefix, contradicting the directory names and the Agent Skills specification. Descriptions were also missing negative triggers, making it easy for the agent to load the wrong skill. Rewrote the pdf-to-docx skill to follow progressive disclosure: the main SKILL.md dropped from 318 lines to 80, with detailed code examples moved to on-demand references. Added uv run instructions and /// script PEP 723 metadata so dependencies are declared inline and installed automatically. Fixed the pptx skill's script paths and added CLI usage messages to both pptx scripts and the normalize script. Removed the empty self-review directory that was superseded by the unified translation-review skill.
43 lines
1.5 KiB
Markdown
43 lines
1.5 KiB
Markdown
# PDF Inspection Guide
|
||
|
||
Before converting a PDF, dump its text spans to understand fonts, sizes, bullets, and structure.
|
||
|
||
## Dump spans
|
||
|
||
```bash
|
||
python3 << 'PY'
|
||
import pymupdf
|
||
doc = pymupdf.open("input.pdf")
|
||
for pi in range(len(doc)):
|
||
page = doc[pi]
|
||
blocks = page.get_text("dict")["blocks"]
|
||
for block in blocks:
|
||
if block["type"] != 0: continue
|
||
for line in block["lines"]:
|
||
for span in line["spans"]:
|
||
bbox = span["bbox"]
|
||
flags = span["flags"]
|
||
attrs = []
|
||
if flags & 2**1: attrs.append("I")
|
||
if flags & 2**4: attrs.append("B")
|
||
print(f" Y={bbox[1]:.0f} [{span['size']:.1f}pt {'+'.join(attrs) or '-'}] {span['font']} | {span['text']}")
|
||
PY
|
||
```
|
||
|
||
## What to identify
|
||
|
||
- **Fonts used** — map PDF font names to DOCX font names.
|
||
- **Bullet mechanism** — Wingdings glyphs, Unicode bullets, or something else.
|
||
- **Header hierarchy** — which font size marks section vs. sub-section headers.
|
||
- **Numbered lists** — delimiter style: `1)`, `1.`, `1)`, `一、`.
|
||
- **Images** — check `page.get_images()` on each page.
|
||
- **Special sections** — tables, verses, attribution lines, page numbers, forms.
|
||
|
||
## Page numbers
|
||
|
||
Page-number fonts are usually small and repeated on every page. Add them to `skip_fonts` in the config so they do not leak into body text.
|
||
|
||
## Attribution lines
|
||
|
||
Lines like `——节选自...` often use a different font or indentation. The converter breaks paragraphs on these; verify the break point after conversion.
|