Files
Bewerbungszauberer/src/.claude/commands/write-application-email.md
T
gurixandClaude d9af86e2cf feat: implement application email generation command
Implement /write-application-email command and update folder structure:

Changes:
- Add /write-application-email command with document verification
- Update /new-application to create attachments/ subfolder with .keep file
- Update CLAUDE.md with comprehensive workflow documentation
- Add Example 5 showing email generation usage

Features:
- Verifies CV, cover letter exist in attachments/ before generation
- Generates brief professional email (3-4 sentences)
- Supports German/English language detection
- Adapts tone (Formal/Balanced/Casual) from application.md
- Professional subject line format
- Explicit document references
- Flags: --skip-validation, --force

File structure now includes:
applications/pending/[app-name]/
  ├── application.md
  ├── input/
  └── attachments/
      └── .keep

OpenSpec: add-application-email

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 16:46:13 +01:00

17 KiB

Generate a professional application email with subject line and document references.

Instructions

You are generating a professional application email for a job application. This email must be brief, professional, and include proper references to attached documents.

Step 1: Parse Command Arguments

Check for optional flags and parameters:

Flags:

  • --skip-validation: Skip automatic validation check
  • --force or --overwrite: Overwrite existing application-email.md if it exists
  • --help: Show usage information and exit

Parameter:

  • Application folder name (optional): e.g., 2025-11-02-TechCorp-Developer

If --help flag is present, show usage and exit:

Usage: /write-application-email [application-name] [flags]

Generates a professional application email with document references.

Options:
  [application-name]     Optional. Name of application folder.
                         If omitted, uses current directory.

  --skip-validation      Skip automatic validation check (not recommended)
  --force, --overwrite   Overwrite existing application-email.md
  --help                 Show this help message

Examples:
  /write-application-email
  /write-application-email 2025-11-02-TechCorp-Developer
  /write-application-email --force
  /write-application-email --skip-validation --force

The command will:
1. Validate the application (unless --skip-validation)
2. Check if email already exists (unless --force)
3. Verify required documents exist in attachments/ folder
4. Read profile.md and application.md
5. Generate a brief professional email with subject line
6. Save to application-email.md in the application folder

Step 2: Location Detection

Determine Target Application

If NO parameter provided:

  1. Check current working directory
  2. Verify if inside an application folder:
    • Path pattern: ends with applications/pending/[folder-name]/
    • File existence: application.md exists in current directory
  3. If yes → use this application
  4. If no → show error with available applications

If parameter PROVIDED:

  1. Resolve to application folder: applications/pending/[folder-name]/
  2. Check if application.md exists in that location
  3. If yes → use that application
  4. If no → show error with available applications

Error: Location Unclear

❌ Not in an application folder

Please either:
1. Navigate to an application folder:
   cd applications/pending/[application-folder]/
   /write-application-email

2. Or provide the application folder name:
   /write-application-email [application-folder-name]

Available applications:
[List output of: ls applications/pending/]

Example:
/write-application-email 2025-11-02-TechCorp-Developer

Error: Application Not Found

❌ Application not found: [provided-name]

Available applications:
[List output of: ls applications/pending/]

Step 3: Automatic Validation Check

Unless --skip-validation flag is present, run validation before generating.

Run Validation

  1. Show progress: 🔍 Validating application...
  2. Execute /validate-application for the target application
  3. Capture result (pass/fail)

Handle Validation Result

If validation PASSES:

✅ Application validation passed

Proceed to Step 4.

If validation FAILS:

❌ Application validation failed

Your application has incomplete sections. Please fix these issues first:

[Show validation error details]

Options:
1. Fix the issues in application.md and try again
2. Run /validate-application for full details
3. Use --skip-validation to proceed anyway (not recommended)

Example:
/write-application-email --skip-validation

STOP. Do not generate email.

Skip Validation Warning

If --skip-validation flag is present:

⚠️  Skipping validation check (not recommended)

Proceeding with email generation. The application may have incomplete sections.

Proceed to Step 4.

Step 4: Check for Existing Email

