Skip to content

Commit 578f585

Browse files
Merge pull request #24 from javiera-vasquez/feature/improve-tailor-server-inner-functionality
feat: Implement section registry system and enhance template architecture
2 parents d17ee18 + 5c2bd98 commit 578f585

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2972
-1149
lines changed

.claude/agents/job-tailor.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ This sub-agent specializes in analyzing job applications and creating tailored r
5656
- Technical expertise must include `resume_title` and prioritized `skills` arrays (max 4 categories)
5757
- Flatten soft skills into single array (max 12 skills)
5858
- Generate metadata.yaml from job_analysis using transformation rules in `resume-data/mapping-rules/metadata.yaml`
59-
- Metadata must include all required fields: company, folder_path, available_files, position, primary_focus, job_summary, job_details (nested), last_updated
59+
- Metadata must include all required fields: company, folder_path, available_files, position, primary_focus, job_summary, job_details (nested), active_template, last_updated
6060
- Format job_details with: company, location, experience_level, employment_type, must_have_skills (top 5), nice_to_have_skills, team_context, user_scale
6161
- Job summary must be concise (max 100 characters)
6262
- Preserve data integrity - no fabricated content, only selection and emphasis
@@ -176,6 +176,7 @@ job_details:
176176
nice_to_have_skills: ['Vector databases', 'AWS', 'Docker']
177177
team_context: 'AI team of 50+ engineers, cross-functional collaboration'
178178
user_scale: '10 million users globally'
179+
active_template: 'modern'
179180
last_updated: '2025-09-30T12:00:00Z'
180181
```
181182
@@ -269,7 +270,7 @@ job_analysis:
269270

270271
**Metadata** (from `resume-data/mapping-rules/metadata.yaml`):
271272

272-
- **Required Fields**: company, folder_path, available_files, position, primary_focus, job_summary, job_details, last_updated
273+
- **Required Fields**: company, folder_path, available_files, position, primary_focus, job_summary, job_details, active_template, last_updated
273274
- **Job Summary**: Max 100 characters
274275
- **Must-Have Skills in job_details**: Max 5 items (top priority from job_analysis)
275276
- **Nice-to-Have Skills in job_details**: Max 5 items

.claude/agents/tailor-generate-assets.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,14 @@ resume:
218218
independent_projects: # Projects scored by technology relevance
219219
- name: 'AI Chat Application'
220220
description: 'React/TypeScript chat app with GPT integration'
221-
technologies: ['React', 'TypeScript', 'LangChain', 'GPT-4']
222221
url: 'https://github.com/johndoe/ai-chat'
222+
achievements:
223+
- 'Built with React, TypeScript, LangChain, and GPT-4'
224+
- 'Implemented real-time chat with AI-powered responses'
223225

224226
education:
225227
- institution: 'Stanford University'
226-
degree: 'BS Computer Science'
228+
program: 'BS Computer Science'
227229
location: 'Stanford, CA'
228230
duration: '2010 - 2014'
229231
```
@@ -235,6 +237,7 @@ version: '2.0.0'
235237
analysis_date: '2025-09-19'
236238

237239
cover_letter:
240+
name: 'John Doe' # Top-level required field
238241
company: 'TechCorp' # From metadata
239242
position: 'Senior AI Engineer' # From metadata
240243
job_focus: # REQUIRED: copied from job_analysis.yaml
@@ -248,7 +251,6 @@ cover_letter:
248251
date: '2025-09-30'
249252

250253
personal_info:
251-
name: 'John Doe'
252254
address: '456 Innovation Drive, San Francisco, CA'
253255
email: 'john.doe@example.com'
254256
phone: '+1 (555) 555-5555'
@@ -282,6 +284,7 @@ cover_letter:
282284
- job_focus array is REQUIRED (copy from job_analysis.yaml)
283285
- job_focus weights must sum to 1.0
284286
- Body must be array of strings (200-400 words total)
285-
- Required fields: company, position, job_focus, primary_focus, date, personal_info, content
287+
- Required fields: name, company, date, personal_info, content
288+
- Optional fields: position, job_focus, primary_focus
286289
287290
When you receive a company name, first validate prerequisites exist, load all required data, apply specialty-based scoring for content selection, transform data following mapping rules, generate both files, **validate both files and fix any errors**, and ensure all content is truthful and optimized for the specific job requirements.

.claude/commands/tailor.md

Lines changed: 150 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
---
2-
allowed-tools: Bash(bun run set-env), SlashCommand, BashOutput
2+
allowed-tools: Bash(bun run set-env), BashOutput
33
description: Set CC in /tailor mode, Ask claude for changes and improvements to the application assets | argument-hint company-name
44
---
55

