Goals
- Add template system alongside existing single-pass AI generation
- Enable users to create reusable cover letter templates with consistent structure
- Migrate single-pass generation to use default template under the hood
- Handle missing job data gracefully with fallback system
- Provide choice: quick generation vs. customized control
Problem Statement
Current: Single-pass AI generation with no reusability or user control over structure
Solution: Hybrid approach - keep single-pass for quick users, add templates for power users
Example Templates
Default Template (Single-Pass Replacement):
{{COVERLETTER_HEAD}}
{{COPILOT_GENERATE_ALL}}
{{COVERLETTER_SIGNATURE}}
Custom Template Example:
{{COVERLETTER_HEAD}}
Dear Hiring Manager,
I am excited to apply for the {{JOB_TITLE}} position at {{COMPANY_NAME|"your organization"}}.
{{COPILOT_COMPANY_APPEAL}}
My background includes {{MY_YEARS_EXPERIENCE}} years in software development, with expertise in {{MY_KEY_SKILLS}}. {{COPILOT_EXPERIENCE_HIGHLIGHT}}
{{COPILOT_ROLE_FIT}}
I am {{MY_AVAILABILITY|"available immediately"}} and would love to discuss how I can contribute to your team's success.
{{COVERLETTER_SIGNATURE}}
Variable Resolution Example:
{{COMPANY_NAME|"your organization"}} → Job Tracker: "Stripe" → AI Extract: "Stripe Inc." → Inline: "your organization" → User Default: "the hiring company" → System: "your organization"
{{JOB_TITLE}} → Job Tracker: missing → AI Extract: "Software Engineer" → User Default: "this role" → System: "this opportunity"
{{USER_FULL_NAME}} → Always available from user profile: "John Smith"
{{MY_CERTIFICATION}} → User-defined content: "AWS Certified Solutions Architect"
Core Requirements
Feature Checklist
MVP Features
- [X] Template system alongside existing single-pass AI generation
- [X] Create/edit/delete custom templates
- [X] Variable substitution system ({{VARIABLE}} syntax)
- [X] 5 static variables: COMPANYNAME, JOBTITLE, USERFIRSTNAME, USERLASTNAME, USERFULLNAME, USER_EMAIL, DATE
- [X] 2 structural variables: COVERLETTERHEAD, COVERLETTERSIGNATURE (customizable)
- [X] 1 e2e AI variable: COPILOTGENERATEALL (replaces single-pass generation)
- [X] 3-5 granular AI variables (COPILOTCOMPANYAPPEAL, COPILOTROLEFIT, etc.)
- [X] Basic custom variables (user-defined static text)
- [X] Fallback system with inline overrides for missing data variables: {{COMPANY_NAME|"custom fallback"}}
- [X] User-wide fallback configuration for COMPANYNAME and JOBTITLE only
- [X] AI extraction toggle setting to attempt extraction from job descriptions
- [X] Default template using COPILOTGENERATEALL
- [X] 2-3 additional default templates (Professional, Technical)
- [ ] Template editor with variable insertion
- [X] Cover letter generation from templates
- [X] Edit generated cover letters
- [X] Migrate single-pass to use default template under the hood
Technical Requirements
- [X] TipTap editor integration for templates
- [ ] Variable validation and syntax highlighting
- [X] AI prompt system for COPILOT_ variables
- [X] Template storage and management
- [X] Customizable head/signature configuration interface
- [X] User-wide fallback settings panel (for COMPANYNAME, JOBTITLE only)
- [X] AI extraction toggle setting
- [ ] Inline fallback override parsing ({{VARIABLE|"fallback"}} syntax)
Nice-to-Have
- [ ] Template preview with sample data
- [ ] Variable testing interface
- [ ] A/B testing between single-pass and template approaches
- [ ] Template analytics
- [ ] Performance optimization for AI calls
Implementation Notes
Variable Types:
- Static:
{{COMPANY_NAME}}, {{JOB_TITLE}}, {{USER_FIRST_NAME}}, {{USER_LAST_NAME}}, {{USER_FULL_NAME}}, {{USER_EMAIL}}, {{DATE}}
- Structural:
{{COVERLETTER_HEAD}}, {{COVERLETTER_SIGNATURE}} (user-customizable)
- AI E2E:
{{COPILOT_GENERATE_ALL}} (full cover letter generation)
- AI Granular:
{{COPILOT_COMPANY_APPEAL}}, {{COPILOT_ROLE_FIT}}, {{COPILOT_EXPERIENCE_HIGHLIGHT}}
- Custom:
{{MY_CERTIFICATION}}, {{MY_AVAILABILITY}} (user-defined static text)
Fallback System:
- Inline Override:
{{COMPANY_NAME|"your organization"}} (template-specific override)
- User-Wide Defaults: Global fallbacks for missing data variables only (COMPANYNAME, JOBTITLE)
- AI Extraction Toggle: User setting to enable AI extraction of missing company/job info from job descriptions
- System Defaults: Built-in fallbacks ("this opportunity", "your organization")
Fallback Priority for Missing Data Variables (COMPANYNAME, JOBTITLE):
- Job Tracker data (if job saved)
- AI extraction from job description (if user enabled + job description available)
- User-configured fallback (inline or user-wide setting)
- System default fallback ("this opportunity", "your organization")
No Fallbacks Needed:
- User Variables:
{{USER_*}} - we always have this data
- Custom Variables:
{{MY_*}} - user defines the content directly
- Structural Variables:
{{COVERLETTER_HEAD/SIGNATURE}} - user customizes or uses defaults
Head/Signature Customization:
- Default
{{COVERLETTER_HEAD}}: "{{USERFULLNAME}}\n{{DATE}}"
- Default
{{COVERLETTER_SIGNATURE}}: "Best regards,\n{{USERFULLNAME}}"
- Users can override with custom formatting, additional contact info, etc.
Migration Strategy:
- Keep existing single-pass generation UI
- Behind the scenes, convert to use default template with
{{COPILOT_GENERATE_ALL}}
- Add "Customize Template" option for users who want more control
Success Metrics
- Template adoption rate among power users
- Retention of quick-generation users after migration
- User satisfaction with both generation methods
- Variable resolution success rate (target >95%)
- Time to generate cover letter (maintain current speed for default template)lo