Check if application-email.md exists in the application folder.

If File Exists (and --force NOT present)

❌ Application email already exists

File: [path-to-application-email.md]

To regenerate, use:
/write-application-email --force

⚠️  Warning: This will overwrite your existing email.
If you've made manual edits, they will be lost.

STOP. Do not overwrite.

If File Exists (and --force IS present)

⚠️  Overwriting existing application email

File: [path-to-application-email.md]
Your previous email will be replaced.

Proceed to Step 5.

If File Does Not Exist

Proceed to Step 5 (no message needed).

Step 5: Verify Documents in Attachments Folder

CRITICAL: The email will reference attached documents. Verify they exist in the attachments/ folder.

Show progress: 📎 Verifying attachments...

Check Attachments Folder

  1. Verify attachments/ folder exists in application directory
  2. List all files in attachments/ folder (excluding .keep)
  3. Categorize files by type:
    • CV/Resume: Files containing "cv", "resume", "lebenslauf" in filename (case-insensitive)
    • Cover Letter: Files containing "cover", "letter", "anschreiben", "motivationsschreiben" in filename (case-insensitive)
    • Certificates: Files containing "certificate", "diploma", "zeugnis", "zertifikat" in filename (case-insensitive)
    • Other: Any other PDF or document files

Required Documents Check

Minimum requirements:

  • At least one CV/Resume file
  • At least one Cover Letter file

If attachments/ folder doesn't exist:

❌ Attachments folder not found

The attachments/ folder is missing. This might be an old application.

To fix:
1. Create the folder: mkdir attachments
2. Add your documents (CV, cover letter, certificates)
3. Try again

Expected location: [application-path]/attachments/

STOP.

If folder is empty (only .keep file or no files):

❌ No documents found in attachments folder

The attachments/ folder is empty. You need to add documents before generating the email.

Required documents:
- ✗ CV/Resume (PDF) - Not found
- ✗ Cover letter (PDF) - Not found

Optional documents:
- Certificates/Diplomas (PDF)

Location: [application-path]/attachments/

Please add your documents and try again.

STOP.

If CV is missing:

❌ CV/Resume not found in attachments folder

Required documents:
- ✗ CV/Resume (PDF) - Not found
- ✓ Cover letter - Found: [filename]

Please add your CV to:
[application-path]/attachments/

Tip: Filename should contain "cv", "resume", or "lebenslauf"
Example: John_Doe_CV.pdf

STOP.

If Cover Letter is missing:

❌ Cover letter not found in attachments folder

Required documents:
- ✓ CV/Resume - Found: [filename]
- ✗ Cover letter (PDF) - Not found

Please add your cover letter to:
[application-path]/attachments/

Tip: Filename should contain "cover-letter" or "anschreiben"
Example: John_Doe_Cover_Letter.pdf

STOP.

If all required documents found:

✓ Found attachments:
  - CV: [filename]
  - Cover Letter: [filename]
  [- Certificates: [filename(s)] (if any)]

Proceed to Step 6.

Step 6: Read Data Sources

Show progress: 📝 Generating application email...

Read profile.md

  1. Check if profile.md exists in framework root
  2. Read entire file
  3. Parse and extract:
    • Personal Information: Full name, email, phone
    • For email signature and sender information

If profile.md is missing or unreadable:

❌ Profile not found

Could not read profile.md. Please create and validate your profile first.

Steps:
1. Fill out profile.md with your information
2. Run /validate-profile to check completeness
3. Try /write-application-email again

STOP.

Show progress: ✓ Read profile.md (applicant info)

Read application.md

  1. Check if application.md exists in application folder
  2. Read entire file
  3. Parse and extract:
    • Organization Information: Company name, contact person name, contact email
    • Job Information: Job title, job level
    • Tone of Voice: Tone assessment (Formal/Balanced/Casual)
    • Key Messages: Main points (for reference, though email is brief)

If application.md is missing or unreadable:

❌ Application not found

Could not read application.md in [path].

This doesn't appear to be a valid application folder.
Did you create this application with /new-application?

STOP.

