// prompts.js — All AI prompts v3 // LANGUAGE RULES: Analysis = match job language. Everything else = ENGLISH ALWAYS. function buildPromptV2(tab, job, userProfile, language) { // Only analysis follows job language; rest is always English const analysisLang = language === 'arabic' ? 'Respond entirely in Arabic.' : language === 'english' ? 'Respond entirely in English.' : 'Respond in the same language as the job posting.'; const ctx = [ 'Job Title: ' + (job.jobTitle || 'Not specified'), 'Company: ' + (job.company || 'Not specified'), 'Location: ' + (job.location || 'Not specified'), 'Type: ' + (job.jobType || 'Not specified'), 'Description:\n' + (job.description || 'No description available'), job.skills.length ? 'Required Skills: ' + job.skills.join(', ') : '' ].filter(Boolean).join('\n'); const prof = 'MY PROFESSIONAL PROFILE:\n' + userProfile; const co = job.company || 'this company'; const loc = job.location || 'Middle East'; const P = {}; P.analysis = `You are an elite career strategist. ${analysisLang} Evaluate this job against my profile with brutal honesty and EXTREME brevity. DO NOT recount my history, military background, or summarize my profile. Keep it actionable and short. CRITICAL RULE: The user is actively seeking to step down from Architect/CTO roles to "Senior Software Engineer" (Flutter, Backend, Full Stack) to gain corporate Agile experience. DO NOT reject jobs for being a "downgrade" if they are Senior level and match his tech stack (Flutter, Python, PHP, Node). ${prof} JOB POSTING: ${ctx} Respond in this EXACT concise structure: ## 🎯 VERDICT: [YES - APPLY / NO - SKIP] [One short sentence explaining why] ## ✅ WHY IT FITS (If Yes) - [Bullet point 1] - [Bullet point 2] - [Bullet point 3] ## ❌ WHY IT MIGHT NOT FIT (If No or Maybe) - [Bullet point 1 - e.g. location, specific missing skill] - [Bullet point 2] ## 📝 CV TWEAKS (If Yes) - [What to emphasize in the CV] - [What to de-emphasize]`; P.coverletter = `You are an expert career writer. Write a COMPLETE, READY-TO-SEND cover letter. IMPORTANT: Write ENTIRELY in English regardless of the job posting language. ${prof} JOB: ${ctx} FORMAT — follow EXACTLY: Dear ${co} Team, [PARAGRAPH 1 — HOOK (3 sentences max): Compelling connection between my background and this role. Mention the company by name. NO generic "I am writing to apply" openers.] [PARAGRAPH 2 — PROOF (4-5 sentences): Match 3-4 job requirements to my REAL achievements with NUMBERS. Use "At Intaleq, I..." or "When building Tripz, I..." Be concrete.] [PARAGRAPH 3 — CLOSE (2-3 sentences): Enthusiasm for THIS company. Confident call to action requesting an interview.] Best regards, Hamza Ayed hamzaayed@tripz-egypt.com +962 79 858 3052 CRITICAL RULES: - MUST be in English - NO brackets or placeholders — use ACTUAL names and data - Every sentence specific to THIS job at ${co} - Under 300 words total`; P.cvtips = `You are a LinkedIn optimization expert and ATS specialist. IMPORTANT: Respond ENTIRELY in English regardless of the job posting language. ${prof} JOB: ${ctx} Respond EXACTLY: ## LINKEDIN HEADLINE [One headline, max 120 chars, ATS-optimized for this role] ## PROFESSIONAL SUMMARY [3-4 sentences tailored summary ready to paste — in English] ## ATS KEYWORDS TO ADD - [10-15 specific keywords from this job that MUST appear in CV] ## EXPERIENCE TO LEAD WITH - [Which role first and which 3-4 bullet points to highlight] ## REMOVE OR MINIMIZE - [What to de-emphasize for this application] ## SKILLS SECTION (priority order) 1. [Most important skill] 2. [Second] 3. [Continue 8-10 skills] ## NEW BULLET POINTS TO ADD - [2-3 new achievement bullets ready to paste into CV — in English]`; const dynamicQuestions = job.questions && job.questions.length > 0 ? job.questions.map((q, i) => `${i + 1}. "${q.question}" [type: ${q.type}]`).join('\n') : '1. "Why are you interested in this role?" [type: text]\n2. "What is your relevant experience?" [type: text]\n3. "What are your salary expectations?" [type: text]\n4. "When can you start?" [type: text]\n5. "Do you require visa sponsorship?" [type: text]'; P.qa = `You are a form-filling assistant. Your ONLY job is to answer application form questions. STRICT RULES: - Return ONLY a raw JSON object. Nothing else. - Do NOT write cover letters, introductions, paragraphs, or markdown. - Do NOT use headers like "###" or "##". - Do NOT use code blocks like \`\`\`json. - For number/numeric questions: answer with JUST a number (e.g. "6"). - For yes/no or select questions: answer with JUST "Yes" or "No". - For salary questions: answer with JUST a number (e.g. "25000"). - For text questions: answer in 1 short sentence max. - Keys must be the EXACT question text. MY PROFILE: ${userProfile} JOB: ${ctx} QUESTIONS TO ANSWER: ${dynamicQuestions} RESPOND WITH ONLY THIS FORMAT (raw JSON, no wrapping): { "exact question text here": "concise answer", "another question": "answer" }`; P.benefits = `You are a career analyst specializing in tech compensation in MENA. IMPORTANT: Respond ENTIRELY in English regardless of the job posting language. ${prof} JOB: ${ctx} Respond EXACTLY: ## COMPENSATION ESTIMATE - **Mentioned salary:** [exact text or "Not disclosed"] - **Market estimate:** [realistic range in USD based on role, seniority, location] - **Benefits listed:** [bonuses, equity, insurance] ## WORK SETUP - **Type:** [Remote / Hybrid / On-site] - **Location:** [where + relocation support] ## CAREER VALUE - **Growth potential:** [what this leads to in 2-3 years] - **Skills I will gain:** [new skills/tech] - **Resume value:** [how it improves my CV] ## WHAT IS ATTRACTIVE - [3-5 appealing aspects for MY profile] ## RED FLAGS - [Concerning requirements or red flags] ## OVERALL RATING: X/10 **Worth applying?** [YES / MAYBE / NO] [2-3 sentence honest assessment]`; P.list_analysis = `You are an AI pre-screening jobs. I will give you a JSON array of jobs (Title, Company). My stack: Flutter, Python (FastAPI), PHP, Node.js, GIS, Technical Architect. I am actively seeking Senior Engineer, Tech Lead, or Architect roles. Reject Java, C#, C++, .NET, or pure Product Management roles. JOBS LIST: ${job.listData} Respond ONLY with a raw JSON array of objects, one for each job, containing: [ { "index": number, "verdict": "YES" | "NO" | "MAYBE", "reason": "Short reason" } ] Do not wrap in markdown \`\`\`json blocks.`; return P[tab] || P.analysis; }