Sunday, June 30, 2024

Prompt Engineering a Cover Letter

Tech Writer

Using Large Language Models (LLMs) can accelerate the generation of targeted documentation, ensuring it is free from spelling and grammar errors. These tools boost productivity, allowing you to focus on more valuable tasks.

Cover letters often require significant time and consideration. They must be error-free and tailored to a specific reader, showcasing how your experience and skills add value. This process requires time, effort, and skill, highlighting the value of LLMs in streamlining it.

In this blog post, I will present the technique I use to produce custom cover letters based on specific job descriptions and resumes.

Are cover letters worth the effort?

There are differing opinions on the merits of cover letters. I choose to submit them when given the opportunity. Cover letters allow you to highlight and elaborate on areas in your background that pertain to the job description, going beyond the resume's bullet points.

Using LLMs to produce targeted cover letters reduces effort while providing documents that are free from spelling and grammar errors. These letters are concise, professional in tone, and highlight relevant areas in your background required for the role.

Prompt engineering a cover letter

In a prior blog post, I explored the concept of prompt engineering to increase the quality and reliability of generative AI applications and content produced by LLM. Here is the prompt I engineered for this task:

You are a knowledgeable assistant well-versed in the English language. Write a cover letter for a job application. What follows are two distinct sections. The first section is the formal job description outlining expectations for the position. The second section is my resume. Compare the job description in the first section against my resume in the second, and generate a custom cover letter. The wording of the cover letter should showcase, emphasize, and elevate my relevant experience. Utilize keywords from the job description section to generate the cover letter. Ensure the cover letter addresses the mandatory job requirements. When generating the cover letter, use concise English language in the active voice and maintain a professional tone. The name of the hiring manager is unknown. When you emit your output, emit it using only plain text and contained within a code block.
Section One: Job Description:

Section Two: Resume:

I recommend adding additional context within the above prompt, instructing the LLM to emphasize key points in your background that are relevant for the position, and de-emphasize those areas that are not relevant. If you choose to do this, I recommend inserting this additional context after the sentence, "The wording of the cover letter should showcase, emphasize, and elevate my relevant experience."

Cut and paste the prompt into your preferred LLM's chat interface, and insert the job description in section one, your resume in section two, and press submit.

The First Draft: Raw AI Output

Now the LLM should produce a cover letter. Cut and paste the LLM draft output into a word processor.

The Second Draft: Your Input is Required

Using the word processor, you should

  1. ensure the letter references key points in your background and it is aligned to the job description,
  2. ensure that letter touches upon the mandatory job requirements,
  3. add in additional content that elaborates on your experience, skills and how both will bring value to the role, and finally
  4. review the cover letter for accuracy and tone.

Once you are comfortable with your edits, cycle it back through the LLM.

  1. Cut and paste the following prompt into the LLM chat window,
  2. At the end of the prompt, append your revised cover letter,
  3. Press Submit.
Critique the following draft cover letter. Identify areas in the cover letter that address the mandatory job requirements, and identify areas in the resume that relate to mandatory job requirements that are not reflected in the cover letter. Using your critique, revise the cover letter, ensuring that 1) mandatory job requirements that match my background and skills are represented and 2) keywords in the job description are incorporated. Use concise English language in the active voice and maintain a professional tone.

Draft cover letter:

Notice the prompt specifies the LLM to highlight alignment to mandatory job requirements. This alignment should be a part of the critique the LLM generates.

Iterate Until You're Comfortable

I use multiple critique cycles until I am comfortable with the final draft.

Then I upload the cover letter into the ATS system.

What LLMs are the Best for this Task?

I have found the following LLM models provide content that meets my expectations, and provides consistent formatting output:

  1. OpenAI GPT-4
  2. Google Gemini

If you are technically oriented, and prefer using open source LLMs, I recommend experimenting with Meta's Llama-3 model at the HuggingFace chat site.


I hope you find this technique useful. Drop a comment on this blog, or on my LinkedIn or Mastodon feeds. I would love to hear from you!

Recent Posts