update scripts to include user key points

This commit is contained in:
Kyle Belanger 2025-02-17 16:12:28 -05:00
parent 61c66dd3bc
commit 123f16e2d9
4 changed files with 9 additions and 4 deletions

View file

@ -8,7 +8,7 @@
"content": [ "content": [
{ {
"type": "text", "type": "text",
"text": "You are an expert in job hunting and cover letter writing. Your task is to create a persuasive and professional cover letter for a job candidate based on their resume, the job description, and the current date. \n\nHere is the job description:\n<job_description>\n{{job_description}}\n</job_description>\n\nHere is the candidate's resume in JSON format:\n<resume_json>\n{{resume_json}}\n</resume_json>\n\nThe current date is:\n<date>\n{{date}}\n</date>\n\nPlease follow these steps to create an effective cover letter:\n\n1. Analyze the resume and job description to identify key skills and experiences that match the job requirements.\n2. Determine the most persuasive points to highlight in the cover letter.\n3. Structure the cover letter with an introduction, body paragraphs, and a conclusion.\n4. Ensure the letter is professional, engaging, and tailored to the specific job and company.\n\nBefore writing the cover letter, wrap your analysis inside <analysis> tags. In this analysis:\n1. Extract and list key skills and experiences from the resume.\n2. Identify the most important requirements from the job description.\n3. Brainstorm specific examples or achievements that match the job requirements.\n4. Create a brief outline of the cover letter structure.\n\nAfter your analysis, write the cover letter using the following structure:\n\n<cover_letter>\n<header>\n[Candidate's Name]\n[Candidate's Address]\n[City, State ZIP Code]\n[Phone Number]\n[Email Address]\n\n[Date]\n\n[Employer's Name]\n[Company Name]\n[Company Address]\n[City, State ZIP Code]\n</header>\n\n<greeting>\n[Greeting]\n</greeting>\n\n<introduction>\n[Opening paragraph]\n</introduction>\n\n<body>\n[Main paragraphs highlighting relevant skills and experiences]\n</body>\n\n<conclusion>\n[Closing paragraph]\n</conclusion>\n\n<signature>\n[Signature line]\n</signature>\n</cover_letter>\n\nRemember to be persuasive, professional, and to tailor the content specifically to the job description and the candidate's qualifications." "text": "You are an expert in job hunting and cover letter writing. Your task is to create a persuasive and professional cover letter for a job candidate based on their resume, the job description, the current date, and any optional key points they want to highlight.\n\nHere are the inputs for this task:\n\nJob Description:\n<job_description>\n{{job_description}}\n</job_description>\n\nCandidate's Resume (in JSON format):\n<resume_json>\n{{resume_json}}\n</resume_json>\n\nCurrent Date:\n<date>\n{{date}}\n</date>\n\nOptional Key Points to Highlight:\n<key_points>\n{{key_points}}\n</key_points>\n\nBefore writing the cover letter, please analyze the provided information. Wrap your analysis inside <cover_letter_planning> tags:\n\n<cover_letter_planning>\n1. Extract and list key skills and experiences from the resume.\n2. Identify the most important requirements from the job description.\n3. If provided, consider how to incorporate the optional key points.\n4. Match the candidate's qualifications with the job requirements:\n a. List qualifications that directly match job requirements.\n b. Identify qualifications that indirectly relate to job requirements.\n c. Note any potential gaps between candidate qualifications and job requirements.\n5. List the most relevant achievements from the resume, connecting them to job requirements.\n6. Brainstorm specific examples that demonstrate the candidate's suitability.\n7. For any gaps identified, brainstorm how to address them positively in the letter.\n8. Create a brief outline of the cover letter structure, noting where to include key points and achievements.\n</cover_letter_planning>\n\nAfter your analysis, craft a professional and engaging cover letter using the following structure:\n\n<cover_letter>\n<header>\n[Candidate's Name]\n[Candidate's Address]\n[City, State ZIP Code]\n[Phone Number]\n[Email Address]\n\n[Current Date]\n\n[Employer's Name]\n[Company Name]\n[Company Address]\n[City, State ZIP Code]\n</header>\n\n<greeting>\n[Professional greeting]\n</greeting>\n\n<introduction>\n[Opening paragraph: Introduce yourself, state the position you're applying for, and briefly mention how you learned about the opportunity.]\n</introduction>\n\n<body>\n[2-3 paragraphs highlighting relevant skills, experiences, and achievements. Connect these to the job requirements and company needs. If provided, incorporate the optional key points naturally into these paragraphs.]\n</body>\n\n<conclusion>\n[Closing paragraph: Express enthusiasm for the position, request an interview, and thank the reader for their consideration.]\n</conclusion>\n\n<signature>\nSincerely,\n[Candidate's Name]\n</signature>\n</cover_letter>\n\nImportant guidelines:\n1. Tailor the content specifically to the job description and the candidate's qualifications.\n2. Be persuasive and professional throughout the letter.\n3. Use concrete examples to demonstrate the candidate's skills and experiences.\n4. Keep the letter concise, typically not exceeding one page.\n5. Ensure proper grammar, spelling, and formatting.\n6. If provided, seamlessly integrate the optional key points into the letter without explicitly mentioning them as separate items.\n\nPlease write the cover letter based on these instructions and the provided information."
} }
] ]
}, },
@ -17,7 +17,7 @@
"content": [ "content": [
{ {
"type": "text", "type": "text",
"text": "<analysis>" "text": "<cover_letter_planning>"
} }
] ]
} }

