Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

feat(cover-letter): add generation prompts

Khuram Niaz10a89cafbeb7
diff --git a/src/lib/ai/index.ts b/src/lib/ai/index.ts
index 80c9ba0..9ffb957 100644
--- a/src/lib/ai/index.ts
+++ b/src/lib/ai/index.ts
@@ -14,6 +14,8 @@ export {
buildJobMatchPrompt,
AUTOMATION_JOB_MATCH_SYSTEM_PROMPT,
buildAutomationJobMatchPrompt,
+ COVER_LETTER_SYSTEM_PROMPT,
+ buildCoverLetterPrompt,
} from "./prompts";
// Analysis tools
diff --git a/src/lib/ai/prompts/cover-letter/index.ts b/src/lib/ai/prompts/cover-letter/index.ts
new file mode 100644
index 0000000..8a0c9f6
--- /dev/null
+++ b/src/lib/ai/prompts/cover-letter/index.ts
@@ -0,0 +1,6 @@
+/**
+ * Cover Letter Prompts - Barrel File
+ */
+
+export { COVER_LETTER_SYSTEM_PROMPT } from "./system";
+export { buildCoverLetterPrompt } from "./user";
diff --git a/src/lib/ai/prompts/cover-letter/system.ts b/src/lib/ai/prompts/cover-letter/system.ts
new file mode 100644
index 0000000..6a5c1d5
--- /dev/null
+++ b/src/lib/ai/prompts/cover-letter/system.ts
@@ -0,0 +1,34 @@
+/**
+ * Cover Letter System Prompt
+ * Free-form markdown letter. Deliberately no scores line and no JSON —
+ * the whole response is the letter body.
+ */
+
+export const COVER_LETTER_SYSTEM_PROMPT = `You are an experienced career writer producing a tailored cover letter for a specific job application.
+
+## RULES
+- Write in the candidate's voice, first person, present tense where natural.
+- Ground every claim in the resume. Never invent employers, titles, dates, degrees, certifications, or metrics that are not in the resume.
+- Address the job's actual stated requirements, not generic enthusiasm.
+- 250-400 words total. Three to five short paragraphs.
+- Confident and specific. No filler ("I am writing to apply for..."), no flattery of the company, no restating the whole resume.
+- If a key requirement is unmet, do not apologise for it or draw attention to it. Lead with the strongest genuine evidence instead.
+- Use "Hiring Manager" as the salutation unless the job description names a specific person.
+
+## OUTPUT FORMAT (FOLLOW EXACTLY)
+Output ONLY the letter, in GitHub-flavored Markdown. Start directly with the salutation line. Structure:
+
+Dear Hiring Manager,
+
+<opening: the role, and the single strongest reason this candidate fits>
+
+<body paragraph 1: concrete evidence from the resume mapped to a stated requirement>
+
+<body paragraph 2: a second requirement, or relevant domain/team experience>
+
+<closing: brief forward-looking sentence and a thank you>
+
+Sincerely,
+<candidate name from the resume, or "Kind regards," with no name if the resume has none>
+
+Do NOT output JSON. Do NOT wrap the response in code fences. Do NOT add commentary, notes, or a preamble before or after the letter. Do NOT include placeholder brackets like [Company] — use real values from the inputs or omit the sentence.`;
diff --git a/src/lib/ai/prompts/cover-letter/user.ts b/src/lib/ai/prompts/cover-letter/user.ts
new file mode 100644
index 0000000..c7d7fe2
--- /dev/null
+++ b/src/lib/ai/prompts/cover-letter/user.ts
@@ -0,0 +1,23 @@
+/**
+ * Cover Letter User Prompts
+ */
+
+export function buildCoverLetterPrompt(
+ resumeText: string,
+ jobText: string,
+ guidance: string | null,
+): string {
+ const guidanceBlock = guidance
+ ? `\n\nPRIOR MATCH ANALYSIS (emphasise these keywords and act on these tips):\n${guidance}`
+ : "";
+
+ return `Write a cover letter for this candidate applying to this job.
+
+RESUME:
+${resumeText}
+
+JOB DESCRIPTION:
+${jobText}${guidanceBlock}
+
+Output only the letter, starting with the salutation.`;
+}
diff --git a/src/lib/ai/prompts/index.ts b/src/lib/ai/prompts/index.ts
index f9cb967..72cf2e3 100644
--- a/src/lib/ai/prompts/index.ts
+++ b/src/lib/ai/prompts/index.ts
@@ -30,3 +30,9 @@ export {
RESUME_IMPORT_SYSTEM_PROMPT,
buildResumeImportPrompt,
} from "./resume-import";
+
+// Cover Letter exports
+export {
+ COVER_LETTER_SYSTEM_PROMPT,
+ buildCoverLetterPrompt,
+} from "./cover-letter";