Show progress: ✓ Read application.md (job details)

Step 7: Determine Language and Tone

Detect Language

Check these indicators in order:

  1. Job posting language (if job description in input/ was in German)
  2. Company location (if Germany/Austria/Switzerland → likely German)
  3. Application.md language (if written in German → use German)
  4. Default: English if unclear

Extract Tone

From application.md "Tone of Voice" section:

  • Look for: "Formal", "Balanced", or "Casual"
  • Default to "Balanced" if not specified

Show progress: ✓ Applied tone: [Formal/Balanced/Casual] Show progress: ✓ Language: [German/English]

Step 8: Generate Email Content

Generate a professional application email. Target: Brief and concise (3-4 sentences in body).

Structure Overview

  1. Subject Line
  2. Greeting/Salutation
  3. Email Body (3-4 sentences)
  4. Sign-off and Signature

Subject Line

Purpose: Clear, professional, immediately conveys the purpose.

Format for German:

Bewerbung als [Job Title] - [Applicant Full Name]

Format for English:

Application for [Job Title] - [Applicant Full Name]

Examples:

  • German: Bewerbung als Senior Software Engineer - Max Mustermann
  • English: Application for Senior Software Engineer - John Doe

Greeting/Salutation

If contact person name is available in application.md:

  • German: Sehr geehrte/r [Herr/Frau] [Last Name], or Liebe/r [First Name], (Casual tone only)
  • English: Dear [Mr./Ms./Dr.] [Last Name], or Dear [First Name], (Casual tone only)

If no contact person:

  • German: Sehr geehrte Damen und Herren,
  • English: Dear Hiring Manager,

Email Body (3-4 sentences maximum)

Purpose: Brief introduction, state purpose, reference documents, express interest.

Content elements:

  1. Opening: State you're applying for the specific position
  2. Documents: Explicitly mention attached documents (CV, cover letter, and certificates if present)
  3. Brief interest: One sentence showing genuine interest or fit
  4. Availability: Mention availability for interview/discussion

Tone guidance:

  • Formal: Professional and respectful, traditional business language
  • Balanced: Professional but warm, straightforward
  • Casual: Friendly and approachable, but still professional

IMPORTANT: Keep it concise. The cover letter contains the details; the email is just a brief cover message.

Example (Balanced, English):

I am writing to apply for the Senior Software Engineer position at TechCorp. Please find attached my CV, cover letter, and relevant certificates for your review. I have eight years of experience in backend development and am particularly interested in your work on cloud infrastructure. I am available for an interview at your convenience.

Example (Formal, German):

hiermit bewerbe ich mich um die Position als Senior Software Engineer bei TechCorp. Im Anhang finden Sie meinen Lebenslauf, mein Anschreiben sowie relevante Zeugnisse. Mit acht Jahren Erfahrung in der Backend-Entwicklung interessiere ich mich besonders für Ihre Arbeit im Bereich Cloud-Infrastruktur. Für ein Vorstellungsgespräch stehe ich Ihnen gerne zur Verfügung.

Example (Casual, English):

I'm applying for the Senior Software Engineer position at TechCorp. I've attached my CV, cover letter, and certificates for you to review. I've been working in backend development for about eight years and find your cloud infrastructure work really interesting. I'm happy to chat whenever works for you.

Document Reference Variations:

If CV and Cover Letter only:

  • German: Im Anhang finden Sie meinen Lebenslauf und mein Anschreiben.
  • English: Please find attached my CV and cover letter.

If CV, Cover Letter, and Certificates:

  • German: Im Anhang finden Sie meinen Lebenslauf, mein Anschreiben sowie relevante Zeugnisse.
  • English: Please find attached my CV, cover letter, and relevant certificates.

Sign-off and Signature

German:

  • Formal: Mit freundlichen Grüßen,
  • Balanced: Mit freundlichen Grüßen,
  • Casual: Viele Grüße,

English:

  • Formal: Sincerely, or Best regards,
  • Balanced: Best regards,
  • Casual: Best regards, or Kind regards,

Follow with applicant's full name and contact information from profile.md:

