TL;DR

I built a command-line tool that transforms a job description and CV into a personalized, production-ready cover letter and PDF in seconds. Using Google’s Gemini API and structured outputs, the tool eliminates hours of manual writing while preserving creative control.

Table of Contents

The Problem

Job hunting involves a catch-22: personalized cover letters significantly improve chances, but writing dozens of tailored versions is tedious, repetitive, and drains the creative energy needed for the best applications. I found myself copying paragraphs, reworking the same bullet points, and spending 30-45 minutes per application just on formatting and content adaptation.

The real opportunity wasn’t in automating away the writing—it was in automating the repetitive scaffolding so I could invest energy where it actually matters: storytelling, authenticity, and strategic positioning.

The Solution

Cover Letter Maker CLI is a fast, intelligent automation tool that:

  • Accepts a job description and CV as inputs (plain text, PDF, or saved files)
  • Extracts and analyzes relevant experience against job requirements
  • Generates a coherent, personalized cover letter using AI
  • Applies professional formatting and exports a production-ready PDF
  • Preserves full control through custom instructions and manual editing

The entire pipeline runs in under 10 seconds, and the output is immediately reviewable and editable.

Demo GIF of Cover Letter Maker

Architecture & Technology Stack

Core Technologies

Language Model & AI

  • Google Gemini Flash (gemini-flash-latest): Fast, cost-effective LLM for real-time cover letter generation with structured outputs
  • LangChain: Prompt orchestration and chain management for reliable LLM interactions
  • Pydantic v2: Type-safe structured outputs ensuring consistent, validated JSON responses from the LLM

Document Processing

  • Docling: Industrial-grade PDF text extraction that preserves layout semantics
  • Python’s pathlib: Cross-platform file handling

Formatting & Export

  • LaTeX with pdflatex: Professional typesetting for pixel-perfect PDF generation
  • Jinja-style templating: Dynamic content injection into LaTeX templates with safe character escaping

CLI & User Experience

  • Rich: Beautiful terminal UI with tables, panels, progress indicators, and markdown rendering
  • Python’s built-in input(): Simple, non-blocking user interaction

Project Management

  • UV: Ultra-fast Python package manager for dependency management

How the Pipeline Works

Step 1: Input Collection

The CLI provides three flexible input methods:

  • Paste directly: Input CV or job description via terminal
  • Upload PDF: Extract text from PDFs automatically
  • Use saved data: Leverage previously saved CV or custom instructions for faster iterations

Step 2: LLM Processing with Structured Output

The AI processes three key inputs simultaneously:

  • Your complete CV (experience, skills, achievements)
  • The job listing (requirements, responsibilities, company details)
  • Your custom instructions (preferred tone, focus areas, length preferences)

The system then identifies which parts of your background best match what the employer is seeking, and crafts a narrative that connects the dots. The AI is engineered to use only standard, clean formatting—no special characters that could cause rendering issues later.

Step 3: Data Structure & Validation

The system organizes the generated content into clear, validated sections:

  • Your details: Name, email, phone, address, LinkedIn, GitHub, current role
  • Company info: Company name, position title, hiring manager, job source
  • Letter content: Professional opening, two compelling middle paragraphs, strong closing with call-to-action

Step 4: Professional Formatting & PDF Generation

The content is merged into a professional template that handles:

  • Custom header with your contact information and links
  • Styled formatting with company details and recipient name
  • Multi-paragraph body with proper spacing and typography
  • Professional typeface and color accents for visual polish

The entire document is then compiled into a polished, ready-to-send PDF that looks equally impressive whether viewed on screen or printed.

Step 5: Export & Review

The final PDF is saved and ready to send. Users can:

  • Review inline in the CLI using the preview function
  • Edit the LaTeX source directly
  • Re-export with modifications
  • Save to any location

Key Technical Decisions

Why Structured Outputs?

Traditional LLM pipelines parse raw text and hope for valid JSON. Using LangChain’s .with_structured_output() with Pydantic models:

  • ✅ Eliminates parsing errors
  • ✅ Guarantees schema compliance
  • ✅ Reduces prompt verbosity (no “respond in JSON format” needed)
  • ✅ Enables type safety in Python

Why LaTeX over Markdown/HTML?

  • Professional typography and spacing out of the box
  • No dependency on external rendering services
  • Offline-first (no internet required for compilation)
  • Pixel-perfect consistency across devices
  • Custom header/footer with precise control

Why Gemini Flash?

  • Speed: Generates cover letters in 2-3 seconds
  • Cost: Significantly cheaper than GPT-4 while maintaining quality
  • Structured output support: Native support for JSON schema validation
  • Reliability: Consistent, high-quality output for structured data

Why Docling for PDF Extraction?

  • Handles complex PDFs with mixed layouts
  • Preserves semantic structure (headings, lists, tables)
  • Better accuracy than simpler PDF parsers
  • Production-grade reliability

Why This Approach

Removes cognitive overhead: Instead of wrestling with formatting and structure, you focus on what matters—your narrative.

Enables rapid experimentation: Modify custom instructions and regenerate in seconds. Try bolder approaches without penalty.

Preserves authenticity: The tool is a starting point, not an end. Edit, personalize, and inject your voice before sending.

Scalable workflow: Whether applying to 5 roles or 50, the time per application stays constant at under 10 minutes of actual work.

Future Enhancements

  • Multi-language support: Generate cover letters in French, Spanish, Arabic, etc.
  • Typst migration: Replace LaTeX with Typst for even faster compilation (milliseconds) and Markdown-friendly syntax
  • Template customization: User-provided LaTeX templates for different industries/styles
  • Analytics dashboard: Track which keywords/achievements appear most in generated letters
  • Voice mode: Dictate CV updates or custom instructions via voice input
  • Iterative refinement: A/B test different cover letter versions and gather feedback data

Repository & Getting Started

Repository: https://github.com/yassinekader/cover_letter_maker_cli

Quick Start

# Clone and install
git clone https://github.com/yassinekader/cover_letter_maker_cli.git
cd cover_letter_maker_cli
uv pip install -r requirements.txt

# Set your API key
export GOOGLE_API_KEY="your_key_here"

# Run
uv run python cli_tool.py

Workflow

  1. Input your CV (paste, upload PDF, or use saved)
  2. Input a job description
  3. (Optional) Add custom instructions for tone/focus
  4. Generate cover letter in ~3 seconds
  5. Preview, export to PDF, or edit and regenerate

Final thought: This project isn’t about replacing human judgment—it’s about eliminating friction so you have more energy for the parts that matter. Automation works best when it handles the boring stuff and leaves creativity to you.