Skip to content

About

CV drafting for technical people: your résumé corpus + a job description in, a tailored one-page PDF out. LLM proposes, code verifies — nothing lands on the CV that isn't in your corpus.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CvDraftingForTech

A CV drafting tool for technical people.

You give it a structured résumé corpus (JSON — your full career history) and a job description. An LLM proposes a slim "résumé diff" — a rewritten summary, tailored experience bullets, reordered skills, and a priority-ordered project selection. A Jinja + WeasyPrint renderer splices that diff over your corpus and enforces a one-A4-page budget: it trims the lowest-priority projects, then trims experience bullets, and if the CV is still over one page after that it ships anyway with an explicit warning rather than silently. Nothing the LLM outputs can be invented — every fact must already exist in your corpus.

Features

  • Anti-fabrication by design. The prompt's first rule is that every fact, number, and skill in the output must already exist in your corpus. Nothing is guessed, rounded up, or "improved."
  • One-page budget, enforced. The renderer measures the actual laid-out document (not a word-count heuristic). If it runs long, it drops the lowest-priority project — never truncates text mid-sentence — down to a floor of two projects, then trims experience bullets. If the CV is still over one page after both trims, it is written anyway (so you have something to hand-trim) and the overrun is reported as an explicit warning in the output, never just a log line.
  • Production-and-return-first project selection. The drafting prompt is opinionated: it prefers projects that shipped or produced a demonstrable return (revenue, a measured reduction, stakeholder sign-off, live users, a public release) over unfinished personal tooling, and frames each selected project's description around that return when your corpus records one.
  • Educational framing for niche domains. If a project's subject matter is unlikely to be familiar to a reviewer, the prompt asks the model to make it legible in one clause before pivoting to what it demonstrates technically.
  • Cross-domain competence mapping. Project selection aims to jointly cover the competences a job asks for, rather than picking three projects that all restate the same skill.
  • Provider-agnostic. Works with OpenAI, Anthropic, Google, Groq, Mistral, Cohere, or any OpenAI-compatible endpoint (including Ollama Cloud) via pydantic-ai.
  • CLI or server. Draft one CV from the command line with no server running, or run a small FastAPI service and POST /draft.

Quick Start

git clone https://github.com/<org>/CvDraftingForTech.git
cd CvDraftingForTech
./setup.sh          # macOS/Linux — or setup.ps1 on Windows

Then draft a CV from the sample job and corpus:

python -m cvdraft.cli examples/sample_job.json -o out/cv.pdf --corpus examples/corpus.example.json

See CLAUDE.md for the full command reference and architecture.

Prerequisites

  • Python 3.11+
  • An API key for at least one supported LLM provider
  • WeasyPrint's native GTK/Pango libraries — see WeasyPrint caveat below

Configuration

cp .env.example .env

Then fill in your provider and key. All configuration is via environment variables, loaded from .env by python-dotenv:

Variable Required Default Description
LLM_PROVIDER no openai One of openai, anthropic, google, groq, mistral, cohere, openai_compatible
LLM_OUTPUT_MODE no native native for providers with structured-output support; prompted otherwise (e.g. Ollama)
AI_MODEL yes — Model name/ID for your provider
DRAFT_AI_MODEL no (uses AI_MODEL) Optional model override for the draft call only
LLM_API_BASE only for openai_compatible — Base URL of the OpenAI-compatible endpoint (Ollama Cloud, local Ollama, vLLM, etc.)
LLM_API_KEY yes — API key for the selected provider
APP_PORT no 8077 Port for the FastAPI server
CORPUS_PATH no ./data/corpus.json Path to your résumé corpus JSON (gitignored — write your own)
CVDRAFT_API_KEY no unset (no auth) If set, POST /draft requires a matching X-API-Key header — requests without it get 401. See Security below.
CVDRAFT_RATE_LIMIT_PER_MINUTE no 10 Max /draft requests per minute per client IP, tracked in memory. 0 disables the limit. Exceeding it returns 429.

Corpus format

Your résumé corpus is a single JSON file. See examples/corpus.example.json for the full shape with placeholder values:

{
  "structured_data": {
    "summary": "...",
    "experiences": [{ "title": "...", "company": "...", "location": "...", "start_date": "...", "end_date": "...", "bullets": ["..."] }],
    "skills": ["Python", "FastAPI", "SQL"],
    "projects": [{ "name": "...", "description": "...", "link": "...", "tech": { "languages": [], "frameworks": [], "has_docker": false, "has_ci": false, "has_tests": true, "metrics": ["..."] } }],
    "education": [{ "degree": "...", "institution": "...", "location": "...", "start_date": "...", "end_date": "..." }],
    "languages": [{ "name": "English", "level": "C2" }]
  },
  "contact": {
    "full_name": "...", "email": "...", "phone": "...", "location": "...",
    "linkedin_url": "...", "github_url": "...", "website": "..."
  },
  "work_authorization": "...",
  "needs_visa_sponsorship": false
}

Record a return per project. The drafting prompt leads each selected project's description with its recorded outcome when your corpus has one — so put a concrete return in each project's tech.metrics: a metric, a measured reduction, a stakeholder sign-off, or a production/live status. A project with no recorded return still gets selected on technical merit, but won't read as strong on paper.