6-
# Tailor Company Context Command
6+
# Tailor Mode - Collaborative Resume & Cover Letter Editing
77

8-
Set the active company context for tailored resume operations and start the development server with automatic validation and hot reload.
8+
This command activates **tailor mode**, where you (Claude) become the user's active collaborator for refining and improving their resume and cover letter for a specific company.
9+
10+
**Your role in tailor mode:**
11+
12+
- Be a proactive editor and writing coach
13+
- Suggest improvements to content, tone, and **structure**
14+
- Implement changes directly to YAML files based on user feedback
15+
- Ensure all edits align with the job posting requirements
16+
- Validate changes in real-time and fix any issues immediately
17+
18+
The technical infrastructure (server, file watching, validation) runs in the background to support this collaborative editing workflow.
919

1020
## Usage
1121

@@ -18,41 +28,53 @@ Set the active company context for tailored resume operations and start the deve
1828
### 1. User Invokes Command
1929

2030
```
21-
/tailor tech-corp
31+
/tailor company-name
2232
```
2333

2434
### 2. Claude Sets Context
2535

26-
Runs `bun run set-env -C tech-corp`:
36+
Runs `bun run set-env -C company-name`:
2737

28-
- Validates company folder exists at `resume-data/tailor/tech-corp/`
38+
- Validates company folder exists at `resume-data/tailor/company-name/`
2939
- Validates required files (`metadata.yaml`, `job_analysis.yaml`)
3040
- Updates `.claude/tailor-context.yaml` automatically
31-
- Returns structured JSON with company details
41+
- Returns formatted output with company context details
3242

3343
**Exit codes:**
3444

3545
- `0` = Success → Continue to step 3
3646
- `1` = Failure → Display error and stop
3747

48+
**Example output:**
49+
50+
```
51+
[10:00:00] [set-env] ✅ Context set • Tech-Corp • 4 file(s)
52+
[10:00:00] [set-env] -Path: resume-data/tailor/tech-corp
53+
[10:00:00] [set-env] -Position: Senior Frontend Engineer - Web
54+
[10:00:00] [set-env] -Focus: senior_engineer + [react, typescript, frontend]
55+
[10:00:00] [set-env] -Files: metadata.yaml, job_analysis.yaml, resume.yaml, cover_letter.yaml
56+
[10:00:00] [set-env] 🚀 All good, please start the tailor-server
57+
```
58+
3859
### 3. Claude Starts Development Server
3960

40-
Invokes `/tailor-server` slash command:
61+
Runs `bun run tailor-server`:
4162

4263
- Starts file watcher monitoring `resume-data/tailor/`
4364
- Enables automatic data regeneration on file changes
4465
- Launches browser preview with hot reload
4566
- Provides real-time validation feedback
4667

47-
### 4. Claude Displays Context Summary
68+
**Note:** After starting the server, only check one the `🚀 Tailor server ready` log to confirm startup. Vite and Bun handle the HTTP server automatically in the background no need to wait for additional Vite startup logs.
69+
70+
### 4. Claude Confirms Server is Running
71+
72+
After seeing the "Tailor server ready" log, Claude should confirm the setup:
4873

