feat(apply): add mandatory PDF compile-and-inspect step and relevance-weighted cutting

Adds a new Step 5 to the /apply workflow that compiles the CV (lualatex)
and cover letter (xelatex) and visually inspects the resulting PDFs before
presenting them to the user. This catches page-break failures that .tex
review cannot detect: orphaned cventry titles, cover letters spilling to
a second page, and bullet fonts not matching body text.

Also introduces relevance-weighted cutting as the rule for shrinking an
overflowing CV: score each candidate line by (a) relevance to the posting,
(b) uniqueness in the document, and (c) load-bearing role in the cover
letter, then cut the lowest-total-score line first, regardless of section.
This replaces the old static "cut oldest section first" heuristic, which
was wrong whenever a relevant older-role bullet competed with an
irrelevant recent-role bullet.

Bundled with the earlier pending token-efficiency improvements to the
/apply workflow (inline draft passing to the reviewer, scoped reviewer
file reads, single end-of-workflow verification pass).

Changes:
- .claude/commands/apply.md: new Step 5 (Compile & Inspect PDFs), renumber
  old Step 5 to Step 6, update token-efficiency rules at top to reference
  Step 6 for the verification checklist
- .claude/skills/job-application-assistant/05-cv-templates.md: switch
  recommended compile engine from pdflatex to lualatex (pdflatex fails on
  modern MiKTeX with fontawesome5 font-expansion errors), add
  "Compile-and-Inspect Loop" section with needspace/enlargethispage
  patterns, add "Relevance-weighted cutting" section
- .claude/skills/job-application-assistant/06-cover-letter-templates.md:
  add compile command, add "Compile-and-Inspect Loop", document the
  "\lettercontent{} + itemize" pitfall and the required font-matching
  Raleway-Medium wrapper fix
- CLAUDE.md: add "Compiled PDF verification (MANDATORY)" checklist items

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mads Lorentzen
2026-04-24 19:34:46 +02:00
co-authored by Claude Opus 4.7
parent c66d599d75
commit 32e63e5143
4 changed files with 223 additions and 61 deletions
@@ -5,9 +5,52 @@
Cover letters use a custom LaTeX document class (`cover.cls`) with Lato/Raleway fonts.
**Output file:** `cover_letters/cover_<company>_<role>.tex`
**Compile with:** XeLaTeX (not pdflatex)
**Compile with:** XeLaTeX (cover.cls requires fontspec)
**Font directory:** `cover_letters/OpenFonts/fonts/`
### Compile command
```bash
cd cover_letters && xelatex -interaction=nonstopmode cover_<company>_<role>.tex
```
Expected output: `Output written on cover_<company>_<role>.pdf (1 page, ...)`. Any page count other than 1 is a failure that must be fixed before presenting to the user.
## Compile-and-Inspect Loop (MANDATORY)
After writing the cover letter and before presenting to the user, always compile and visually inspect the PDF. Iterate until the layout is clean:
1. Run `xelatex -interaction=nonstopmode cover_<company>_<role>.tex`
2. Confirm page count is exactly 1 and compile succeeded
3. Read the PDF via the Read tool and visually check: signature fits at the bottom, no text cut off, bullet font matches body
### Known template pitfall: itemize inside `\lettercontent{}`
The `\lettercontent{}` macro appends `\\` to its argument. This breaks when the argument ends in `\end{itemize}` because `\\` has no line to break after the environment closes, producing `! LaTeX Error: There's no line here to end.` and no PDF output.
**Wrong (breaks compile):**
```latex
\lettercontent{Here is how my experience maps:
\begin{itemize}
\item ...
\end{itemize}}
```
**Correct — close `\lettercontent{}` before the list and wrap the list in the matching Raleway-Medium font so typography stays consistent:**
```latex
\lettercontent{Here is how my experience maps:}
{\raggedright\fontspec[Path = OpenFonts/fonts/raleway/]{Raleway-Medium}\fontsize{11pt}{13pt}\selectfont
\begin{itemize}
\item ...
\end{itemize}\par}
\vspace{6pt}
\lettercontent{[next paragraph]}
```
The font wrapper is mandatory — if you just move `\begin{itemize}` outside `\lettercontent{}` without the `\fontspec` block, bullets render in the default body font (Lato) and visually mismatch the rest of the letter.
## Document Structure
```latex
@@ -92,7 +135,7 @@ Cover letters use a custom LaTeX document class (`cover.cls`) with Lato/Raleway
- Use `\vspace{.5cm}` between major sections for readability (only if space permits)
### Bullet Lists
- Use `\begin{itemize}...\end{itemize}` inside a `\lettercontent{}` block
- Place `\begin{itemize}...\end{itemize}` **outside** a `\lettercontent{}` block (see "Known template pitfall" above), wrapped in the matching Raleway-Medium `\fontspec` so the bullet font matches the body
- 3-5 bullets is ideal
- Start each bullet with bold label or action verb
- Use `\textbf{Label:}` for category-style bullets