We shipped a CV checker last weekend. It has two halves: a free scan that runs on upload, and a paid review that costs a fraction of a cent in model tokens. This post is about the free half, which is the more interesting one, because it contains no model call at all.
The split came from one observation. Language models are unreliable at counting. Ask one how many of your bullet points contain a number and it will give you a confident figure that is wrong often enough to matter, on a page where the figure is the whole point of the advice. Code counts perfectly and cannot judge whether an achievement is impressive. So each half gets what it is good at.
The module header states it plainly:
/**
* The free CV scan: plain rules, no model.
*
* Everything here is something a script measures better than a language model
* does. Models are unreliable at counting, so page length, repeated words, how
* many bullet points carry a number and which date styles appear are all left to
* code, and the paid review in ./review.ts is told these results so it spends
* its words on what only a reader can judge.
*/
672 lines, pure and synchronous, 15 checks:
export const CV_CHECK_IDS = [
'length', 'readable', 'contact', 'linkedin', 'sections', 'openers',
'duty-phrases', 'numbers', 'bullet-length', 'dense-text', 'dates',
'spelling', 'buzzwords', 'first-person', 'references',
] as const;
The score starts at 100 and loses points per failed check, by severity:
const PENALTY: Record<CvSeverity, number> = { high: 15, medium: 7, low: 2 };
The public page reads the same object the scanner does
A marketing page that lists features is a page that drifts away from the software. So the list of checks on /cv-checker is not written in the page file. It comes from a record keyed by the same union:
export const CV_CHECK_META: Record<CvCheckId, { name: string; about: string }> = {
length: {
name: 'Length',
about: 'Page count, or word count for a Word file, against what recruiters expect.',
},
// 14 more
};
Record<CvCheckId, ...> means adding an id to the union without writing its public description is a type error, and removing a check removes it from the page. The page maps over CV_CHECK_IDS to render them, so the order matches too, and the comparison line on the page reads All ${CV_CHECK_IDS.length} checks, scored out of 100. There is no 15 typed anywhere in the copy.
The type comes from the bytes
An upload gives you three things that claim to say what the file is: the extension, the browser's MIME guess, and the bytes. Only the last one is evidence.
export function sniffCvFile(bytes: Uint8Array): CvFileKind | null {
if (bytes[0] === 0x25 && bytes[1] === 0x50 && bytes[2] === 0x44 && bytes[3] === 0x46) return 'pdf';
if (bytes[0] === 0x50 && bytes[1] === 0x4b && bytes[2] === 0x03 && bytes[3] === 0x04) return 'docx';
return null;
}
%PDF, and PK\x03\x04 because a .docx is a zip. A CV saved as cv.pdf that is really a Word file gets routed correctly, and a renamed executable gets null and a 422.
The cap is 4 MB, which is not a round number chosen for looks:
/** Largest file the scan accepts. Under Vercel's 4.5 MB request body cap. */
export const CV_MAX_FILE_BYTES = 4 * 1024 * 1024;
A file over the platform's body limit never reaches your handler, so the error message is not yours either. Rejecting below the limit means the user gets "That file is over 4 MB. Export the CV again without images." instead of a platform 413.
Reading order, not reading position
PDF text does not arrive as lines. It arrives as runs with coordinates, and the obvious move is to sort them by position to rebuild the page. Do that to a two-column CV and you get every left-column line welded to the right-column line beside it.
/**
* PDF text comes as positioned runs. A run ends a line when the PDF says so, or
* when the next run sits on a different baseline. Content-stream order is kept
* rather than sorting by position, because sorting merges the two columns of a
* two-column CV into one garbled line.
*/
So the loop walks the stream in order, breaks a line when the y moves by more than half the font size, and inserts a space when the gap between the end of one run and the start of the next is over 15 per cent of the font size. Two signals from the font metrics, no layout engine.
Then there is the heading problem. Design templates letter-space headings, and a letter-spaced heading arrives as a run per letter:
/** Four or more single letters with single spaces between them. */
const SPACED_LETTERS = /(?<![\p{L}\p{N}])\p{L}(?: \p{L}){3,}(?![\p{L}\p{N}])/gu;
"E X P E R I E N C E" becomes "EXPERIENCE", and the four-letter minimum is there so a line of grades reading "A A B" survives untouched.
Three sources mark a bullet three different ways
Every source is reduced to lines before any check runs, and the only normalisation that matters is bullets, because nothing agrees on what one is:
/**
* Bullet points are normalised to a leading "• " because the three sources mark
* them differently: a PDF keeps whatever glyph the font drew (often a
* private-use Symbol or Wingdings code point), Word stores list items as
* numbering with no glyph in the text at all, and pasted text uses whatever the
* candidate typed.
*/
The prefix pattern covers 24 glyphs plus a private-use range, which is where Symbol and Wingdings bullets land, and then there is this, which is the kind of rule you only write after looking at real files:
/** Word's second-level bullet is a plain "o", which only counts before a capital. */
const LETTER_O_BULLET = /^o\s+(?=[A-Z])/;
When a CV has no bullets at all
Five of the 15 checks read bullet points. Some CVs have none: they write one achievement per line, or the export lost the glyphs. Rather than passing those checks vacuously, the scanner substitutes:
function unitsOf(doc: CvDocument): { units: string[]; asLines: boolean } {
const bullets = doc.lines.filter(isBullet);
if (bullets.length >= 3) return { units: bullets, asLines: false };
// A line of two or more sentences is a paragraph, such as a personal
// statement, not a point; the dense-text check is the one that reads those.
const sentences = doc.lines
.slice(4)
.filter((line) => countWords(line) >= 6 && !/[.!?]\s+\p{Lu}/u.test(line));
return { units: sentences, asLines: true };
}
The first four lines are skipped as the header block, multi-sentence lines are left to the prose check, and the returned flag decides which noun the advice uses, so a CV with no bullets reads "4 lines start with Managed" rather than "4 bullets".
Every unit-based check also refuses to speak when there is too little to measure. checkOpeners passes outright below four units, checkNumbers below five. A scan that says "only 0 of 2 bullets include a number" is technically true and useless.
One more detail I like: the repeated-openers check skips anything the duty-phrase check will catch.
// Duty phrases have their own check; counting them here would report the
// same bullets twice, once as "Responsible for" and once as "Responsible".
if (DUTY_PHRASE.test(bulletText(unit))) continue;
Two checks firing on the same line is how an automated report starts to feel like nagging.
Nothing is stored
The scan route has no database import. It reads the file into memory, extracts lines, runs the checks, returns both, and forgets. Under 80 words of extracted text it stops and tells you why, with a different message depending on where the text came from:
doc.source === 'text'
? 'There is not enough text here to check. Paste the whole CV.'
: 'We could not find much text in that file. It may be a scan or an image. Paste the text instead.'
That second one is the single most common real failure: a CV exported as a picture of a CV, which is also exactly what an employer's screening software sees nothing in.
See it
Open cogniprep.app/cv-checker and look at the "What the scan checks" section. Count the items: 15, each with its name and one line of description, rendered from CV_CHECK_META. Then compare them against the CV_CHECK_IDS array quoted at the top of this post. Same 15, same order, because one is a Record keyed by the other.
The scan itself runs for any signed-in account, free, and the response in your Network tab is the extracted lines plus the 15 results. The 291-line test file for the checks is the thing I would write first next time: every check is a pure function from lines to a result, which makes a scanner the rare piece of product code that is genuinely pleasant to test.
Top comments (0)