Point the tool at your real corpus with --corpus path/to/corpus.json (CLI) or the CORPUS_PATH env var (server). Corpus files are gitignored by default — this repo ships only a placeholder example.

Development

# CLI — draft and render a CV, no server needed
python -m cvdraft.cli examples/sample_job.json -o out/cv.pdf --corpus examples/corpus.example.json

# Server
python -m uvicorn cvdraft.app:app --host 127.0.0.1 --port 8077

# Smoke-test the running server (stdlib only, no extra deps)
python examples/try_server.py

# Tests
pytest

Server endpoints:

Endpoint Method Description
/ GET Tiny JSON usage hint — no webapp is served
/health GET {status, corpus_loaded, model}
/draft POST Request {job_title, company, location, description} → response {tailored_resume, tailoring_notes, cv_pdf_base64}

Security

This server has no authentication by default. python -m uvicorn cvdraft.app:app binds to 127.0.0.1 (localhost only) unless you change --host yourself — leave it that way unless you know what you're exposing. /draft returns your full tailored résumé data and spends your LLM provider's credits on every call, so an unauthenticated, internet-reachable instance is both a data leak and a billing hole.

If you do need to expose this beyond your own machine:

  • Set CVDRAFT_API_KEY and send it back as the X-API-Key header on every /draft request — requests without a matching header get 401. This is opt-in single-key auth for personal/small-scale use, not a full auth system; unset (the default), /draft is open to anyone who can reach it.
  • Set CVDRAFT_RATE_LIMIT_PER_MINUTE (default 10, 0 disables it) to cap /draft calls per client IP and blunt runaway LLM spend; it's an in-memory best-effort limiter, not a substitute for a real reverse-proxy rate limiter in a multi-instance deployment.
  • For anything beyond personal use, put real authentication (and TLS) in front of this service — a reverse proxy, an API gateway, or your own auth middleware — rather than relying on CVDRAFT_API_KEY alone.
  • If LLM_API_KEY isn't set on the server, /draft returns 503 rather than failing confusingly mid-request — see .env.example.

The one-page budget

cvdraft/render_cv.py measures the actual rendered document rather than predicting its length, and enforces — but cannot always guarantee — one A4 page:

  1. Render the tailored CV: Jinja → HTML → WeasyPrint.
  2. Count pages from the laid-out HTML(...).render().pages object — not write_pdf() — so the page count and the PDF bytes come from the same render and can never disagree.
  3. If it's more than one page, drop the lowest-priority selected project (the last one in the model's project_names order) and re-render — down to a floor of two projects.
  4. Still over budget at that floor, trim experience bullets and re-render.
  5. If it's still over budget after both trims, the PDF is written anyway (a human needs it to trim further) rather than withheld, and the overrun is surfaced as an explicit warning — a tailoring_notes entry in the API response, and a printed note from the CLI — never just a log line. Shortening text does not recover a page; cutting a whole block does.

In short: this is a one-page budget with enforced trimming and explicit overflow warnings, not an unconditional guarantee — a résumé with enough content can still legitimately need a human to cut further.

WeasyPrint caveat (read this on Windows)

WeasyPrint's Python package alone is not enough — it needs the native GTK runtime (Pango, cairo, gdk-pixbuf, etc.) present as DLLs on PATH. This is the most common "why won't this install/run" failure for this stack.

  • Windows: install the GTK3 runtime for Windows separately from pip install weasyprint (MSYS2, or the standalone gtk3-runtime installer).
  • Linux: apt install libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev (package names vary by distro).
  • macOS: brew install pango.

If these native libraries are missing, tests/test_pipeline_integration.py (the one module that exercises real WeasyPrint) skips itself at import time rather than failing the suite.

Using with Claude Code

This project includes a CLAUDE.md that gives Claude Code full context on the codebase, commands, and architecture.

claude    # Start Claude Code — reads CLAUDE.md automatically

What this doesn't do

CV drafting only — no cover letters, no screening-question answers. That is a deliberately different product and out of scope here.

Known limitations

  • Job descriptions are truncated before the LLM sees them. Only the first 4,000 characters (JOB_DESCRIPTION_MAX_CHARS in cvdraft/config.py) of the job description are sent to the model. A longer posting is tailored against its opening, not its full text — trim/summarize very long postings yourself if the tail matters.
  • Anti-fabrication is enforced two different ways. For experiences, projects, and skills, the renderer only ever splices in material that already exists in your corpus (resume_diff.py looks entries up by name and drops anything that doesn't match) — this is mechanical, not the model's discretion. The rewritten summary, however, is free text the model generates directly; it isn't matched against the corpus in code, so it relies on the prompt's anti-fabrication instruction rather than a code guarantee. Review the summary line before sending a CV out.

License

MIT — see LICENSE

Contributing

See CONTRIBUTING.md

About

CV drafting for technical people: your résumé corpus + a job description in, a tailored one-page PDF out. LLM proposes, code verifies — nothing lands on the CV that isn't in your corpus.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages