AI-Powered Tailoring
Relevant source files
The following files were used as context for generating this wiki page:
The AI-Powered Tailoring feature is a core component of Resume Matcher, designed to optimize a user's master resume for a specific job application. By providing a job description, the user can leverage a Large Language Model (LLM) to generate a new, tailored version of their resume. This process also enables a "JD Match" view, which provides a side-by-side comparison of the resume against the job description with keyword highlighting and match statistics.
This system bridges the frontend user interface with the backend AI services. The user initiates the process from the /tailor page, which triggers a series of API calls to the backend. The backend then uses an LLM to analyze the job description, extract keywords, and rewrite the resume content. The final tailored resume is then displayed in the Resume Builder, where the user can further review and edit it.
End-to-End Tailoring Flow
The tailoring process begins on the frontend, where the user provides a job description. This action initiates a sequence of API calls that orchestrate the backend's AI processing and data persistence, ultimately redirecting the user to the Resume Builder with the newly created resume.
The following diagram illustrates the sequence of events from the user's initial action to the final display of the tailored resume.
This diagram shows the complete user flow for resume tailoring, from UI interaction to backend processing and final redirection.
Sources: apps/frontend/app/(default)/tailor/page.tsx:37-72, apps/backend/app/services/improver.py:11-53
Frontend Orchestration
The user flow is initiated and managed by the TailorPage component.
- State Management: It uses
useStateto manage the job description, loading state, and errors. Themaster_resume_idis retrieved fromlocalStorage. - Validation: Before making any API calls, the
handleGeneratefunction checks if the job description is at least 50 characters long to ensure a minimum level of detail. - API Calls:
uploadJobDescriptions: Sends the job description to the backend, which returns ajobId.improveResume: Sends themasterResumeIdand the newjobIdto trigger the AI tailoring process.
- Redirection: Upon successful generation, the component uses the
useRouterhook to redirect the user to the resume builder page for the newly created resume, using theresume_idfrom the API response.
Sources: apps/frontend/app/(default)/tailor/page.tsx:29-72
Backend AI Processing
The core AI logic resides in the backend's ImproverService. This service is responsible for interacting with the LLM to analyze the inputs and generate the tailored content.
Service Logic
The improve_resume function in improver.py orchestrates the backend workflow.
This flowchart outlines the steps taken by the backend ImproverService to generate a tailored resume.
Sources: apps/backend/app/services/improver.py:11-53
The key steps are:
- Load Data: Fetch the master resume and the target job description from the database.
- Keyword Extraction: Call
extract_keywords_from_job_description, which uses theEXTRACT_KEYWORDS_PROMPTto ask the LLM to identify key skills, requirements, and responsibilities from the job description. - Resume Improvement: Call
improve_resume_with_llm. This function passes the original resume, the extracted keywords, and the job description to the LLM with theIMPROVE_RESUME_PROMPT. - Save and Return: The newly generated resume data is saved to the database as a new entry, linked to the master resume. The new resume's data is then returned to the frontend.
Sources: apps/backend/app/services/improver.py:11-53
LLM Prompts
The quality of the AI tailoring is highly dependent on the prompts sent to the LLM. These are defined in apps/backend/app/prompts/templates.py.
| Prompt Name | Purpose |
|---|---|
EXTRACT_KEYWORDS_PROMPT | Instructs the LLM to parse a job description and extract structured data like required skills, experience years, and key responsibilities into a JSON object. |
IMPROVE_RESUME_PROMPT | The main prompt for tailoring. It instructs the LLM to rewrite the resume content to align with the job description and emphasize the provided keywords. It explicitly forbids inventing new information and specifies the output language. |
Sources: apps/backend/app/prompts/templates.py:100-162
A crucial instruction in the IMPROVE_RESUME_PROMPT is to generate all text content in a specified {output_language}, enabling multi-language content generation.
# apps/backend/app/prompts/templates.py:130-132
IMPROVE_RESUME_PROMPT = """Tailor this resume for the job. Output ONLY the JSON object, no other text.
IMPORTANT: Generate ALL text content (summary, descriptions, skills) in {output_language}.
...
"""
Sources: apps/backend/app/prompts/templates.py:130-132
JD Match & Keyword Highlighting
After a resume is tailored, the "JD MATCH" tab becomes available in the Resume Builder. This feature provides a direct comparison between the job description and the resume, highlighting matching keywords.
Sources: apps/frontend/components/builder/resume-builder.tsx:325-331, AGENTS.md
Frontend Components
ResumeBuilder: This is the main component that houses the tabbed interface. It conditionally renders the "JD MATCH" tab only for tailored resumes (i.e., when ajobDescriptionis available).JDComparisonView: This component implements the split-screen view. It displays the read-only job description on the left and the resume with highlighted keywords on the right. It also shows match statistics (total keywords, matches, percentage).
Sources: apps/frontend/components/builder/resume-builder.tsx:556-563, apps/frontend/components/builder/jd-comparison-view.tsx
Keyword Matching Logic
The logic for extracting, matching, and highlighting keywords is located in apps/frontend/lib/utils/keyword-matcher.ts.
This diagram shows the frontend process for calculating match statistics and preparing resume text for highlighting.
Sources: apps/frontend/lib/utils/keyword-matcher.ts
The key functions are:
| Function | Description |
|---|---|
extractKeywords(text) | Takes a string, converts it to lowercase, splits it into words, and filters out common stop words (from STOP_WORDS) and short words. Returns a Set of significant keywords. |
calculateMatchStats(resumeText, jdKeywords) | Compares the keywords extracted from the resume against the keywords from the job description to calculate the number of matches and the match percentage. |
segmentTextByKeywords(text, keywords) | Splits a given text into an array of segments, where each segment is an object containing the text and a boolean isMatch. This is used to render the resume with highlighting. |
Sources: apps/frontend/lib/utils/keyword-matcher.ts:47-133
The STOP_WORDS set is a crucial part of this process, as it prevents common but meaningless words like "a", "the", "and", "job", "team", and "experience" from being treated as keywords, leading to more accurate and relevant matching.
Sources: apps/frontend/lib/utils/keyword-matcher.ts:6-44
Conclusion
The AI-Powered Tailoring feature is a sophisticated system that integrates frontend user actions with powerful backend AI capabilities. It automates the tedious process of customizing a resume for each job application by leveraging LLMs for content generation and keyword analysis. The subsequent JD Match view provides tangible, data-driven feedback to the user, empowering them to understand how their resume aligns with a job's requirements and where it can be further improved. This entire workflow is a central value proposition of the Resume Matcher application.