refactor(skills): align MPI skills with Agent Skills best practices
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.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# PDF-to-DOCX Config Patterns
|
||||
|
||||
The converter accepts a config dict that maps PDF-specific patterns to DOCX behavior.
|
||||
|
||||
## Example config
|
||||
|
||||
```python
|
||||
config = {
|
||||
"fonts": {
|
||||
"title": "STHeitiSC-Medium",
|
||||
"body": "HYShuSongErKW",
|
||||
"page_number": "HelveticaNeue",
|
||||
},
|
||||
"header_sizes": {"section": 18, "sub": 15},
|
||||
"body_size": 12,
|
||||
"bullet_fonts": ["Wingdings", "Wingdings 2", "Wingdings 3"],
|
||||
"page_number_font": "HelveticaNeue",
|
||||
"numbered_patterns": [r'^\d+\)', r'^\d+\.'],
|
||||
"skip_fonts": ["HelveticaNeue"],
|
||||
}
|
||||
```
|
||||
|
||||
## Common post-processing patterns
|
||||
|
||||
### Compact numbered lists
|
||||
|
||||
Split items that flowed together in one PDF paragraph:
|
||||
|
||||
```python
|
||||
def split_compact_list(text: str) -> list[str]:
|
||||
parts = re.split(r'(?=\d+\))', text)
|
||||
return [p for p in parts if p.strip()]
|
||||
```
|
||||
|
||||
### Verse / poetry lines
|
||||
|
||||
Split merged verse at semantic phrase boundaries:
|
||||
|
||||
```python
|
||||
def split_verse(text: str, split_markers: list[str]) -> list[str]:
|
||||
pattern = '|'.join(f'(?={m})' for m in split_markers)
|
||||
return [p for p in re.split(pattern, text) if p.strip()]
|
||||
```
|
||||
|
||||
### Chinese process steps
|
||||
|
||||
Split `一、foo 二、bar` into separate items:
|
||||
|
||||
```python
|
||||
def split_chinese_steps(text: str) -> list[str]:
|
||||
parts = re.split(r'(?=[一二三四五六七八九十]、)', text)
|
||||
return [p.strip() for p in parts if p.strip()]
|
||||
```
|
||||
|
||||
## Tuning thresholds
|
||||
|
||||
- **Y-gap threshold** (typically 20–30 pt): controls how aggressively lines are grouped into paragraphs.
|
||||
- **Style-change threshold**: break paragraphs on font change, size jump, or bold toggle when the difference exceeds this value.
|
||||
|
||||
See `references/troubleshooting.md` for threshold adjustment guidance.
|
||||
Reference in New Issue
Block a user