feat: add application validation command

Add /validate-application slash command to ensure application.md files
are complete before document generation. Validates required sections
(Organization Info, Job Info, Job Description), detects placeholders
like [To be filled], warns if input/ folder is empty, and provides
structured pass/fail output consistent with /validate-profile.

This acts as a quality gate in the application workflow, preventing
placeholder text from appearing in generated documents.

OpenSpec: add-application-validation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-02 21:00:05 +01:00
co-authored by Claude
parent f1ba0dd98d
commit 2b13cc4e69
6 changed files with 949 additions and 5 deletions
+5 -2
View File
@@ -347,8 +347,11 @@ After successful population:
3. **Refine match strategy**:
Adjust which experiences and projects to emphasize.
4. **Generate documents** (coming soon):
Once satisfied, generate tailored CV and cover letter.
4. **Validate application**:
Run /validate-application to ensure completeness before document generation.
5. **Generate documents** (coming soon):
Once validation passes, generate tailored CV and cover letter.
---
@@ -0,0 +1,385 @@
Validate that `application.md` is completely filled out and ready for document generation.
# Instructions
You are validating a job application to ensure it's ready for generating tailored CV, cover letter, and email.
## Step 1: Location Detection
### Determine Which Application to Validate
**If NO parameter provided:**
1. Check current working directory
2. Verify if you're inside an application folder by checking:
- Path pattern: ends with `applications/pending/[folder-name]/`
- File existence: `application.md` exists in current directory
3. If yes → validate this application
4. If no → show error with available applications (see Error Handling section)
**If parameter PROVIDED:**
1. Parameter can be:
- Folder name: `2025-11-02-TechCorp-Developer`
- Relative path: `applications/pending/2025-11-02-TechCorp-Developer`
- Absolute path: `/full/path/to/application/folder`
2. Resolve to application folder: `applications/pending/[folder-name]/`
3. Check if `application.md` exists in that location
4. If yes → validate that application
5. If no → show error with available applications
### Error Handling: Wrong Location / Not Found
**If running from wrong location without parameter:**
```
❌ Not in an application folder
Please either:
1. Navigate to an application folder:
cd applications/pending/[application-folder]/
/validate-application
2. Or provide the application folder name:
/validate-application [application-folder-name]
Available applications:
[List output of: ls applications/pending/]
Example:
/validate-application 2025-11-02-TechCorp-Developer
```
**If application doesn't exist with parameter:**
```
❌ Application not found: [provided-name]
Available applications:
[List output of: ls applications/pending/]
Usage:
/validate-application [folder-name]
```
**If application.md missing in found folder:**
```
❌ No application.md found in [path]
This doesn't appear to be a valid application folder.
Did you create this application with /new-application?
```
## Step 2: Read application.md
Read the entire `application.md` file in the detected/specified application folder.
**If file is corrupted or unreadable:**
```
❌ Could not read application.md
The file exists but cannot be read. It may be corrupted or have permission issues.
Please check the file: [full-path-to-application.md]
```
## Step 3: Parse Sections
Extract content for each section by markdown headings. Recognize sections case-insensitively:
**Required Sections** (validation checks these):
- "Organization Information" / "organization information"
- "Job Information" / "job information"
- "Job Description Summary" / "job description summary"
**Optional Sections** (don't cause validation failure):
- Match Strategy
- Key Messages
- Tone of Voice
- Research Notes
- Document Checklist
- Application Strategy Notes
- Timeline
- Metadata
## Step 4: Detect Placeholders
Check for these placeholder patterns that indicate incomplete data:
### Placeholder Patterns
**Square brackets:**
- `[To be filled]`
- `[Organization name]`
- `[Job Title]`
- `[Company Name]`
- `[...]`
- `[Any text in brackets]`
**Generic template text:**
- "Add information here"
- "To be filled"
- Text that matches the template unchanged
### Context-Aware Detection
**DO flag as placeholders:**
- `[To be filled]`
- `[Company Name]`
- `[Job Title]` as the only content
- `[Organization name here]`
**DON'T flag as placeholders:**
- `[PhD]` after a name in context
- `[Acquired by Google]` in a company description
- `[Remote]` as a job location descriptor
- Other brackets used meaningfully in normal text
If placeholder text is longer than 100 characters, truncate it in the error message: `"[First 100 chars...]"`
## Step 5: Validate Required Sections
### Organization Information
**Must have:**
- Organization Name field with real content (not placeholder)
**Check:**
- Look for "Organization Name:", "Company:", or similar field labels
- Extract the value after the label
- Check if value contains placeholders
- Check if value is empty or only whitespace
**If incomplete:**
- Flag: `Organization Name: Contains placeholder "[exact-text]"`
- Or: `Organization Name: Missing or empty`
### Job Information
**Must have:**
- Job Title field with real content (not placeholder)
**Check:**
- Look for "Job Title:", "Position:", or similar field labels
- Extract the value after the label
- Check if value contains placeholders
- Check if value is empty or only whitespace
**If incomplete:**
- Flag: `Job Title: Contains placeholder "[exact-text]"`
- Or: `Job Title: Missing or empty`
### Job Description Summary
**Must have:**
- At least SOME content in one or more subsections:
- Responsibilities / Key Responsibilities
- Required Skills / Qualifications
- Preferred Skills
- Requirements
- Keywords
**Check:**
- Verify section exists
- Check if section has any real content (not just placeholders)
- Check if at least one subsection has meaningful text
**If incomplete:**
- Flag: `Job Description Summary: No content found`
- Or: `Responsibilities: Contains placeholder "[exact-text]"`
- Or: `Required Skills: Missing or empty`
### Missing Sections
If an entire required section is missing from the document:
- Flag: `Missing required section: [Section Name]`
## Step 6: Check Population Status
### Input Folder Check
**Check if `input/` folder exists and has files:**
1. Check for `input/` subfolder in the application directory
2. List files in `input/` folder
3. Count supported files (exclude .gitkeep, .DS_Store, etc.)
**Categorize status:**
- **Empty**: `input/` doesn't exist or has no files (0 files)
- **Populated**: `input/` has 1+ files
- **Not applicable**: Required sections are filled (manual population is fine)
### Population Warning Logic
**Warn about population IF:**
- Input folder is empty (0 files) AND
- Multiple required sections still have placeholders
**Suggest /populate-application IF:**
- Input folder has files (1+ files) AND
- Multiple required sections still have placeholders
**DON'T warn IF:**
- Required sections are filled with real content (manual population is fine, even if input/ is empty)
## Step 7: Generate Validation Report
### Success Format (Validation PASSES)
**If all required sections are complete:**
```
✅ Application Validation: PASSED
Your application is complete and ready for document generation!
Summary:
- Organization: [Extracted Company Name]
- Position: [Extracted Job Title]
- Job requirements: [N] identified
- Input documents: [N] files in input/ folder
[If Match Strategy section has content:]
- Match strategy: Complete
[If Key Messages section has content:]
- Key messages: Defined
You can now proceed with generating tailored CV, cover letter, and application email.
```
**Extract actual values** from application.md for the summary (organization name, position, count requirements/skills mentioned).
### Failure Format (Validation FAILS)
**If any required section is incomplete:**
```
❌ Application Validation: FAILED
Your application has incomplete sections that need attention before document generation.
Issues found:
[Group errors by section - only show sections with errors]
## Organization Information
- [ ] Organization Name: Contains placeholder "[To be filled]"
## Job Information
- [ ] Job Title: Missing or empty
## Job Description Summary
- [ ] Responsibilities: Contains placeholder "[List key responsibilities]"
- [ ] Required Skills: No content found
[If population warning applies:]
## Population Status
⚠️ Input folder appears empty. Consider:
1. Adding job posting and related documents to input/
2. Running /populate-application to extract information
[Or if input has files but sections empty:]
## Population Status
⚠️ Input folder has [N] documents but application seems unpopulated.
Consider running:
/populate-application
This will analyze your input documents and populate the sections above.
[End with guidance:]
Please update application.md to fill in these sections, then run /validate-application again.
[Alternative if only placeholders:]
Or manually edit application.md to add the missing information, then run /validate-application again.
```
### Error Details Format
**For each issue, use checkbox format:**
```
- [ ] Field Name: Issue description
```
**Quote exact placeholder text:**
```
- [ ] Organization Name: Contains placeholder "[To be filled]"
```
**Group by section:**
```
## Organization Information
- [ ] Organization Name: Issue
- [ ] Location: Issue
## Job Description Summary
- [ ] Responsibilities: Issue
```
## Step 8: Provide Clear Next Steps
### After Success
```
You can now proceed with generating tailored CV, cover letter, and application email.
```
### After Failure
```
Please update application.md to fill in these sections, then run /validate-application again.
```
Or if they should run population:
```
Add documents to input/ folder and run /populate-application to analyze and populate application.md.
Then run /validate-application again to confirm completeness.
```
## Important Notes
### Tone
- Be encouraging - validation is a positive quality check
- Be specific about what's missing
- Provide actionable guidance
- Don't be judgmental about incomplete applications
### Flexibility
- Optional sections can remain incomplete
- Manual population is perfectly fine (don't require /populate-application if sections are filled)
- Input folder can be empty if user manually populated
- Focus on required information only
### Accuracy
- Quote exact placeholder text when reporting issues
- Extract real values from application.md for success summary
- Count actual items (requirements, skills, documents)
- Be precise about what's missing vs what's present
### Integration
- This is a quality gate before document generation
- Match the pattern of `/validate-profile` for consistency
- User can explicitly skip validation if they want (with warning)
- Default behavior: validate before generating any documents
## Edge Cases
### Legitimate Brackets
- `[PhD]` or `[MBA]` in credentials → not a placeholder
- `[Remote]` as location descriptor → not a placeholder
- `[Acquired]` in company history → not a placeholder
- Check surrounding context to distinguish
### Partial Completion
- If Organization Name is filled but Job Title has placeholder → only flag Job Title
- If some job description subsections are filled → validation can pass
- Don't require ALL subsections, just SOME content
### Very Long Placeholders
- Truncate to 100 characters: `"[First 100 characters...]"`
- Still quote them to show what was found
### Multiple Issues in Same Field
- List each issue separately
- Be clear about what specifically is wrong
### Application Already Has Some Content
- Focus error messages only on what's still missing
- Acknowledge what's already complete in summary (if desired)
- Be constructive about gaps
+24 -3
View File
@@ -187,14 +187,21 @@ When helping with job applications, follow this comprehensive workflow:
- Adjust which experiences and projects to emphasize
- Fine-tune key messages and tone
### 5. Content Generation (FUTURE)
### 5. Validate Application (NEW - Quality Gate)
- Run `/validate-application` to ensure application.md is complete
- Check that required sections are filled (Organization, Job Title, Job Description)
- Verify no placeholder text remains (like `[To be filled]`)
- Get warnings if input/ folder is empty or application seems unpopulated
- **Must pass before document generation**
### 6. Content Generation (FUTURE)
- Generate CV/cover letter/email based on `application.md` strategy
- Emphasize relevant experience from `profile.md`
- Incorporate keywords from the job description naturally
- Maintain factual accuracy - use only verified information from `profile.md`
- **Note**: Document generation will be implemented in a future update
### 6. Quality Assurance
### 7. Quality Assurance
- Verify all company names, dates, and facts are correct
- Ensure consistency between all documents (CV ↔ cover letter ↔ email)
- Check that tone matches the target company culture
@@ -255,6 +262,7 @@ Adjust recommendations based on the target market if the user specifies a differ
- `/validate-profile` - Validate that `profile.md` is complete and ready for application generation
- `/new-application "Company - Job Title"` - Create a new application workspace with organized folder structure
- `/populate-application` - Analyze input documents and populate application.md with job info, research, and strategy
- `/validate-application [optional-app-name]` - Validate that application.md is complete before document generation
## Example Usage
@@ -268,7 +276,9 @@ Adjust recommendations based on the target market if the user specifies a differ
3. After application is created, guide user: "Add the job posting and any other documents to `applications/pending/[folder]/input/`"
4. When user has added documents: "Navigate to the application folder and run `/populate-application`"
5. After population completes: "Review `application.md` to see the analysis and strategy"
6. Future: Generate tailored CV, cover letter, and email based on `application.md`
6. Validation step: "Run `/validate-application` to ensure the application is complete"
7. If validation passes: Ready for document generation
8. Future: Generate tailored CV, cover letter, and email based on `application.md`
### Example 2: Quick Document Request (Legacy Flow)
@@ -283,6 +293,17 @@ Adjust recommendations based on the target market if the user specifies a differ
6. Generate tailored cover letter using only information from `profile.md`
7. Suggest: "For better organization, consider using `/new-application` next time to manage the full application process"
### Example 3: Validating an Application
**User**: "Check if my TechCorp application is ready"
**Claude Code should**:
1. If user is in application folder: Run `/validate-application` (auto-detects current location)
2. If user is elsewhere: Run `/validate-application 2025-11-02-TechCorp-Software-Engineer`
3. If validation passes (✅): "Your application is complete! Organization: TechCorp, Position: Software Engineer. Ready for document generation."
4. If validation fails (❌): Show specific issues like "Organization Name: Contains placeholder '[To be filled]'" and suggest "Please update application.md or run `/populate-application` if you have documents in input/"
5. Provide clear next steps based on validation result
## Updating the Profile
If you notice missing or outdated information during application preparation: