Skip to content

Add document-typography skill: typographic quality control for generated documents#514

Open
PGTBoos wants to merge 10 commits intoanthropics:mainfrom
PGTBoos:main
Open

Add document-typography skill: typographic quality control for generated documents#514
PGTBoos wants to merge 10 commits intoanthropics:mainfrom
PGTBoos:main

Conversation

@PGTBoos
Copy link
Copy Markdown

@PGTBoos PGTBoos commented Mar 4, 2026

Prevents common typographic problems in AI-generated documents: orphan word wrap (1-6 words spilling onto the next line), widow paragraphs (section headers stranded at page bottom), and numbering misalignment.

These issues affect every document Claude generates. Users rarely ask for good typography, but they notice when it's bad.

How it works

The skill introduces a render-check-fix cycle: generate the document, convert to PDF, render pages as images, visually inspect, fix and regenerate. It also includes the M-count method — count how many capital M's (the widest character) fit on one line. Any real text will always be narrower, eliminating orphan wrap entirely.

Included scripts

  • measure_m_count.py — Safe character limit per line using font metrics
  • check_orphans.py — Reports lines at risk of orphan wrap
  • check_layout.sh — One-command docx → PDF → page images
  • measure_line_width.py — Visual line-width calibration

Origin

This skill emerged from iterative human-AI collaboration between @PGTBoos and Claude. The user kept pointing out what the AI couldn't see (orphan words, widow paragraphs, layout balance) until the patterns were systematic enough to codify into a reusable skill. The M-count formula was the user's insight. The user actively wants to make LLMs more human-like, and sees this contribution as a help for both AI and humans writing skills.

  • SKILL.md with valid YAML frontmatter
  • Scripts are self-contained
  • Complements existing docx/pptx/pdf skills
  • Tested on real document generation

PGTBoos added 3 commits March 4, 2026 14:53
Added Document Typography skill to ensure typographic quality control for generated documents. Includes guidelines for preventing orphan word wraps, widow paragraphs, and numbering alignment issues, and more
Updated the typographic principles description for clarity.
 typographic quality control for generated documents

# Pull Request: New Skill — document-typography

## Title (for the PR title field):
Add document-typography skill: typographic quality control for generated documents

## Description (copy-paste this into the PR description):

### What this skill does

Prevents common typographic problems in AI-generated documents:
- **Orphan word wrap**: 1-6 words spilling onto the next line
- **Widow paragraphs**: section headers stranded at the bottom of a page with content on the next
- **Numbering misalignment**: numbered lists shifting when going from single to double/triple digits

These issues affect every document Claude generates — Word files, presentations, PDFs, reports, letters, manuals. Users rarely ask for good typography, but they notice when it's bad.

### How it works

The skill introduces a **render-check-fix cycle**:
1. Generate the document
2. Convert to PDF via LibreOffice
3. Render pages as images
4. Visually inspect for layout problems
5. Fix and regenerate

It also includes the **M-count method** — a simple formula to determine a guaranteed safe maximum line length: count how many capital M's (the widest character) fit on one line. Any real text will always be narrower, eliminating the orphan danger zone entirely.

### Included scripts

- `measure_m_count.py` — Calculates safe character limit per line using font metrics (Pillow)
- `check_orphans.py` — Scans text lines and reports which ones are at risk of orphan wrap
- `check_layout.sh` — One-command docx → PDF → page images for visual inspection
- `measure_line_width.py` — Generates a test document for visual line-width calibration

### Why this matters

Every document skill (docx, pptx, pdf) benefits from this. It's the difference between "AI output" and publishable work. The skill is designed to complement the existing document creation skills, not replace them.

### Origin

This skill emerged from iterative human-AI collaboration between [@PGTBoos](https://github.com/PGTBoos) and Claude. The user kept pointing out what the AI couldn't see (orphan words, widow paragraphs, layout balance) until the patterns were systematic enough to codify into a reusable skill. The M-count formula was the user's insight: a simple, elegant solution that eliminates the need for visual inspection of line wrapping.

### Checklist
- [x] SKILL.md with valid YAML frontmatter (name + description)
- [x] Scripts are self-contained
- [x] Works with existing docx/pptx/pdf skills
- [x] Tested on real document generation (213-rule Dutch chess rulebook)
@ccoVeille
Copy link
Copy Markdown

Great skill, thanks.

One remark, I'm unsure "typography" is a good name. It sounds like something that looks for what is commonly called "typos" (spelling issues)

This skill sounds like a "document layout quality checker. Wording is hard. Mt suggestion might have issues too.

But I wanted to raise my concern

PGTBoos added 2 commits March 4, 2026 15:30
Document safe editing strategies to prevent common failure modes during multi-edit tasks.
@PGTBoos
Copy link
Copy Markdown
Author

PGTBoos commented Mar 4, 2026 via email

@Shiven0504
Copy link
Copy Markdown

Nice work overall, especially the origin story - the human-AI iteration loop producing a reusable skill is exactly what this repo is for. This is one of those things where you don't think about it until it's pointed out, and then you can't unsee it. The M-count method is clever as a conservative safe bound.

Also, i've noticed a few things -

  1. The INSTRUCTIES.md file seems to be in Dutch, either translate it to English for the wider audience or note in the README that it's a localized reference. it could get confusing for people browsing the skill files.
  2. The scripts reference hardcoded paths like /path/to/skill/scripts/ in SKILL.md so i suggest it be cleaner to use relative paths from the skill directory so it works regardless of where it's installed.

@PGTBoos
Copy link
Copy Markdown
Author

PGTBoos commented Mar 4, 2026 via email

@Shiven0504
Copy link
Copy Markdown

No rush on the updates by the way, totally understand the credit limits.

Also dont worry about the fork workflow, if you get stuck with the git side of pushing updates just ask I'll be happy to help. Looking forward to the revised version.

@PGTBoos
Copy link
Copy Markdown
Author

PGTBoos commented Mar 5, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants