Offer letter generation
Generate filled offer letters from a JSON employee data file and a Word template. Use this skill whenever you need to create offer letters by matching data fields to document placeholders, handling conditional relocation packages, and saving the final document.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill offer-letter-generationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
3.1 KB, 702 tokens by cl100k_base, as published. Nobody here has run it
Offer Letter Generation
This skill demonstrates the complete workflow for generating personalized offer letters from employee data and a template.
Workflow Overview
- Load employee data from JSON
- Load template Word document
- Map fields from JSON to template placeholders
- Handle conditionals (e.g., relocation packages)
- Fill template with data
- Save output document
Data Structure
Employee data should be in JSON format with these typical fields:
{
"DOC_ID": "OFFER-2024-00847",
"COMPANY_NAME": "Nexus Technologies Inc.",
"CANDIDATE_FULL_NAME": "Sarah Chen",
"POSITION": "Senior Software Engineer",
"BASE_SALARY": "185,000",
"RELOCATION_PACKAGE": "Yes",
"RELOCATION_AMOUNT": "15,000",
...
}
Placeholder Mapping
Common placeholders in offer letter templates:
| Placeholder | Data Field | Example |
|---|---|---|
{{CANDIDATE_FULL_NAME}} | CANDIDATE_FULL_NAME | Sarah Chen |
{{POSITION}} | POSITION | Senior Software Engineer |
{{COMPANY_NAME}} | COMPANY_NAME | Nexus Technologies Inc. |
{{BASE_SALARY}} | BASE_SALARY | 185,000 |
{{START_DATE}} | START_DATE | February 12, 2024 |
{{STREET_ADDRESS}} | STREET_ADDRESS | 456 Oak Avenue, Apt 7B |
Conditional Sections
Offer letters often have optional sections based on employee benefits:
{{IF_RELOCATION_PACKAGE}}
Our company is pleased to provide a relocation package of ${{RELOCATION_AMOUNT}}
to assist with your move. You have {{RELOCATION_DAYS}} days from your start date
to complete your relocation.
{{END_IF_RELOCATION_PACKAGE}}
Processing logic:
- If
RELOCATION_PACKAGE== "Yes": Keep the section, remove markers - If
RELOCATION_PACKAGE!= "Yes": Remove entire section including markers
Implementation Steps
-
Load JSON data
import json with open('employee_data.json') as f: data = json.load(f) -
Create mapping function
- Map JSON keys to placeholder names (may differ)
- Handle boolean conversions (Yes/No to True/False)
-
Process conditionals
- Identify condition name from
IF_FIELDNAMEpattern - Check if condition is true/false
- Keep or remove section accordingly
- Identify condition name from
-
Fill and save
- Replace all placeholders
- Save to output path
Example Output Structure
The filled offer letter should:
- Replace all
{{FIELD}}markers with actual values - Either include the relocation section with clean text (no IF markers) OR exclude it entirely
- Preserve all formatting from the template
- Be saved as a valid .docx file
Validation Checklist
After generating the offer letter:
- All placeholders replaced (no
{{remaining) - Conditional sections properly handled
- Document opens without errors
- Formatting is preserved
- Address block is complete
- Salary and benefits details correct
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.