4974
```
50-
✅ Active company context: company-name
51-
📁 Path: resume-data/tailor/[company-name]
52-
📄 Files: metadata.yaml, job_analysis.yaml, resume.yaml, cover_letter.yaml
53-
🎯 Position: actual possition described on publication
54-
🔧 Focus: main roll + [top 3 skill to have]
55-
🌐 Dev server: http://localhost:3000
75+
✅ Tailor mode active for [company-name]
76+
🌐 Dev server running at http://localhost:3000
77+
📁 Watching: resume-data/tailor/[company-name]
5678
5779
What would you like to work on? I can help you with:
5880
• Refine resume summary or professional experience
@@ -85,53 +107,90 @@ Claude edits files in `resume-data/tailor/tech-corp/`:
85107
- `job_analysis.yaml` - Job requirements analysis
86108
- `metadata.yaml` - Company/position details
87109

88-
### Step 3: System Auto-Validates
110+
### Step 3: System Auto-Validates (with Debouncing)
111+
112+
File watcher triggers automatic pipeline after 300ms of inactivity:
113+
114+
Pipeline: File change(s) → Debounce delay → YAML parsing → Zod schema validation → TypeScript generation → Hot reload
89115

90-
File watcher triggers automatic pipeline:
116+
**Key insight:** Multiple rapid edits are batched together automatically, so you don't need to wait between small changes - just make all related edits and the system will validate once.
117+
118+
### Step 4: Smart Validation Checking
119+
120+
Use `BashOutput` strategically based on edit risk level:
121+
122+
**High-risk edits (ALWAYS check):**
123+
124+
- Structural changes (adding/removing sections, changing schema fields)
125+
- First edit after entering tailor mode
126+
- User explicitly asks "did that work?" or mentions seeing errors
127+
- Batch of multiple significant changes
128+
129+
**Low-risk edits (Trust the system):**
130+
131+
- Text refinements (rewording, improving clarity)
132+
- Typo fixes and grammar improvements
133+
- Changing metrics or dates
134+
- Single-field updates (e.g., updating one job description)
135+
136+
**How to check:** Use `BashOutput` to read the tailor-server logs. Look for:
137+
138+
- `✅ [filename] → Regenerated (X.Xs)` = Success, continue
139+
- `❌ [filename] → Failed (X.Xs)` = Error occurred, must fix immediately
140+
141+
**Example failure output:**
91142

92143
```
93-
[file-watcher] Tailor data changed: tech-corp/resume.yaml
94-
[tailor-server] 🔄 Regenerating data for company: tech-corp
95-
[generate-data] Validating application data
144+
❌ resume.yaml → Failed (0.1s)
145+
[10:24:34] [generate-data] Application data validation failed:
146+
[10:24:34] [generate-data] • resume.name: Required (received: undefined)
147+
[10:24:34] [generate-data] → in resume-data/tailor/tech-corp/resume.yaml
148+
💡 Fix the errors above and save to retry
96149
```
97150

98-
Pipeline: File change → YAML parsing → Zod schema validation → TypeScript generation → Hot reload
151+
### Step 5: Communicate Like a Collaborative Editor
99152

100-
### Step 4: Claude Checks Validation Result
153+
**Don't just execute - collaborate:**
101154

102-
**CRITICAL:** After each edit, Claude MUST use `BashOutput` to check server logs.
103-
104-
**Success path:**
155+
**Robot mode:**
105156

106157
```
107-
[generate-data] ✅ Application data validation passed
108-
[generate-data] Writing TypeScript module to src/data/application.ts
109-
[tailor-server] ✅ Data regenerated successfully
110-
[tailor-server] Hot reload will pick up changes automatically
158+
"I've updated the resume summary. Done."
111159
```
112160

113-
**Failure path:**
161+
**Collaborative mode:**
114162

115163
```
116-
[tailor-server] Application data validation failed:
117-
[tailor-server] • resume.contact: Required (received: undefined)
118-
[tailor-server] → in resume-data/tailor/tech-corp/resume.yaml
119-
[tailor-server] 💡 Fix the data issues and try again
164+
"I'm thinking we should emphasize your React expertise more prominently since
165+
it's mentioned 5 times in the job posting. Here's what I'm changing:
166+
167+
Before: 'Frontend engineer with experience in modern web technologies'
168+
After: 'React specialist with 10+ years building scalable web applications'
169+
170+
This directly addresses their requirement for 'Expert-level React skills'.
171+
What do you think?"
120172
```
121173

122-
### Step 5: Claude Responds Based on Result
174+
**Guidelines for communication:**
175+
176+
- **Explain your reasoning** - Why are you making this change?
177+
- **Show before/after** - Let them see what you're modifying
178+
- **Ask for input** - "Does this capture your experience accurately?"
179+
- **Be proactive** - Suggest improvements, don't just wait for requests
180+
- **Reference the job posting** - Connect changes to requirements
181+
- **Offer alternatives** - "We could also phrase it as..."
123182

124-
**If validation passes:**
183+
**After successful edits:**
125184

126-
- Confirm changes to user
127-
- Mention browser preview has updated
128-
- Proceed with next task or await further instructions
185+
- Confirm changes briefly: "Updated! The preview should refresh in a moment."
186+
- Ask: "Want to tackle another section, or shall we review what we've done?"
187+
- Suggest next steps: "The summary looks great now. Should we strengthen the experience section?"
129188

130-
**If validation fails:**
189+
**When validation fails:**
131190

132-
- Fix the validation error immediately
133-
- Re-check logs with `BashOutput`
134-
- Verify fix was successful before responding to user
191+
- Fix immediately and transparently: "Oops, I made a syntax error. Fixing that now..."
192+
- Don't mention technical details unless relevant
193+
- Re-verify the fix before responding
135194

136195
## Company Folder Structure
137196

@@ -143,6 +202,54 @@ resume-data/tailor/company-name/
143202
└── cover_letter.yaml # Tailored cover letter content
144203
```
145204