View file

@ -20,13 +20,15 @@
<textarea id="resumeTextOutput" rows="10"></textarea> <textarea id="resumeTextOutput" rows="10"></textarea>
<label for="jobDescription">Paste Job Description:</label> <label for="jobDescription">Paste Job Description:</label>
<textarea id="jobDescription" rows="5" required></textarea> <textarea id="jobDescription" rows="5" required></textarea>
<label for="keyPoints">Key Points for Letter (optional):</label>
<textarea id="keyPoints" rows="5" required></textarea>
<button id="generateCoverLetterBtn">Generate Cover Letter</button> <button id="generateCoverLetterBtn">Generate Cover Letter</button>
</div> </div>
<!-- Hidden To Start With --> <!-- Hidden To Start With -->
<div id="coverLetterSection" style="display: none;"> <div id="coverLetterSection" style="display: none;">
<h3>Generated Cover Letter:</h3> <h3>Generated Cover Letter:</h3>
<textarea id="coverLetterOutput"></textarea> <textarea id="coverLetterOutput" rows="10"></textarea>
<button id="downloadBtn">Download as DOCX</button> <button id="downloadBtn">Download as DOCX</button>
</div> </div>
<!-- End Hidden Section --> <!-- End Hidden Section -->

View file

@ -47,6 +47,7 @@ document.getElementById('uploadForm').addEventListener('submit', async function
document.getElementById("generateCoverLetterBtn").addEventListener("click", async function () { document.getElementById("generateCoverLetterBtn").addEventListener("click", async function () {
const extractedResumeText = document.getElementById("resumeTextOutput").value; const extractedResumeText = document.getElementById("resumeTextOutput").value;
const jobDescription = document.getElementById("jobDescription").value; const jobDescription = document.getElementById("jobDescription").value;
const keyPoints = document.getElementById("keyPoints").value;
const generateBtn = document.getElementById("generateCoverLetterBtn") const generateBtn = document.getElementById("generateCoverLetterBtn")
if (!extractedResumeText.trim()) { if (!extractedResumeText.trim()) {
@ -62,6 +63,7 @@ document.getElementById("generateCoverLetterBtn").addEventListener("click", asyn
const requestData = { const requestData = {
extractedResumeText, extractedResumeText,
jobDescription, jobDescription,
keyPoints,
}; };
generateBtn.textContent = "Generating Cover Letter...." generateBtn.textContent = "Generating Cover Letter...."

View file

@ -33,7 +33,7 @@ router.post('/extract-resume', upload.single('resume'), async (req, res) => {
// Handle Resume upload and user input for Job Description // Handle Resume upload and user input for Job Description
router.post('/', async (req, res) => { router.post('/', async (req, res) => {
try { try {
const { extractedResumeText, jobDescription } = req.body; const { extractedResumeText, jobDescription, keyPoints } = req.body;
const resume_parser_api = require('../data/resume_parser_api.json'); const resume_parser_api = require('../data/resume_parser_api.json');
const cover_letter_api = require('../data/cover_letter_api.json'); const cover_letter_api = require('../data/cover_letter_api.json');
@ -47,6 +47,7 @@ router.post('/', async (req, res) => {
cover_letter_api.messages[0].content[0].text = cover_letter_api.messages[0].content[0].text cover_letter_api.messages[0].content[0].text = cover_letter_api.messages[0].content[0].text
.replace('{{resume_json}}', candidateProfile) .replace('{{resume_json}}', candidateProfile)
.replace('{{job_description}}', jobDescription) .replace('{{job_description}}', jobDescription)
.replace('{{key_points}}', keyPoints )
.replace('{{date}}', new Date().toDateString()); .replace('{{date}}', new Date().toDateString());
const coverLetterResponse = await anthropic.messages.create(cover_letter_api); const coverLetterResponse = await anthropic.messages.create(cover_letter_api);