Prompt Engineering
Relevant source files
The following files were used as context for generating this wiki page:Prompt engineering is the core of the AI functionality within the Resume Matcher application. It governs how the system interacts with Large Language Models (LLMs) to perform tasks such as parsing resumes, tailoring content for job descriptions, generating cover letters, and enriching resume details. All backend prompt templates are centralized in the apps/backend/app/prompts/ directory.
The system relies on a set of well-defined prompts that instruct the LLM to return structured JSON data or formatted text. This ensures reliability and consistency across different AI providers like OpenAI, Anthropic, and Ollama.
Core Principles
The project follows a set of guidelines for creating and managing LLM prompts to ensure effectiveness and maintainability.
- Simplicity and Directness: Prompts are kept simple and direct, avoiding complex escaping.
- Variable Substitution: Single braces
{variable}are used for substituting dynamic content into the prompt template. - Structured Output: For tasks requiring structured data, prompts include an example JSON schema to guide the LLM's output format. A key instruction is "Output ONLY the JSON object, no other text."
- Multi-language Support: Prompts that generate user-facing content include an
{output_language}placeholder. This allows the backend to request content in the user's preferred language, such as English, Spanish, Chinese, or Japanese.
Sources: AGENTS.md, apps/backend/app/prompts/templates.py:1-12
The following table summarizes the main prompt templates and their functions.
| Prompt Name | File | Purpose |
|---|---|---|
PARSE_RESUME_PROMPT | templates.py | Parses raw resume text into a structured JSON object. |
EXTRACT_KEYWORDS_PROMPT | templates.py | Extracts key requirements and skills from a job description. |
IMPROVE_RESUME_PROMPT | templates.py | Tailors a resume to a specific job description. |
COVER_LETTER_PROMPT | templates.py | Generates a brief, professional cover letter. |
OUTREACH_MESSAGE_PROMPT | templates.py | Generates a concise cold outreach message for LinkedIn or email. |
ANALYZE_RESUME_PROMPT | enrichment.py | Analyzes a resume to find weak descriptions and generates targeted questions. |
ENHANCE_DESCRIPTION_PROMPT | enrichment.py | Generates new, improved bullet points based on user answers to questions. |
Sources: apps/backend/app/prompts/templates.py, apps/backend/app/prompts/enrichment.py
Resume Parsing and Structuring
The initial step in the workflow is parsing an uploaded resume (PDF or DOCX) into a standardized JSON format. This is handled by the PARSE_RESUME_PROMPT.
PARSE_RESUME_PROMPT
This prompt instructs the LLM to convert unstructured resume text into a JSON object that conforms to the RESUME_SCHEMA_EXAMPLE.
Key Rules and Logic:
- Standard Sections: Maps content to standard sections like
personalInfo,workExperience, etc. - Custom Sections: Non-standard sections (e.g., "Publications") are placed in the
customSectionsobject with a defined type (text,itemList,stringList). - Data Normalization:
- Formats years as "YYYY - YYYY" or "YYYY - Present".
- Converts date abbreviations like "Jan 2020" to "2020".
- Handles "Current" or "Ongoing" as "Present".
- Missing Data: Uses
""for missing text,[]for missing arrays, andnullfor optional fields. - Output Format: Strictly enforces a JSON-only output.
Sources: apps/backend/app/prompts/templates.py:101-125
The diagram below illustrates the resume parsing flow.
This diagram shows the process of converting an uploaded resume file into structured JSON data using the PARSE_RESUME_PROMPT.
Sources: README.md, apps/backend/app/prompts/templates.py:101-125
Resume Tailoring and Improvement
The core feature of Resume Matcher is its ability to tailor a master resume for a specific job application. This process involves two main prompts: EXTRACT_KEYWORDS_PROMPT and IMPROVE_RESUME_PROMPT.
This flow is initiated from the "Tailor Resume" page in the frontend.
Sources: apps/frontend/app/(default)/tailor/page.tsx
1. Keyword Extraction (EXTRACT_KEYWORDS_PROMPT)
Before tailoring the resume, the system first analyzes the job description to extract meaningful data.
Extracted Fields:
required_skillspreferred_skillsexperience_requirementseducation_requirementskey_responsibilitieskeywordsexperience_years(numeric)seniority_level(inferred)
Sources: apps/backend/app/prompts/templates.py:127-148
2. Resume Improvement (IMPROVE_RESUME_PROMPT)
This prompt combines the user's original resume, the job description, and the extracted keywords to generate an improved resume.
Key Rules and Logic:
- Relevance: Rephrases content to highlight experience relevant to the job.
- Action Verbs: Uses action-oriented language and focuses on quantifiable achievements.
- No Fabrication: Crucially, the prompt is instructed NOT to invent new information.
- Language Translation: Generates all new text content in the specified
{output_language}. - Preservation: Keeps proper nouns, custom section structures, and original date ranges unchanged.
Sources: apps/backend/app/prompts/templates.py:150-177
The following sequence diagram shows the complete resume tailoring workflow.
This diagram outlines the sequence of events when a user tailors a resume, from entering a job description to receiving an AI-improved version.
Sources: apps/frontend/app/(default)/tailor/page.tsx:43-69, apps/backend/app/prompts/templates.py:127-177
Content Generation
The application can also generate supplementary documents like cover letters and outreach messages. These features are available for tailored resumes, as they require the context of a specific job description.
Sources: apps/frontend/components/builder/generate-prompt.tsx:29-44
COVER_LETTER_PROMPT
This prompt generates a professional cover letter with strict constraints.
Guidelines:
- Length: 100-150 words maximum, in 3-4 short paragraphs.
- Opening: Must reference a specific detail from the job description (e.g., product, tech stack).
- Body: Highlights 1-2 directly matching qualifications from the resume.
- Tone: Confident peer, not an eager applicant.
- No Fabrication: Does not invent information not present in the resume.
Sources: apps/backend/app/prompts/templates.py:179-203
OUTREACH_MESSAGE_PROMPT
This prompt creates a concise message suitable for LinkedIn or email.
Guidelines:
- Length: 70-100 words maximum.
- Opening: References a specific detail from the job description. Avoids generic phrases like "I saw your posting."
- Body: One sentence on the strongest matching qualification, with a metric if possible.
- Closing: A low-friction ask, such as "Worth a quick chat?".
- Tone: Informal, like messaging a former colleague.
Sources: apps/backend/app/prompts/templates.py:205-226
Resume Enrichment
The resume enrichment feature is a multi-step, interactive process designed to help users add more detail and impact to their master resume. It uses two distinct prompts from enrichment.py.
The flow is managed on the frontend by the useEnrichmentWizard hook.
Sources: apps/frontend/hooks/use-enrichment-wizard.ts, AGENTS.md
1. Analysis Phase (ANALYZE_RESUME_PROMPT)
First, the system analyzes the resume to find areas for improvement.
Process:
- The LLM is prompted to act as a professional resume analyst.
- It reviews the "Experience" and "Projects" sections for weak or vague descriptions (e.g., "responsible for," missing metrics).
- It generates a maximum of 6 questions in total, prioritized to elicit the most impactful details (metrics, technologies, scope, etc.).
- If the resume is already strong, it returns an empty list of questions.
- The output is a JSON object containing items to enrich and the generated questions.
Sources: apps/backend/app/prompts/enrichment.py:3-68
2. Enhancement Phase (ENHANCE_DESCRIPTION_PROMPT)
After the user answers the questions, the system generates new content.
Process:
- The LLM is prompted to act as a professional resume writer.
- It receives the original item description and the user's answers.
- The key instruction is to ADD new bullet points, not rewrite or replace existing ones.
- The new bullets are designed to be action-oriented, quantified, and impact-focused.
- The output is a JSON object containing a list of
additional_bullets.
Sources: apps/backend/app/prompts/enrichment.py:70-104
The sequence diagram below details the entire enrichment workflow.
This diagram illustrates the interactive resume enrichment process, from the initial analysis to applying the AI-generated enhancements.