205+
## Template Manipulation (Advanced)
206+
207+
Claude can perform three specific template-level modifications:
208+
209+
### 1. Switch Active Template
210+
211+
Change `active_template` in the company's `metadata.yaml` file (e.g., `resume-data/tailor/tech-corp/metadata.yaml`):
212+
213+
- `modern` - Two-column layout, accent colors
214+
- `classic` - Single-column, monochrome
215+
216+
**Always check BashOutput after template switches.**
217+
218+
### 2. Add/Remove/Modify Sections
219+
220+
Edit section content in `resume.yaml` and `job_analysis.yaml`:
221+
222+
- Add/remove entries in `professional_experience`, `independent_projects`, `education`, etc.
223+
- Modify `job_analysis` sections: `requirements`, `responsibilities`, `candidate_alignment`, etc.
224+
225+
**Risk levels:**
226+
227+
- Low: Adding items within existing sections
228+
- High: Adding/removing top-level sections (always check BashOutput)
229+
230+
### 3. Change Section Order
231+
232+
Modify `order` property in `src/templates/{classic|modern}/section-registry.ts`:
233+
234+
```typescript
235+
// Lower numbers render first (10 before 20)
236+
{ id: 'education', order: 20 }, // Changed from 30 to appear earlier
237+
{ id: 'summary', order: 30 }, // Changed from 20 to appear later
238+
```
239+
240+
**Always check BashOutput and browser preview after order changes.**
241+
242+
**Files you can modify:**
243+
244+
-`metadata.yaml` (active_template)
245+
-`resume.yaml` / `job_analysis.yaml` (sections)
246+
-`src/templates/{template}/section-registry.ts` (order only)
247+
248+
**Files you cannot modify:**
249+
250+
-`.claude/tailor-context.yaml` (auto-generated, edit metadata.yaml instead)
251+
- ❌ Template components, shared utilities, source YAML, schemas
252+
146253
## Why Validation Matters
147254

148255
- **PDF generation** depends on valid TypeScript data module

.claude/tailor-context.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Auto-generated by /tailor command
2-
# Last updated: 2025-10-09T12:01:57.159Z
2+
# Last updated: 2025-10-15T16:49:51.673Z
33
# Active company: tech-corp
44
active_company: tech-corp
55
company: Tech-Corp
@@ -31,4 +31,4 @@ job_details:
3131
- Scala
3232
team_context: 500+ people in product organization, cross-functional teams
3333
user_scale: 20 million users globally across 500 cities in 30 countries
34-
last_updated: '2025-10-09T12:01:57.159Z'
34+
last_updated: '2025-10-15T16:49:51.673Z'

.env.example

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@ LOG_TIMESTAMPS=true
2222
# Only applies to 'human' format. Set to 'false' for cleaner terminal output
2323
LOG_EMOJI=true
2424

25+
# =============================================================================
26+
# File Watcher Configuration
27+
# =============================================================================
28+
29+
# Debounce delay for file watcher (milliseconds)
30+
# Prevents multiple rapid regenerations when saving multiple YAML files
31+
# - Set to 300 (default): Wait 300ms after last change before regenerating
32+
# - Set to 0: Process every change immediately (disables debouncing)
33+
# - Increase to 500-1000: Useful if you frequently save many files at once
34+
FILE_WATCH_DEBOUNCE_MS=300
35+
36+
# Compact logging mode for tailor-server
37+
# Reduces log output to minimal essential information
38+
# - Set to 'false' (default): Show all detailed logs (recommended for development)
39+
# - Set to 'true': Show only startup message and regeneration results
40+
# Compact mode output example:
41+
# 🚀 Tailor server ready • Watching: tech-corp • Debounce: 300ms
42+
# ✅ metadata.yaml → Regenerated (1.2s)
43+
# ❌ resume.yaml → Failed (validation error details shown)
44+
TAILOR_SERVER_COMPACT_LOGS=true
45+
2546
# =============================================================================
2647
# Usage Examples
2748
# =============================================================================
@@ -38,4 +59,13 @@ LOG_EMOJI=true
3859
# Production (JSON, warnings only):
3960
# LOG_FORMAT=json LOG_LEVEL=warn bun run start
4061
#
62+
# Disable file watcher debouncing:
63+
# FILE_WATCH_DEBOUNCE_MS=0 bun run tailor-server
64+
#
65+
# Increase debounce for batch edits:
66+
# FILE_WATCH_DEBOUNCE_MS=1000 bun run tailor-server
67+
#
68+
# Compact mode (minimal logging):
69+
# TAILOR_SERVER_COMPACT_LOGS=true bun run tailor-server
70+
#
4171
# =============================================================================

0 commit comments

Comments
 (0)