[Applicant Full Name]
[Email]
[Phone]

Step 9: Format and Write File

Format as Markdown

<!--
Application Email
Generated: [YYYY-MM-DD HH:MM]
Sources: profile.md, application.md, attachments/
Language: [German/English]
Tone: [Formal/Balanced/Casual]
-->

# Subject

[Subject Line]

---

[Greeting]

[Email Body - 3-4 sentences]

[Sign-off]
[Applicant Full Name]
[Email]
[Phone]

---

## Attachments

[List of files in attachments/ folder to be sent:]
- [CV filename]
- [Cover letter filename]
- [Certificate filename(s)] (if any)

Write to File

  1. Write content to application-email.md in the application folder
  2. Handle write errors gracefully:
    • Permission denied: "Could not save application-email.md. Check write permissions."
    • Disk full: "Could not save application-email.md. Check available disk space."
    • Other errors: "Could not save application-email.md: [error details]"

Step 10: Success Output

Display success message:

✅ Application email saved: application-email.md

## Generation Summary:

📊 Email Details:
- Language: [German/English]
- Tone: [Formal/Balanced/Casual]
- Subject: [Generated subject line]
- Attachments referenced: [N] files

📍 Location:
[full or relative path to application-email.md]

📎 Attachments Ready:
- ✓ [CV filename]
- ✓ [Cover letter filename]
[- ✓ [Certificate filename(s)]] (if any)

## Next Steps:

1. **Review application-email.md**:
   Open and read the email. Verify:
   - Subject line is appropriate
   - All attachments are correctly listed
   - Tone matches the company culture
   - Contact information is correct

2. **Prepare email in your client**:
   - Copy subject line from the file
   - Copy email body
   - Attach the documents from attachments/ folder:
     [List each file with checkboxes]
     □ [CV filename]
     □ [Cover letter filename]
     [□ [Certificate filename(s)]] (if any)

3. **Final checks before sending**:
   - Verify recipient email address
   - Double-check all attachments are included
   - Proofread one last time
   - Ensure file names are professional

---

**Tip**: This email is intentionally brief. The cover letter contains the detailed information about your qualifications and interest in the role.

Error Handling Reference

Missing profile.md

❌ Profile not found

Could not read profile.md. Please create and validate your profile first.

Steps:
1. Fill out profile.md with your information
2. Run /validate-profile to check completeness
3. Try /write-application-email again

Missing application.md

❌ Application not found

Could not read application.md in [path].

This doesn't appear to be a valid application folder.
Did you create this application with /new-application?

Validation Failed (no --skip-validation)

❌ Application validation failed

[Validation error details]

Options:
1. Fix issues in application.md
2. Run /validate-application for full details
3. Use --skip-validation to proceed (not recommended)

Email Exists (no --force)

❌ Application email already exists

File: [path]

Use --force to overwrite:
/write-application-email --force

⚠️  This will replace your existing email.

Attachments Missing

❌ Required documents not found

The attachments/ folder is missing required documents:
[Show which documents are missing]

Please add your documents and try again.

File Write Error

❌ Could not save application email

Error: [specific error message]

Possible causes:
- Insufficient write permissions
- Disk space full
- Path too long

Please check the issue and try again.

Important Notes

Email Purpose

The application email is a brief cover message for your attachments, not a replacement for the cover letter:

  • Email: 3-4 sentences, mentions documents, shows interest
  • Cover Letter: Detailed explanation of qualifications and fit

Document References

  • Always explicitly list what documents are attached
  • Use the actual filenames from the attachments/ folder
  • Make it easy for the recipient to know what they're receiving

Professional Tone

  • Even "Casual" tone should remain professional
  • This is a first impression - clarity and professionalism are key
  • Brief doesn't mean informal or sloppy

Attachment Verification is Critical

  • Never generate an email claiming documents are attached if they don't exist
  • Always verify before generation
  • Provide clear guidance on what's missing and where to add files

Remember: This email represents the first direct communication with the hiring manager. It should be professional, clear, and make it easy for them to review your application materials.