Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Refactor resume review workflow

Khuram Niaz9782f8357c88
diff --git a/package-lock.json b/package-lock.json
index 5bb5b72..358db9d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,7 @@
"@nivo/calendar": "^0.99.0",
"@nivo/core": "^0.99.0",
"@prisma/client": "^6.19.0",
+ "@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "^1.1.3",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-dialog": "^1.1.3",
@@ -2544,6 +2545,37 @@
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
"license": "MIT"
},
+ "node_modules/@radix-ui/react-accordion": {
+ "version": "1.2.12",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-accordion/-/react-accordion-1.2.12.tgz",
+ "integrity": "sha512-T4nygeh9YE9dLRPhAHSeOZi7HBXo+0kYIPJXayZfvWOWA0+n3dESrZbjfDPUABkUNym6Hd+f2IR113To8D2GPA==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/primitive": "1.1.3",
+ "@radix-ui/react-collapsible": "1.1.12",
+ "@radix-ui/react-collection": "1.1.7",
+ "@radix-ui/react-compose-refs": "1.1.2",
+ "@radix-ui/react-context": "1.1.2",
+ "@radix-ui/react-direction": "1.1.1",
+ "@radix-ui/react-id": "1.1.1",
+ "@radix-ui/react-primitive": "2.1.3",
+ "@radix-ui/react-use-controllable-state": "1.2.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-alert-dialog": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/@radix-ui/react-alert-dialog/-/react-alert-dialog-1.1.15.tgz",
@@ -2678,6 +2710,36 @@
}
}
},
+ "node_modules/@radix-ui/react-collapsible": {
+ "version": "1.1.12",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.1.12.tgz",
+ "integrity": "sha512-Uu+mSh4agx2ib1uIGPP4/CKNULyajb3p92LsVXmH2EHVMTfZWpll88XJ0j4W0z3f8NK1eYl1+Mf/szHPmcHzyA==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/primitive": "1.1.3",
+ "@radix-ui/react-compose-refs": "1.1.2",
+ "@radix-ui/react-context": "1.1.2",
+ "@radix-ui/react-id": "1.1.1",
+ "@radix-ui/react-presence": "1.1.5",
+ "@radix-ui/react-primitive": "2.1.3",
+ "@radix-ui/react-use-controllable-state": "1.2.2",
+ "@radix-ui/react-use-layout-effect": "1.1.1"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-collection": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.7.tgz",
diff --git a/package.json b/package.json
index 0cfdc68..2f74c02 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"@nivo/calendar": "^0.99.0",
"@nivo/core": "^0.99.0",
"@prisma/client": "^6.19.0",
+ "@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "^1.1.3",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-dialog": "^1.1.3",
diff --git a/src/app/api/ai/resume/review/route.ts b/src/app/api/ai/resume/review/route.ts
index 7c426e7..e056dfe 100644
--- a/src/app/api/ai/resume/review/route.ts
+++ b/src/app/api/ai/resume/review/route.ts
@@ -9,10 +9,6 @@ import {
ResumeReviewSchema,
RESUME_REVIEW_SYSTEM_PROMPT,
buildResumeReviewPrompt,
- extractSemanticKeywords,
- analyzeActionVerbs,
- getKeywordCountFromSemantic,
- getVerbCountFromSemantic,
AIUnavailableError,
preprocessResume,
} from "@/lib/ai";
@@ -21,6 +17,7 @@ import { AiModel } from "@/models/ai.model";
/**
* Resume Review Endpoint
+ * Single comprehensive LLM call for complete resume analysis
*/
export const POST = async (req: NextRequest) => {
const session = await auth();
@@ -59,55 +56,28 @@ export const POST = async (req: NextRequest) => {
const preprocessResult = await preprocessResume(resume);
if (!preprocessResult.success) {
return NextResponse.json(
- { error: preprocessResult.error.message, code: preprocessResult.error.code },
+ {
+ error: preprocessResult.error.message,
+ code: preprocessResult.error.code,
+ },
{ status: 400 },
);
}
- const { normalizedText, metadata } = preprocessResult.data;
-
- // Use semantic extraction for keywords and verbs
- const [semanticKeywords, semanticVerbs] = await Promise.all([
- extractSemanticKeywords(
- normalizedText,
- selectedModel.provider,
- selectedModel.model || "llama3.2",
- ),
- analyzeActionVerbs(
- normalizedText,
- selectedModel.provider,
- selectedModel.model || "llama3.2",
- ),
- ]);
-
- const keywordCount = getKeywordCountFromSemantic(semanticKeywords);
- const verbCount = getVerbCountFromSemantic(semanticVerbs);
- const allKeywords = [
- ...semanticKeywords.technical_skills,
- ...semanticKeywords.tools_platforms,
- ];
- const allVerbs = semanticVerbs.strong_verbs.map((v) => v.verb);
-
- const basePrompt = buildResumeReviewPrompt(normalizedText);
- const fullPrompt = `${basePrompt}
-
-TOOL ANALYSIS RESULTS (use these in your evaluation):
-- Technical keywords found: ${keywordCount} (${allKeywords.slice(0, 10).join(", ") || "none"})
-- Action verbs found: ${verbCount} (${allVerbs.slice(0, 10).join(", ") || "none"})
-
-Use these concrete counts in your Step 1 (SCAN & COUNT) and scoring decisions.`;
+ const { normalizedText } = preprocessResult.data;
const model = getModel(
selectedModel.provider,
selectedModel.model || "llama3.2",
);
+ // Single comprehensive LLM call
const result = streamText({
model,
output: Output.object({
schema: ResumeReviewSchema,
}),
system: RESUME_REVIEW_SYSTEM_PROMPT,
- prompt: fullPrompt,
+ prompt: buildResumeReviewPrompt(normalizedText),
temperature: 0.3,
});
diff --git a/src/components/profile/AiResumeReviewResponseContent.tsx b/src/components/profile/AiResumeReviewResponseContent.tsx
index a65eec8..2e02f5c 100644
--- a/src/components/profile/AiResumeReviewResponseContent.tsx
+++ b/src/components/profile/AiResumeReviewResponseContent.tsx
@@ -2,25 +2,458 @@ import { RadialChartComponent } from "../RadialChart";
import { SheetDescription } from "../ui/sheet";
import { ResumeReviewResponse } from "@/models/ai.model";
import type { DeepPartial } from "ai";
+import { Badge } from "../ui/badge";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "../ui/accordion";
+import { CheckCircle, XCircle, AlertTriangle, ArrowRight } from "lucide-react";
-const Section = ({
- title,
- items,
+// SECTION COMPONENTS
+
+const ScoresSection = ({
+ scores,
}: {
- title: string;
- items?: (string | undefined)[];
+ scores?: DeepPartial<ResumeReviewResponse["scores"]>;
}) => {
- if (!items || items.length === 0) return null;
+ if (!scores) return null;
+
+ const scoreItems = [
+ { label: "Overall", value: scores.overall, color: "bg-blue-500" },
+ { label: "Impact", value: scores.impact, color: "bg-green-500" },
+ { label: "Clarity", value: scores.clarity, color: "bg-purple-500" },
+ { label: "ATS", value: scores.atsCompatibility, color: "bg-orange-500" },
+ ];
+
return (
- <div className="pt-2">
- <h2 className="font-semibold">{title}:</h2>
- <SheetDescription>
- {items.map((item, index) => item && <li key={index}>{item}</li>)}
- </SheetDescription>
+ <div className="pt-4">
+ {scores.overall !== undefined && (
+ <div className="flex justify-center mb-4">
+ <RadialChartComponent score={scores.overall} />
+ </div>
+ )}
+ <div className="grid grid-cols-4 gap-2 mt-[-40px]">
+ {scoreItems.map(
+ (item) =>
+ item.value !== undefined && (
+ <div key={item.label} className="text-center">
+ <div className="text-xs text-muted-foreground">{item.label}</div>
+ <div className="font-semibold">{item.value}</div>
+ </div>
+ )
+ )}
+ </div>
</div>
);
};
+const SummarySection = ({ summary }: { summary?: string }) => {
+ if (!summary) return null;
+ return (
+ <div className="pt-4">
+ <h2 className="font-semibold text-sm">Summary</h2>
+ <SheetDescription className="mt-1">{summary}</SheetDescription>
+ </div>
+ );
+};
+
+const AchievementsSection = ({
+ achievements,
+}: {
+ achievements?: DeepPartial<ResumeReviewResponse["achievements"]>;
+}) => {
+ if (!achievements) return null;
+ const { strong, weak, missingMetrics } = achievements;
+
+ const hasContent =
+ (strong && strong.length > 0) ||
+ (weak && weak.length > 0) ||
+ (missingMetrics && missingMetrics.length > 0);
+
+ if (!hasContent) return null;
+
+ return (
+ <AccordionItem value="achievements">
+ <AccordionTrigger className="text-sm font-semibold">
+ Achievements
+ </AccordionTrigger>
+ <AccordionContent>
+ {strong && strong.length > 0 && (
+ <div className="mb-3">
+ <div className="flex items-center gap-1 text-green-600 text-xs font-medium mb-1">
+ <CheckCircle className="h-3 w-3" />
+ Strong Achievements
+ </div>
+ <ul className="text-sm text-muted-foreground space-y-1">
+ {strong.map((item, i) => item && <li key={i}>- {item}</li>)}
+ </ul>
+ </div>
+ )}
+ {weak && weak.length > 0 && (
+ <div className="mb-3">
+ <div className="flex items-center gap-1 text-amber-600 text-xs font-medium mb-1">
+ <AlertTriangle className="h-3 w-3" />
+ Needs Quantification
+ </div>
+ <ul className="text-sm text-muted-foreground space-y-1">
+ {weak.map((item, i) => item && <li key={i}>- {item}</li>)}
+ </ul>
+ </div>
+ )}
+ {missingMetrics && missingMetrics.length > 0 && (
+ <div>
+ <div className="text-xs font-medium text-muted-foreground mb-1">
+ Suggested Metrics to Add
+ </div>
+ <ul className="text-sm text-muted-foreground space-y-1">
+ {missingMetrics.map((item, i) => item && <li key={i}>- {item}</li>)}
+ </ul>
+ </div>
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ );
+};
+
+const KeywordsSection = ({
+ keywords,
+}: {
+ keywords?: DeepPartial<ResumeReviewResponse["keywords"]>;
+}) => {
+ if (!keywords) return null;
+ const { found, missing, overused } = keywords;
+
+ const hasContent =
+ (found && found.length > 0) ||
+ (missing && missing.length > 0) ||
+ (overused && overused.length > 0);
+
+ if (!hasContent) return null;
+
+ return (
+ <AccordionItem value="keywords">
+ <AccordionTrigger className="text-sm font-semibold">
+ Keywords
+ </AccordionTrigger>
+ <AccordionContent>
+ {found && found.length > 0 && (
+ <div className="mb-3">
+ <div className="text-xs font-medium text-green-600 mb-1">Found</div>
+ <div className="flex flex-wrap gap-1">
+ {found.map(
+ (kw, i) =>
+ kw && (
+ <Badge key={i} variant="secondary" className="text-xs">
+ {kw}
+ </Badge>
+ )
+ )}
+ </div>
+ </div>
+ )}
+ {missing && missing.length > 0 && (
+ <div className="mb-3">
+ <div className="text-xs font-medium text-amber-600 mb-1">
+ Consider Adding
+ </div>
+ <div className="flex flex-wrap gap-1">
+ {missing.map(
+ (kw, i) =>
+ kw && (
+ <Badge key={i} variant="outline" className="text-xs">
+ {kw}
+ </Badge>
+ )
+ )}
+ </div>
+ </div>
+ )}
+ {overused && overused.length > 0 && (
+ <div>
+ <div className="text-xs font-medium text-red-600 mb-1">Overused</div>
+ <div className="flex flex-wrap gap-1">
+ {overused.map(
+ (kw, i) =>
+ kw && (
+ <Badge key={i} variant="destructive" className="text-xs">
+ {kw}
+ </Badge>
+ )
+ )}
+ </div>
+ </div>
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ );
+};
+
+const ActionVerbsSection = ({
+ actionVerbs,
+}: {
+ actionVerbs?: DeepPartial<ResumeReviewResponse["actionVerbs"]>;
+}) => {
+ if (!actionVerbs) return null;
+ const { strong, weak, suggestions } = actionVerbs;
+
+ const hasContent =
+ (strong && strong.length > 0) ||
+ (weak && weak.length > 0) ||
+ (suggestions && suggestions.length > 0);
+
+ if (!hasContent) return null;
+
+ return (
+ <AccordionItem value="verbs">
+ <AccordionTrigger className="text-sm font-semibold">
+ Action Verbs
+ </AccordionTrigger>
+ <AccordionContent>
+ {strong && strong.length > 0 && (
+ <div className="mb-3">
+ <div className="text-xs font-medium text-green-600 mb-1">
+ Strong Verbs
+ </div>
+ <div className="flex flex-wrap gap-1">
+ {strong.map(
+ (v, i) =>
+ v && (
+ <Badge key={i} variant="secondary" className="text-xs">
+ {v}
+ </Badge>
+ )
+ )}
+ </div>
+ </div>
+ )}
+ {weak && weak.length > 0 && (
+ <div className="mb-3">
+ <div className="text-xs font-medium text-amber-600 mb-1">
+ Weak Verbs
+ </div>
+ <div className="flex flex-wrap gap-1">
+ {weak.map(
+ (v, i) =>
+ v && (
+ <Badge key={i} variant="outline" className="text-xs">
+ {v}
+ </Badge>
+ )
+ )}
+ </div>
+ </div>
+ )}
+ {suggestions && suggestions.length > 0 && (
+ <div>
+ <div className="text-xs font-medium text-muted-foreground mb-1">
+ Suggestions
+ </div>
+ <ul className="text-sm text-muted-foreground space-y-1">
+ {suggestions.map(
+ (s, i) =>
+ s?.replace &&
+ s?.with && (
+ <li key={i} className="flex items-center gap-1">
+ <span className="line-through text-red-500">{s.replace}</span>
+ <ArrowRight className="h-3 w-3" />
+ <span className="text-green-600">{s.with}</span>
+ </li>
+ )
+ )}
+ </ul>
+ </div>
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ );
+};
+
+const SectionFeedbackSection = ({
+ sectionFeedback,
+}: {
+ sectionFeedback?: DeepPartial<ResumeReviewResponse["sectionFeedback"]>;
+}) => {
+ if (!sectionFeedback || Object.keys(sectionFeedback).length === 0) return null;
+
+ const getStatusIcon = (status?: string) => {
+ switch (status) {
+ case "good":
+ return <CheckCircle className="h-3 w-3 text-green-600" />;
+ case "needsWork":
+ return <AlertTriangle className="h-3 w-3 text-amber-600" />;
+ case "missing":
+ return <XCircle className="h-3 w-3 text-red-600" />;
+ default:
+ return null;
+ }
+ };
+
+ return (
+ <AccordionItem value="sections">
+ <AccordionTrigger className="text-sm font-semibold">
+ Section Feedback
+ </AccordionTrigger>
+ <AccordionContent>
+ <div className="space-y-2">
+ {Object.entries(sectionFeedback).map(
+ ([section, feedback]) =>
+ feedback && (
+ <div key={section} className="border-b pb-2 last:border-0">
+ <div className="flex items-center gap-1 font-medium text-sm">
+ {getStatusIcon(feedback.status)}
+ {section}
+ </div>
+ {feedback.feedback && (
+ <p className="text-xs text-muted-foreground mt-1">
+ {feedback.feedback}
+ </p>
+ )}
+ </div>
+ )
+ )}
+ </div>
+ </AccordionContent>
+ </AccordionItem>
+ );
+};
+
+const ATSIssuesSection = ({ atsIssues }: { atsIssues?: (string | undefined)[] }) => {
+ if (!atsIssues || atsIssues.length === 0) return null;
+
+ return (
+ <AccordionItem value="ats">
+ <AccordionTrigger className="text-sm font-semibold">
+ ATS Issues
+ </AccordionTrigger>
+ <AccordionContent>
+ <ul className="text-sm text-muted-foreground space-y-1">
+ {atsIssues.map(
+ (issue, i) =>
+ issue && (
+ <li key={i} className="flex items-start gap-1">
+ <XCircle className="h-3 w-3 text-red-600 mt-0.5 flex-shrink-0" />
+ {issue}
+ </li>
+ )
+ )}
+ </ul>
+ </AccordionContent>
+ </AccordionItem>
+ );
+};
+
+const TopImprovementsSection = ({
+ topImprovements,
+}: {
+ topImprovements?: DeepPartial<ResumeReviewResponse["topImprovements"]>;
+}) => {
+ if (!topImprovements || topImprovements.length === 0) return null;
+
+ return (
+ <AccordionItem value="improvements">
+ <AccordionTrigger className="text-sm font-semibold">
+ Top Improvements
+ </AccordionTrigger>
+ <AccordionContent>
+ <div className="space-y-3">
+ {topImprovements.map(
+ (item, i) =>
+ item && (
+ <div key={i} className="border-l-2 border-primary pl-3">
+ <div className="flex items-center gap-2">
+ <Badge variant="outline" className="text-xs">
+ #{item.priority}
+ </Badge>
+ <span className="text-sm font-medium">{item.issue}</span>
+ </div>
+ {item.fix && (
+ <p className="text-xs text-muted-foreground mt-1">
+ {item.fix}
+ </p>
+ )}
+ </div>
+ )
+ )}
+ </div>
+ </AccordionContent>
+ </AccordionItem>
+ );
+};
+
+const GrammarSection = ({
+ grammarAndSpelling,
+}: {
+ grammarAndSpelling?: DeepPartial<ResumeReviewResponse["grammarAndSpelling"]>;
+}) => {
+ if (!grammarAndSpelling) return null;
+ const { errors, punctuationIssues, consistencyIssues } = grammarAndSpelling;
+
+ const hasContent =
+ (errors && errors.length > 0) ||
+ (punctuationIssues && punctuationIssues.length > 0) ||
+ (consistencyIssues && consistencyIssues.length > 0);
+
+ if (!hasContent) return null;
+
+ return (
+ <AccordionItem value="grammar">
+ <AccordionTrigger className="text-sm font-semibold">
+ Grammar & Spelling
+ </AccordionTrigger>
+ <AccordionContent>
+ {errors && errors.length > 0 && (
+ <div className="mb-3">
+ <div className="text-xs font-medium text-red-600 mb-1">Errors</div>
+ <div className="space-y-2">
+ {errors.map(
+ (err, i) =>
+ err && (
+ <div key={i} className="text-sm">
+ <span className="line-through text-red-500">{err.text}</span>
+ {err.correction && (
+ <>
+ <ArrowRight className="h-3 w-3 inline mx-1" />
+ <span className="text-green-600">{err.correction}</span>
+ </>
+ )}
+ {err.issue && (
+ <p className="text-xs text-muted-foreground">{err.issue}</p>
+ )}
+ </div>
+ )
+ )}
+ </div>
+ </div>
+ )}
+ {punctuationIssues && punctuationIssues.length > 0 && (
+ <div className="mb-3">
+ <div className="text-xs font-medium text-amber-600 mb-1">
+ Punctuation
+ </div>
+ <ul className="text-sm text-muted-foreground space-y-1">
+ {punctuationIssues.map((p, i) => p && <li key={i}>- {p}</li>)}
+ </ul>
+ </div>
+ )}
+ {consistencyIssues && consistencyIssues.length > 0 && (
+ <div>
+ <div className="text-xs font-medium text-amber-600 mb-1">
+ Consistency
+ </div>
+ <ul className="text-sm text-muted-foreground space-y-1">
+ {consistencyIssues.map((c, i) => c && <li key={i}>- {c}</li>)}
+ </ul>
+ </div>
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ );
+};
+
+// MAIN COMPONENT
+
export const AiResumeReviewResponseContent = ({
content,
isStreaming,
@@ -30,32 +463,39 @@ export const AiResumeReviewResponseContent = ({
}) => {
if (!content) return null;
- const { summary, strengths, weaknesses, suggestions, score } = content;
+ const {
+ scores,
+ summary,
+ achievements,
+ keywords,
+ actionVerbs,
+ sectionFeedback,
+ atsIssues,
+ topImprovements,
+ grammarAndSpelling,
+ } = content;
return (
- <>
- {score !== undefined && (
- <div className="pt-2 flex justify-center">
- <RadialChartComponent score={score} />
- </div>
- )}
- <div className={score !== undefined ? "mt-[-50px]" : ""}>
- {summary && (
- <div className="pt-2">
- <h2 className="font-semibold">Summary:</h2>
- <SheetDescription>{summary}</SheetDescription>
- </div>
- )}
- <Section title="Strengths" items={strengths} />
- <Section title="Weaknesses" items={weaknesses} />
- <Section title="Suggestions" items={suggestions} />
- </div>
+ <div className="space-y-2">
+ <ScoresSection scores={scores} />
+ <SummarySection summary={summary} />
+
+ <Accordion type="multiple" className="w-full" defaultValue={["improvements", "achievements", "keywords", "verbs", "sections", "ats", "grammar"]}>
+ <TopImprovementsSection topImprovements={topImprovements} />
+ <AchievementsSection achievements={achievements} />
+ <KeywordsSection keywords={keywords} />
+ <ActionVerbsSection actionVerbs={actionVerbs} />
+ <SectionFeedbackSection sectionFeedback={sectionFeedback} />
+ <ATSIssuesSection atsIssues={atsIssues} />
+ <GrammarSection grammarAndSpelling={grammarAndSpelling} />
+ </Accordion>
+
{isStreaming && (
<div className="flex items-center gap-2 text-muted-foreground text-sm mt-4 animate-pulse">
<div className="h-2 w-2 bg-primary rounded-full"></div>
- <span>Streaming response...</span>
+ <span>Analyzing resume...</span>
</div>
)}
- </>
+ </div>
);
};
diff --git a/src/components/profile/AiResumeReviewSection.tsx b/src/components/profile/AiResumeReviewSection.tsx
index 6b30d30..c254380 100644
--- a/src/components/profile/AiResumeReviewSection.tsx
+++ b/src/components/profile/AiResumeReviewSection.tsx
@@ -91,7 +91,7 @@ const AiResumeReviewSection = ({ resume }: AiSectionProps) => {
};
// Check if we have any content to show
- const hasContent = object && (object.score !== undefined || object.summary);
+ const hasContent = object && (object.scores?.overall !== undefined || object.summary);
return (
<Sheet open={aISectionOpen} onOpenChange={triggerSheetChange}>
diff --git a/src/components/ui/accordion.tsx b/src/components/ui/accordion.tsx
new file mode 100644
index 0000000..24c788c
--- /dev/null
+++ b/src/components/ui/accordion.tsx
@@ -0,0 +1,58 @@
+"use client"
+
+import * as React from "react"
+import * as AccordionPrimitive from "@radix-ui/react-accordion"
+import { ChevronDown } from "lucide-react"
+
+import { cn } from "@/lib/utils"
+
+const Accordion = AccordionPrimitive.Root
+
+const AccordionItem = React.forwardRef<
+ React.ElementRef<typeof AccordionPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
+>(({ className, ...props }, ref) => (
+ <AccordionPrimitive.Item
+ ref={ref}
+ className={cn("border-b", className)}
+ {...props}
+ />
+))
+AccordionItem.displayName = "AccordionItem"
+
+const AccordionTrigger = React.forwardRef<
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
+>(({ className, children, ...props }, ref) => (
+ <AccordionPrimitive.Header className="flex">
+ <AccordionPrimitive.Trigger
+ ref={ref}
+ className={cn(
+ "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+))
+AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
+
+const AccordionContent = React.forwardRef<
+ React.ElementRef<typeof AccordionPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
+>(({ className, children, ...props }, ref) => (
+ <AccordionPrimitive.Content
+ ref={ref}
+ className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
+ {...props}
+ >
+ <div className={cn("pb-4 pt-0", className)}>{children}</div>
+ </AccordionPrimitive.Content>
+))
+
+AccordionContent.displayName = AccordionPrimitive.Content.displayName
+
+export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
diff --git a/src/lib/ai/index.ts b/src/lib/ai/index.ts
index c71e43a..52e37b0 100644
--- a/src/lib/ai/index.ts
+++ b/src/lib/ai/index.ts
@@ -7,7 +7,7 @@ export {
type JobMatchAnalysis,
} from "@/models/ai.schemas";
-// Prompts - used by non-collaborative endpoints
+// Prompts
export {
RESUME_REVIEW_SYSTEM_PROMPT,
JOB_MATCH_SYSTEM_PROMPT,
@@ -27,25 +27,17 @@ export {
type PreprocessedResume,
} from "./tools";
-// Semantic extraction and similarity functions
+// Semantic extraction for job matching (still used)
export {
- extractSemanticKeywords,
- analyzeActionVerbs,
performSemanticSkillMatch,
calculateSemanticSimilarity,
generateMatchExplanation,
- getKeywordCountFromSemantic,
- getVerbCountFromSemantic,
} from "./tools";
-// Phase 3: Semantic schemas
+// Schemas for job matching
export {
- SemanticKeywordSchema,
- ActionVerbAnalysisSchema,
SemanticSkillMatchSchema,
SemanticSimilaritySchema,
- type SemanticKeywordExtraction,
- type ActionVerbAnalysis,
type SemanticSkillMatch,
type SemanticSimilarityResult,
} from "@/models/ai.schemas";
diff --git a/src/lib/ai/ollama/index.ts b/src/lib/ai/ollama/index.ts
index 6b3535e..05d82c6 100644
--- a/src/lib/ai/ollama/index.ts
+++ b/src/lib/ai/ollama/index.ts
@@ -23,6 +23,7 @@ export function isOllamaProvider(provider: ProviderType): boolean {
export {
normalizeKeywordExtraction,
normalizeActionVerbAnalysis,
+ normalizeCombinedResumeAnalysis,
normalizeSkillMatch,
normalizeSemanticSimilarity,
} from "./normalizers";
@@ -31,10 +32,12 @@ export {
export {
OllamaSemanticKeywordSchema,
OllamaActionVerbSchema,
+ OllamaCombinedResumeAnalysisSchema,
OllamaSkillMatchSchema,
OllamaSemanticSimilaritySchema,
type OllamaSemanticKeywordExtraction,
type OllamaActionVerbAnalysis,
+ type OllamaCombinedResumeAnalysis,
type OllamaSkillMatch,
type OllamaSemanticSimilarity,
} from "@/models/ai.ollama-schemas";
diff --git a/src/lib/ai/ollama/normalizers.ts b/src/lib/ai/ollama/normalizers.ts
index 49bb28f..ee25aab 100644
--- a/src/lib/ai/ollama/normalizers.ts
+++ b/src/lib/ai/ollama/normalizers.ts
@@ -8,12 +8,14 @@
import type {
OllamaSemanticKeywordExtraction,
OllamaActionVerbAnalysis,
+ OllamaCombinedResumeAnalysis,
OllamaSkillMatch,
OllamaSemanticSimilarity,
} from "@/models/ai.ollama-schemas";
import type {
SemanticKeywordExtraction,
ActionVerbAnalysis,
+ CombinedResumeAnalysis,
SemanticSkillMatch,
SemanticSimilarityResult,
} from "@/models/ai.schemas";
@@ -22,7 +24,7 @@ import type {
* Normalize Ollama keyword extraction to full schema format
*/
export function normalizeKeywordExtraction(
- ollamaResult: OllamaSemanticKeywordExtraction
+ ollamaResult: OllamaSemanticKeywordExtraction,
): SemanticKeywordExtraction {
return {
technical_skills: ollamaResult.technical_skills,
@@ -38,7 +40,7 @@ export function normalizeKeywordExtraction(
* Normalize Ollama action verb analysis to full schema format
*/
export function normalizeActionVerbAnalysis(
- ollamaResult: OllamaActionVerbAnalysis
+ ollamaResult: OllamaActionVerbAnalysis,
): ActionVerbAnalysis {
return {
strong_verbs: ollamaResult.strong_verbs.map((verb) => ({
@@ -55,11 +57,23 @@ export function normalizeActionVerbAnalysis(
};
}
+/**
+ * Normalize Ollama combined resume analysis to full schema format
+ */
+export function normalizeCombinedResumeAnalysis(
+ ollamaResult: OllamaCombinedResumeAnalysis,
+): CombinedResumeAnalysis {
+ return {
+ keywords: normalizeKeywordExtraction(ollamaResult.keywords),
+ verbs: normalizeActionVerbAnalysis(ollamaResult.verbs),
+ };
+}
+
/**
* Normalize Ollama skill match to full schema format
*/
export function normalizeSkillMatch(
- ollamaResult: OllamaSkillMatch
+ ollamaResult: OllamaSkillMatch,
): SemanticSkillMatch {
return {
exact_matches: ollamaResult.matched_skills
@@ -85,7 +99,7 @@ export function normalizeSkillMatch(
* Normalize Ollama semantic similarity to full schema format
*/
export function normalizeSemanticSimilarity(
- ollamaResult: OllamaSemanticSimilarity
+ ollamaResult: OllamaSemanticSimilarity,
): SemanticSimilarityResult {
return {
similarity_score: ollamaResult.similarity_score,
diff --git a/src/lib/ai/prompts/index.ts b/src/lib/ai/prompts/index.ts
index d8f5e4d..dd0fe38 100644
--- a/src/lib/ai/prompts/index.ts
+++ b/src/lib/ai/prompts/index.ts
@@ -12,11 +12,6 @@
export {
RESUME_REVIEW_SYSTEM_PROMPT,
buildResumeReviewPrompt,
- RESUME_CALIBRATION_EXAMPLES,
- SCORING_PHASES,
- SCORE_INTERPRETATION_GUIDE,
- getKeywordPrompt,
- getVerbPrompt,
} from "./resume-review";
// Job Match exports
@@ -27,6 +22,3 @@ export {
getSkillMatchPrompt,
getSimilarityPrompt,
} from "./job-match";
-
-// Shared exports
-export { CRITIC_SYSTEM_PROMPT, buildCriticPrompt } from "./shared";
diff --git a/src/lib/ai/prompts/resume-review/calibration.ts b/src/lib/ai/prompts/resume-review/calibration.ts
deleted file mode 100644
index 688939c..0000000
--- a/src/lib/ai/prompts/resume-review/calibration.ts
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Resume Review Calibration Examples
- *
- * Diverse examples across industries and score ranges to anchor AI scoring.
- */
-
-export const RESUME_CALIBRATION_EXAMPLES = `## FEW-SHOT CALIBRATION EXAMPLES (memorize these score anchors)
-
-### Example 1: Senior Software Engineer → Score: 72/100 (Above Average)
-**Resume Summary:** 6 years experience, FAANG background, 7 quantified achievements
-**Scoring Breakdown:**
-• Keywords (16/20): React, TypeScript, AWS, Docker, Kubernetes, PostgreSQL, GraphQL, CI/CD, Agile, REST APIs, microservices, Redis (12 strong technical terms)
-• Quantified (20/25): 7 achievements with metrics: "Reduced API latency 60%", "Led team of 8", "Processed 2M daily transactions", "$500K annual savings", "99.9% uptime", "40% faster deployments", "3x improvement in test coverage"
-• Action Verbs (8/10): Architected, Optimized, Led, Spearheaded, Implemented, Mentored, Streamlined
-• Formatting (12/15): Clean sections, consistent bullets, good whitespace, minor date alignment issues
-• Summary (7/10): States role target and key strengths, could add unique value proposition
-• Clarity (9/10): Crystal clear progression, excellent STAR-format bullets
-• Skills (4/5): Well-organized technical skills, missing soft skills section
-• Grammar (5/5): Flawless
-**Total: 16+20+8+12+7+9+4+5 = 81** → Adjusted to 72 (top of above average)
-**Why not higher:** Missing cover letter synergy, summary could be punchier, no portfolio/GitHub links
-
-### Example 2: Marketing Manager → Score: 54/100 (Average)
-**Resume Summary:** 4 years experience, agency background, 3 quantified achievements
-**Scoring Breakdown:**
-• Keywords (11/20): Digital marketing, SEO, content strategy, social media, Google Analytics, brand management, campaign management (7 terms, missing specific tools like HubSpot, Marketo, Salesforce)
-• Quantified (14/25): 3 achievements: "Grew social following 150%", "Managed $200K budget", "Increased engagement 45%". Missing: conversion rates, ROI, revenue impact
-• Action Verbs (6/10): Managed, Created, Developed, Led - but also weak verbs: "Responsible for", "Helped with"
-• Formatting (10/15): Clean but basic, inconsistent bullet lengths, no visual hierarchy
-• Summary (5/10): Generic objective statement, doesn't differentiate from other candidates
-• Clarity (7/10): Job duties clear but accomplishments buried in responsibilities
-• Skills (3/5): Lists skills but no proficiency levels or categorization
-• Grammar (4/5): Two minor typos ("their" vs "there", missing comma)
-**Total: 11+14+6+10+5+7+3+4 = 60** → Adjusted to 54 (middle of average)
-**Why lower:** Too responsibility-focused vs achievement-focused, weak differentiation
-
-### Example 3: Recent Graduate (Entry-Level) → Score: 41/100 (Below Average - but normal for new grads)
-**Resume Summary:** New CS graduate, 2 internships, 1 project
-**Scoring Breakdown:**
-• Keywords (8/20): Python, Java, SQL, Git, Agile, AWS (6 terms - good for entry level)
-• Quantified (8/25): 1 achievement: "Reduced data processing time by 30%". Academic projects lack metrics.
-• Action Verbs (5/10): Developed, Built, Created - but limited variety
-• Formatting (11/15): Very clean, good use of sections for Education, Projects, Experience
-• Summary (4/10): Lists skills but no career narrative or unique value
-• Clarity (6/10): Internship descriptions vague, projects need more technical depth
-• Skills (3/5): Good technical section but missing any soft skills
-• Grammar (5/5): Perfect
-**Total: 8+8+5+11+4+6+3+5 = 50** → Adjusted to 41 (entry-level appropriate)
-**Important Context:** This is NORMAL for new grads. Score reflects room to grow, not failure.
-
-### Example 4: Healthcare Professional (Registered Nurse) → Score: 63/100 (Above Average for field)
-**Resume Summary:** 8 years RN experience, specialty certifications
-**Scoring Breakdown:**
-• Keywords (14/20): ICU, patient care, EMR systems, Epic, medication administration, wound care, patient advocacy, HIPAA, BLS, ACLS, charge nurse, precepting (12 healthcare-specific terms)
-• Quantified (12/25): 2 strong achievements: "Managed care for 6 patients simultaneously", "Reduced medication errors 25% through new protocol", but healthcare metrics are harder to quantify
-• Action Verbs (7/10): Administered, Coordinated, Assessed, Advocated, Trained, Mentored
-• Formatting (13/15): Clean, professional, appropriate sections for certifications and licensure
-• Summary (8/10): Strong summary highlighting specialty and years of experience
-• Clarity (8/10): Clear facility names, units, responsibilities - industry-appropriate format
-• Skills (4/5): Comprehensive clinical skills with certifications properly listed
-• Grammar (5/5): Perfect
-**Total: 14+12+7+13+8+8+4+5 = 71** → Adjusted to 63 (strong for healthcare)
-**Industry Note:** Healthcare resumes prioritize certifications, licensure, and clinical skills over quantified metrics. This is an excellent healthcare resume despite fewer numbers.
-
-### Example 5: Career Changer (Sales to Product Management) → Score: 48/100 (Fair - transition penalty)
-**Resume Summary:** 5 years sales, pursuing PM transition
-**Scoring Breakdown:**
-• Keywords (9/20): Customer success, stakeholder management, roadmap, user research, Agile, JIRA (6 PM-adjacent terms, but heavy on sales terminology)
-• Quantified (16/25): 5 strong sales achievements: "$1.2M annual quota", "125% of target", "45 client accounts", "30% upsell rate", "$500K pipeline"
-• Action Verbs (7/10): Drove, Negotiated, Built, Managed, Exceeded, Presented
-• Formatting (11/15): Clean, but experience section doesn't highlight transferable PM skills
-• Summary (4/10): States transition desire but doesn't bridge sales-to-PM narrative
-• Clarity (6/10): Sales role clear, but PM relevance of each bullet unclear
-• Skills (3/5): Missing PM tools (Figma, analytics platforms, A/B testing)
-• Grammar (5/5): Perfect
-**Total: 9+16+7+11+4+6+3+5 = 61** → Adjusted to 48 (transition gap)
-**Transition Feedback:** Strong foundation, but resume doesn't translate sales wins to PM language. Needs skill mapping and PM project experience.`;
-
-export const SCORING_PHASES = `## YOUR ANALYTICAL PROCESS (follow precisely)
-
-### PHASE 1: RECONNAISSANCE (30 seconds)
-1. **Identify Resume Type:** What industry/role? What career stage (entry/mid/senior/executive)?
-2. **Set Expectations:** A new grad CANNOT have 8 quantified achievements. A nurse WON'T have GitHub links. Adjust mental baseline.
-3. **First Impression:** What jumps out as strongest? What's obviously missing?
-
-### PHASE 2: FORENSIC COUNTING (be exact)
-Count these elements LITERALLY - no estimating:
-
-**Quantified Achievements** (0-25 pts) - COUNT each number/percentage/dollar amount:
-- Tip: Look for %, $, #, "increased", "reduced", "managed", "led team of"
-- Format: "Found X quantified achievements: [list each one]"
-
-**Technical Keywords** (0-20 pts) - COUNT industry-specific terms:
-- Tip: Technologies, tools, methodologies, certifications, domain terms
-- Format: "Found X keywords: [list them]"
-
-**Action Verbs** (0-10 pts) - Note strong vs weak:
-- Strong: Led, Architected, Transformed, Spearheaded, Delivered, Optimized
-- Weak: Responsible for, Helped with, Assisted in, Worked on, Did
-- Format: "Found X strong verbs, Y weak verbs"
-
-### PHASE 3: QUALITATIVE ASSESSMENT
-
-**Formatting Quality** (0-15 pts):
-- Visual hierarchy (headings, subheadings, bullets)
-- Consistent spacing and alignment
-- Appropriate length (1 page for <10 yrs, 2 pages for >10 yrs)
-- ATS-friendly (no tables, columns, graphics)
-
-**Professional Summary** (0-10 pts):
-- Does it answer: "What do you do? What are you great at? What value do you bring?"
-- Is it customizable for target roles?
-- Does it avoid clichés ("hardworking team player")?
-
-**Experience Clarity** (0-10 pts):
-- Clear company names, titles, dates
-- STAR format (Situation, Task, Action, Result)
-- Progression visible (increasing responsibility)
-
-**Skills Section** (0-5 pts):
-- Organized by category (languages, frameworks, tools)
-- Relevant to target role
-- No fluff skills ("Microsoft Word" for a developer)
-
-**Grammar/Spelling** (0-5 pts):
-- Any errors at all?
-- Consistent tense (past for old roles, present for current)
-- Professional tone
-
-### PHASE 4: CALCULATE TOTAL
-Show your math explicitly:
-"Keywords: X + Quantified: Y + Verbs: Z + Formatting: A + Summary: B + Clarity: C + Skills: D + Grammar: E = TOTAL"
-
-### PHASE 5: SELF-CRITIQUE CHECKLIST
-Before submitting, verify:
-□ Did I COUNT actual elements or just estimate?
-□ Is my score within realistic range for this career stage?
-□ Would a human recruiter agree with my assessment?
-□ Are my suggestions SPECIFIC with examples from THIS resume?
-□ Did I reference actual text from the resume in my feedback?
-□ Is at least one suggestion about the HIGHEST-IMPACT improvement?`;
-
-export const SCORE_INTERPRETATION_GUIDE = `## SCORE INTERPRETATION GUIDE
-- **85-100:** Exceptional - Top 5% of resumes. Ready for FAANG/top-tier companies.
-- **70-84:** Above Average - Strong resume, minor polish needed. Competitive for good roles.
-- **55-69:** Average - Serviceable but doesn't stand out. Needs work to compete.
-- **40-54:** Below Average - Significant gaps. Major revision recommended.
-- **25-39:** Weak - Fundamental issues. Needs substantial rewrite.
-- **<25:** Critical - Only for nearly blank or severely problematic resumes.
-
-## REALITY CHECK
-- Most resumes score 45-65
-- Entry-level resumes typically score 35-50
-- Even excellent resumes rarely exceed 80
-- A score of 50 is NOT bad - it's genuinely average`;
diff --git a/src/lib/ai/prompts/resume-review/index.ts b/src/lib/ai/prompts/resume-review/index.ts
index 4f9a448..931f972 100644
--- a/src/lib/ai/prompts/resume-review/index.ts
+++ b/src/lib/ai/prompts/resume-review/index.ts
@@ -7,13 +7,3 @@ export { RESUME_REVIEW_SYSTEM_PROMPT } from "./system";
// User prompt builders
export { buildResumeReviewPrompt } from "./user";
-
-// Calibration examples
-export {
- RESUME_CALIBRATION_EXAMPLES,
- SCORING_PHASES,
- SCORE_INTERPRETATION_GUIDE,
-} from "./calibration";
-
-// Semantic extraction prompts
-export { getKeywordPrompt, getVerbPrompt } from "./semantic";
diff --git a/src/lib/ai/prompts/resume-review/semantic.ts b/src/lib/ai/prompts/resume-review/semantic.ts
deleted file mode 100644
index d86619d..0000000
--- a/src/lib/ai/prompts/resume-review/semantic.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Resume Review Semantic Prompts
- *
- * Provider-aware prompts for keyword extraction and action verb analysis.
- */
-
-import { ProviderType } from "../../providers";
-
-/**
- * Get keyword extraction prompt based on provider
- * Ollama: ~120 tokens | Cloud: ~220 tokens (37% reduction)
- */
-export function getKeywordPrompt(
- provider: ProviderType,
- text: string,
- contextHint?: string
-): string {
- if (provider === "ollama") {
- return `Extract technical skills and tools from text.
-
-Text:
-${text.substring(0, 1500)}
-
-Output technical_skills, tools, total_count.`;
- }
-
- // Cloud prompt: Optimized (~220 tokens) - concise but comprehensive
- return `Extract all technical skills and expertise from this text.
-${contextHint ? `Context: ${contextHint} position.\n` : ""}
-Categories: technical_skills, tools_platforms, methodologies, domain_knowledge, soft_skills.
-Be comprehensive - extract EVERY term. Recognize synonyms (k8s=Kubernetes, JS=JavaScript).
-Consider context to avoid false matches.
-
-Text:
-"""
-${text.substring(0, 4000)}
-"""`;
-}
-
-/**
- * Get action verb analysis prompt based on provider
- * Ollama: ~130 tokens | Cloud: ~280 tokens (49% reduction)
- */
-export function getVerbPrompt(provider: ProviderType, text: string): string {
- if (provider === "ollama") {
- return `Find action verbs in resume.
-
-Resume:
-${text.substring(0, 1500)}
-
-Output strong_verbs, weak_verbs, verb_strength_score (0-10).`;
- }
-
- // Cloud: Optimized (~280 tokens) - concise with key examples
- return `Analyze action verbs and language strength in this resume.
-
-STRONG verbs (high impact): Led, Architected, Spearheaded, Delivered, Built, Scaled, Transformed
-STRONG verbs (medium): Managed, Developed, Implemented, Created, Designed
-WEAK verbs to flag: "Responsible for", "Tasked with", "Helped with", "Worked on"
-
-For weak verbs found, suggest stronger alternatives based on context.
-
-Resume:
-"""
-${text.substring(0, 4000)}
-"""
-
-Score verb_strength_score 0-10 (0-3: passive, 4-6: mixed, 7-10: strong)`;
-}
diff --git a/src/lib/ai/prompts/resume-review/system.ts b/src/lib/ai/prompts/resume-review/system.ts
index 6929c85..424fd0c 100644
--- a/src/lib/ai/prompts/resume-review/system.ts
+++ b/src/lib/ai/prompts/resume-review/system.ts
@@ -1,36 +1,46 @@
/**
- * Resume Review System Prompts
+ * Resume Review System Prompt
+ * Comprehensive single-call analysis with structured JSON output
*/
-import { RESUME_CALIBRATION_EXAMPLES, SCORING_PHASES, SCORE_INTERPRETATION_GUIDE } from "./calibration";
+export const RESUME_REVIEW_SYSTEM_PROMPT = `You are an expert resume reviewer with 15 years of recruiting experience across multiple industries.
+You combine ATS expertise with human recruiter psychology to provide accurate, actionable assessments.
-const COGNITIVE_FORCING_RULES = `## COGNITIVE FORCING RULES (prevent common AI mistakes)
+## YOUR ANALYSIS APPROACH
-❌ DON'T: Give vague feedback like "add more metrics" or "improve formatting"
-✅ DO: Give specific feedback like "Your 'Increased sales' bullet should include the % or $ value"
+1. **Identify Context**: What industry/role is this resume for? What career stage?
+2. **Count Elements**: Quantified achievements (%, $, numbers), keywords, action verbs
+3. **Assess Quality**: Formatting, ATS compatibility, clarity, grammar
+4. **Provide Specific Feedback**: Reference actual text from the resume
-❌ DON'T: Score based on impression - actually COUNT the elements
-✅ DO: "I found exactly 4 quantified achievements: [list them]"
+## SCORING GUIDELINES
-❌ DON'T: Assume missing information is bad - it might be intentional
-✅ DO: Note what's missing but consider industry norms (e.g., nurses don't need GitHub)
+**Overall Score (0-100)**:
+- 85-100: Exceptional - Top 5%, ready for FAANG/top-tier
+- 70-84: Above Average - Strong, minor polish needed
+- 55-69: Average - Serviceable but doesn't stand out
+- 40-54: Below Average - Significant gaps
+- 25-39: Weak - Fundamental issues
+- <25: Critical - Only for nearly blank resumes
-❌ DON'T: Give the same feedback to every resume
-✅ DO: Reference SPECIFIC text from THIS resume in your feedback
+**Impact Score**: Based on quantified achievements, measurable results, business value
+**Clarity Score**: Readability, organization, STAR format, professional writing
+**ATS Compatibility**: Standard formatting, keywords, no tables/graphics, proper sections
-❌ DON'T: Conflate "different from ideal" with "wrong"
-✅ DO: Recognize valid stylistic choices even if you'd do differently`;
+## COGNITIVE RULES
-/**
- * Resume Review System Prompt
- * Used by AI to analyze resumes with chain-of-thought reasoning
- */
-export const RESUME_REVIEW_SYSTEM_PROMPT = `You are an elite resume consultant who has reviewed 50,000+ resumes across all industries. You combine ATS expertise with human recruiter psychology to provide exceptionally accurate, actionable assessments.
-
-${COGNITIVE_FORCING_RULES}
+✅ DO: Give specific feedback referencing actual resume content
+✅ DO: Count elements literally (keywords, achievements, verbs)
+✅ DO: Consider industry norms (nurses don't need GitHub)
+✅ DO: Be actionable - tell them exactly what to change
-${RESUME_CALIBRATION_EXAMPLES}
+❌ DON'T: Give vague feedback like "add more metrics"
+❌ DON'T: Estimate - actually count elements
+❌ DON'T: Give the same feedback to every resume
+❌ DON'T: Conflate "different from ideal" with "wrong"
-${SCORING_PHASES}
+## OUTPUT FORMAT
-${SCORE_INTERPRETATION_GUIDE}`;
+Return a structured JSON response with all required fields.
+Be specific and reference actual content from the resume in your feedback.
+Every suggestion should be actionable with concrete examples.`;
diff --git a/src/lib/ai/prompts/resume-review/user.ts b/src/lib/ai/prompts/resume-review/user.ts
index c2ca476..b363445 100644
--- a/src/lib/ai/prompts/resume-review/user.ts
+++ b/src/lib/ai/prompts/resume-review/user.ts
@@ -1,64 +1,64 @@
/**
- * Resume Review User Prompts
- *
- * Functions to construct user prompts for resume analysis.
+ * Resume Review User Prompt
+ * Constructs the user prompt for comprehensive resume analysis
*/
/**
- * Build user prompt for resume review with chain-of-thought instructions
+ * Build user prompt for comprehensive resume review
*/
export function buildResumeReviewPrompt(resumeText: string): string {
- return `Analyze this resume using your expert methodology.
+ return `Analyze this resume thoroughly and return a structured JSON response.
-## YOUR TASK
+## RESUME TO ANALYZE:
-Follow the 5-phase analytical process from your training:
+${resumeText}
-### PHASE 1: RECONNAISSANCE
-- What industry/role is this resume for?
-- What career stage (entry/mid/senior/executive)?
-- Adjust your baseline expectations accordingly.
+## ANALYSIS INSTRUCTIONS:
-### PHASE 2: FORENSIC COUNTING (be literal)
-Count these elements EXACTLY:
-- Quantified achievements (%, $, numbers)
-- Technical/industry keywords
-- Strong vs weak action verbs
+1. **Scores** - Assess the resume on multiple dimensions:
+ - overall: Overall quality score (0-100)
+ - impact: Achievement impact and measurable results
+ - clarity: Organization, readability, professional writing
+ - atsCompatibility: ATS-friendliness, proper formatting
-### PHASE 3: QUALITATIVE ASSESSMENT
-Evaluate:
-- Formatting quality (visual hierarchy, ATS-friendliness)
-- Professional summary effectiveness
-- Experience clarity (STAR format, progression)
-- Skills section organization
-- Grammar/spelling
+2. **Achievements** - Categorize achievements found:
+ - strong: Quote achievements with numbers/metrics
+ - weak: Quote vague statements needing quantification
+ - missingMetrics: Suggest specific metrics to add
-### PHASE 4: CALCULATE & SHOW MATH
-"Keywords: X + Quantified: Y + Verbs: Z + Formatting: A + Summary: B + Clarity: C + Skills: D + Grammar: E = TOTAL"
+3. **Keywords** - Analyze keyword presence:
+ - found: Technical skills, tools, methodologies present
+ - missing: Important keywords for the role that should be added
+ - overused: Buzzwords or clichés used excessively
-### PHASE 5: SELF-CRITIQUE
-Before finalizing:
-□ Did I count actual elements (not estimate)?
-□ Is my score realistic for this career stage?
-□ Are my suggestions SPECIFIC to THIS resume?
-□ Did I include at least one HIGH-IMPACT improvement?
+4. **Action Verbs** - Assess language strength:
+ - strong: Powerful verbs like Led, Architected, Delivered
+ - weak: Weak verbs like "Responsible for", "Helped with"
+ - suggestions: Specific replacement recommendations
----
+5. **Section Feedback** - Evaluate each resume section:
+ - Key by section name (Summary, Experience, Skills, Education, etc.)
+ - Provide status (good/needsWork/missing) and specific feedback
-## RESUME TO ANALYZE:
-
-${resumeText}
+6. **ATS Issues** - List formatting/content issues:
+ - Tables, graphics, unusual fonts
+ - Missing standard sections
+ - Parsing problems
----
+7. **Top Improvements** - Prioritize 3-5 changes:
+ - Rank by impact (priority 1 = highest)
+ - Be specific about issue and fix
-## OUTPUT REQUIREMENTS
+8. **Grammar and Spelling** - Note all errors:
+ - Quote exact text with errors
+ - Note punctuation inconsistencies
+ - Flag consistency issues (tense, formatting)
-Provide your structured assessment with:
-1. **score**: Your calculated total (0-100)
-2. **summary**: 2-3 sentences mentioning the score, top strength, and top weakness
-3. **strengths**: 3-5 specific strengths WITH evidence from the resume
-4. **weaknesses**: 3-5 specific weaknesses with WHY they matter
-5. **suggestions**: 3-5 actionable improvements with EXACTLY what to do
+9. **Summary** - 2-3 sentence assessment:
+ - Mention overall score
+ - Highlight top strength
+ - Note most impactful improvement
-Remember: Reference SPECIFIC text from this resume. No generic feedback.`;
+Be specific and reference actual content from this resume.
+Every suggestion must be actionable with concrete examples.`;
}
diff --git a/src/lib/ai/prompts/shared/index.ts b/src/lib/ai/prompts/shared/index.ts
deleted file mode 100644
index 98ba067..0000000
--- a/src/lib/ai/prompts/shared/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * Shared Prompts - Barrel File
- */
-
-export { CRITIC_SYSTEM_PROMPT, buildCriticPrompt } from "./validation";
diff --git a/src/lib/ai/prompts/shared/validation.ts b/src/lib/ai/prompts/shared/validation.ts
deleted file mode 100644
index 395729e..0000000
--- a/src/lib/ai/prompts/shared/validation.ts
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Validation and Critic Prompts
- *
- * System prompts and builders for quality assurance validation of AI analysis.
- * Used by both resume review and job match features.
- */
-
-/**
- * Critic validation prompt - validates first agent's work
- */
-export const CRITIC_SYSTEM_PROMPT = `You are an elite quality assurance specialist for AI-generated career assessments. Your role is to catch errors, validate accuracy, and ensure actionable value.
-
-## YOUR MISSION
-Review another AI's analysis and determine if it meets quality standards. You are the last line of defense against bad advice reaching job seekers.
-
-## VALIDATION FRAMEWORK
-
-### 1. MATHEMATICAL ACCURACY (Critical)
-□ Does the final score equal the sum of component scores?
-□ Are all component scores within valid ranges?
- - Keywords: 0-20, Quantified: 0-25, Verbs: 0-10, Formatting: 0-15
- - Summary: 0-10, Clarity: 0-10, Skills: 0-5, Grammar: 0-5
-□ Is the score realistic for the resume type?
- - Entry-level: typically 35-50
- - Mid-level: typically 45-65
- - Senior: typically 55-75
- - Exceptional: rarely >80
-□ Flag if: Score doesn't match stated math, or extreme scores without justification
-
-### 2. EVIDENCE QUALITY (Critical)
-□ Did the analyzer QUOTE specific text from the resume?
-□ Are counts actual counts, not estimates? ("Found 5 achievements" vs "several achievements")
-□ Is each strength backed by a specific example?
-□ Is each weakness tied to something concrete (or missing)?
-□ Flag if: Generic statements like "good formatting" without specifics
-
-### 3. ACTIONABILITY CHECK (Important)
-□ Can the candidate actually DO each suggestion?
-□ Are suggestions specific enough?
- - Bad: "Add more metrics"
- - Good: "Your 'Improved sales' bullet should specify the % increase"
-□ Is there at least one high-impact suggestion?
-□ Are suggestions prioritized or ranked?
-□ Flag if: Vague, generic, or impossible-to-implement suggestions
-
-### 4. CONSISTENCY CHECK (Important)
-□ Does a high score come with strong strengths?
-□ Does a low score come with significant weaknesses?
-□ Do suggestions address the identified weaknesses?
-□ Is the summary consistent with the detailed feedback?
-□ Flag if: Score says 70 but feedback is mostly negative (or vice versa)
-
-### 5. COMPLETENESS CHECK (Basic)
-□ Are all required fields present and populated?
-□ At least 2-3 strengths, weaknesses, and suggestions?
-□ Is the summary 2-3 informative sentences?
-□ Flag if: Empty fields, single-item lists, or one-sentence summary
-
-### 6. COMMON AI MISTAKES TO CATCH
-□ Hallucinated skills (claiming resume has X when it doesn't)
-□ Missed obvious elements (ignoring stated metrics)
-□ Industry-inappropriate feedback (asking nurse for GitHub)
-□ Overly harsh or overly generous scoring
-□ Repetitive feedback (same point stated multiple ways)
-□ Generic template responses (could apply to any resume)
-
-## YOUR RESPONSE FORMAT
-
-**VERDICT: [APPROVED / NEEDS REVISION / REJECTED]**
-
-**SCORE VALIDATION:**
-- Stated math: [X+Y+Z = Total]
-- Actual calculation: [Your verification]
-- Score appropriateness: [Realistic for this resume type?]
-
-**EVIDENCE QUALITY:**
-- Specific quotes found: [Yes/No, examples]
-- Counting accuracy: [Verified/Not verified]
-
-**ACTIONABILITY:**
-- Implementable suggestions: [X of Y]
-- Highest-impact suggestion: [Which one?]
-
-**ISSUES FOUND:** (if any)
-1. [Issue 1 - severity: Critical/Important/Minor]
-2. [Issue 2 - severity]
-
-**RECOMMENDED CORRECTIONS:** (if NEEDS REVISION)
-- [Specific fix needed]
-
-## DECISION CRITERIA
-- **APPROVED**: No critical issues, ≤2 minor issues
-- **NEEDS REVISION**: 1-2 important issues OR 3+ minor issues
-- **REJECTED**: Any critical issue (wrong math, hallucinated content, harmful advice)`;
-
-/**
- * Build critic validation prompt
- */
-export function buildCriticPrompt(
- originalAnalysis: string,
- resumeOrJobText: string
-): string {
- return `Validate this AI-generated analysis for quality and accuracy.
-
-## ANALYSIS TO VALIDATE:
-${originalAnalysis}
-
-## ORIGINAL SOURCE DOCUMENT:
-${resumeOrJobText}
-
-## YOUR TASK:
-1. Verify all math calculations
-2. Check that claims are supported by the source document
-3. Evaluate actionability of suggestions
-4. Check for consistency between score and feedback
-5. Identify any hallucinations or errors
-
-Provide your structured verdict with specific findings.`;
-}
diff --git a/src/lib/ai/tools/achievement.ts b/src/lib/ai/tools/achievement.ts
deleted file mode 100644
index 20be7bb..0000000
--- a/src/lib/ai/tools/achievement.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Achievement Analysis Tools
- * Extract and analyze quantified achievements from text
- */
-
-// ...existing code...
diff --git a/src/lib/ai/tools/formatting.ts b/src/lib/ai/tools/formatting.ts
deleted file mode 100644
index b137366..0000000
--- a/src/lib/ai/tools/formatting.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Text Formatting Analysis Tools
- * Analyze text structure and formatting quality
- */
-
-// ...existing code...
diff --git a/src/lib/ai/tools/index.ts b/src/lib/ai/tools/index.ts
index d43e6d8..e3ba86c 100644
--- a/src/lib/ai/tools/index.ts
+++ b/src/lib/ai/tools/index.ts
@@ -18,13 +18,7 @@ export { AIUnavailableError } from "./errors";
// ...existing code...
// Semantic extraction (LLM-powered)
-export {
- extractSemanticKeywords,
- analyzeActionVerbs,
- performSemanticSkillMatch,
- getKeywordCountFromSemantic,
- getVerbCountFromSemantic,
-} from "./semantic-extraction";
+export { performSemanticSkillMatch } from "./semantic-extraction";
// Semantic similarity (LLM-powered)
export {
diff --git a/src/lib/ai/tools/preprocessing.ts b/src/lib/ai/tools/preprocessing.ts
index 37604b6..076cae7 100644
--- a/src/lib/ai/tools/preprocessing.ts
+++ b/src/lib/ai/tools/preprocessing.ts
@@ -293,7 +293,6 @@ export const preprocessResume = async (
// Full validation
const validationResult = validateResume(normalizedText, metadata);
- console.log("RESUME: ", { normalizedText, metadata });
if (!validationResult.isValid) {
return {
success: false,
diff --git a/src/lib/ai/tools/semantic-extraction.ts b/src/lib/ai/tools/semantic-extraction.ts
index 4658ce8..48cdb0f 100644
--- a/src/lib/ai/tools/semantic-extraction.ts
+++ b/src/lib/ai/tools/semantic-extraction.ts
@@ -7,127 +7,36 @@
import { generateText, Output } from "ai";
import { getModel, ProviderType } from "../providers";
import {
- SemanticKeywordSchema,
- ActionVerbAnalysisSchema,
+ CombinedResumeAnalysisSchema,
SemanticSkillMatchSchema,
- type SemanticKeywordExtraction,
- type ActionVerbAnalysis,
+ type CombinedResumeAnalysis,
type SemanticSkillMatch,
} from "@/models/ai.schemas";
-import {
- getKeywordPrompt,
- getVerbPrompt,
- getSkillMatchPrompt,
-} from "../prompts";
+// ...existing code...
+import { getSkillMatchPrompt } from "../prompts";
import {
isOllamaProvider,
- OllamaSemanticKeywordSchema,
- OllamaActionVerbSchema,
+ OllamaCombinedResumeAnalysisSchema,
OllamaSkillMatchSchema,
- normalizeKeywordExtraction,
- normalizeActionVerbAnalysis,
+ normalizeCombinedResumeAnalysis,
normalizeSkillMatch,
- type OllamaSemanticKeywordExtraction,
- type OllamaActionVerbAnalysis,
- type OllamaSkillMatch,
} from "../ollama";
import { AIUnavailableError } from "./errors";
/**
- * Extract keywords using LLM for dynamic, semantic understanding
- * Replaces hard-coded keyword lists with intelligent extraction
+ * Extract keywords and analyze action verbs in a single LLM call
+ * Replaces two separate calls with one optimized call
*
* Benefits:
- * - Automatically adapts to new technologies
- * - Understands context (e.g., "python" in programming vs biology)
- * - Recognizes synonyms and variations (k8s = kubernetes)
- * - No maintenance required for keyword lists
- *
- * @param text - Resume or job description text
- * @param provider - AI provider (ollama/openai)
- * @param modelName - Model to use for extraction
- * @param contextHint - Optional hint about domain (e.g., "software engineering", "healthcare")
- */
-export async function extractSemanticKeywords(
- text: string,
- provider: ProviderType = "ollama",
- modelName: string = "llama3.2",
- contextHint?: string
-): Promise<SemanticKeywordExtraction> {
- const model = getModel(provider, modelName);
- const prompt = getKeywordPrompt(provider, text, contextHint);
-
- try {
- if (isOllamaProvider(provider)) {
- const { output } = await generateText({
- model,
- output: Output.object({ schema: OllamaSemanticKeywordSchema }),
- prompt,
- temperature: 0.1,
- });
- return normalizeKeywordExtraction(output);
- }
-
- const { output } = await generateText({
- model,
- output: Output.object({ schema: SemanticKeywordSchema }),
- prompt,
- temperature: 0.1,
- });
-
- return output;
- } catch (error) {
- console.error("Semantic keyword extraction failed:", error);
- throw new AIUnavailableError("keyword extraction");
- }
-}
-
-/**
- * Analyze action verbs using LLM for semantic strength assessment
- * Replaces hard-coded verb lists with intelligent analysis
- *
- * Benefits:
- * - Understands verb strength in context
- * - Identifies passive constructions
- * - Provides specific improvement suggestions
- * - Recognizes weak phrases like "responsible for"
+ * - 50% faster (one LLM call vs two)
+ * - Lower token usage
+ * - Better context sharing between keyword and verb analysis
*
* @param text - Resume text to analyze
* @param provider - AI provider (ollama/openai)
* @param modelName - Model to use for analysis
+ * @param contextHint - Optional hint about domain (e.g., "software engineering")
*/
-export async function analyzeActionVerbs(
- text: string,
- provider: ProviderType = "ollama",
- modelName: string = "llama3.2"
-): Promise<ActionVerbAnalysis> {
- const model = getModel(provider, modelName);
- const prompt = getVerbPrompt(provider, text);
-
- try {
- if (isOllamaProvider(provider)) {
- const { output } = await generateText({
- model,
- output: Output.object({ schema: OllamaActionVerbSchema }),
- prompt,
- temperature: 0.2,
- });
- return normalizeActionVerbAnalysis(output);
- }
-
- const { output } = await generateText({
- model,
- output: Output.object({ schema: ActionVerbAnalysisSchema }),
- prompt,
- temperature: 0.2,
- });
-
- return output;
- } catch (error) {
- console.error("Action verb analysis failed:", error);
- throw new AIUnavailableError("action verb analysis");
- }
-}
/**
* Perform semantic skill matching between resume and job
@@ -148,7 +57,7 @@ export async function performSemanticSkillMatch(
resumeText: string,
jobText: string,
provider: ProviderType = "ollama",
- modelName: string = "llama3.2"
+ modelName: string = "llama3.2",
): Promise<SemanticSkillMatch> {
const model = getModel(provider, modelName);
const prompt = getSkillMatchPrompt(provider, resumeText, jobText);
@@ -172,32 +81,31 @@ export async function performSemanticSkillMatch(
});
// Post-process cloud result to remove empty strings and duplicates
- const cloudResult = output;
const cleanedResult = {
- exact_matches: cloudResult.exact_matches.filter(
+ exact_matches: output.exact_matches.filter(
(match) =>
match.skill.trim() &&
match.resume_evidence.trim() &&
- match.job_requirement.trim()
+ match.job_requirement.trim(),
),
- related_matches: cloudResult.related_matches.filter(
+ related_matches: output.related_matches.filter(
(match) =>
match.job_skill.trim() &&
match.resume_skill.trim() &&
- match.explanation.trim()
+ match.explanation.trim(),
),
- missing_skills: cloudResult.missing_skills.filter((skill) =>
- skill.skill.trim()
+ missing_skills: output.missing_skills.filter((skill) =>
+ skill.skill.trim(),
),
- overall_match_percentage: cloudResult.overall_match_percentage,
+ overall_match_percentage: output.overall_match_percentage,
};
// Remove duplicate skills from missing_skills if they're in exact_matches
const exactSkills = new Set(
- cleanedResult.exact_matches.map((m) => m.skill.toLowerCase())
+ cleanedResult.exact_matches.map((m) => m.skill.toLowerCase()),
);
cleanedResult.missing_skills = cleanedResult.missing_skills.filter(
- (m) => !exactSkills.has(m.skill.toLowerCase())
+ (m) => !exactSkills.has(m.skill.toLowerCase()),
);
return cleanedResult;
@@ -206,19 +114,3 @@ export async function performSemanticSkillMatch(
throw new AIUnavailableError("skill matching");
}
}
-
-/**
- * Get keyword count from semantic extraction (for backward compatibility)
- */
-export function getKeywordCountFromSemantic(
- extraction: SemanticKeywordExtraction
-): number {
- return extraction.total_count;
-}
-
-/**
- * Get verb count from semantic analysis (for backward compatibility)
- */
-export function getVerbCountFromSemantic(analysis: ActionVerbAnalysis): number {
- return analysis.strong_verbs.length;
-}
diff --git a/src/models/ai.ollama-schemas.ts b/src/models/ai.ollama-schemas.ts
index 79f6fb0..87a3d90 100644
--- a/src/models/ai.ollama-schemas.ts
+++ b/src/models/ai.ollama-schemas.ts
@@ -35,6 +35,14 @@ export const OllamaActionVerbSchema = z.object({
.describe("Overall strength 0-10"),
});
+/**
+ * Combined schema for Ollama resume analysis (keywords + verbs)
+ */
+export const OllamaCombinedResumeAnalysisSchema = z.object({
+ keywords: OllamaSemanticKeywordSchema.describe("Skills and keywords"),
+ verbs: OllamaActionVerbSchema.describe("Action verb analysis"),
+});
+
/**
* Simplified skill matching schema for Ollama
* Flatter structure with simpler matched_skills array
@@ -45,7 +53,7 @@ export const OllamaSkillMatchSchema = z.object({
z.object({
skill: z.string(),
evidence: z.string(),
- })
+ }),
)
.describe("Skills found in both"),
missing_skills: z.array(z.string()).describe("Required but not in resume"),
@@ -67,6 +75,9 @@ export type OllamaSemanticKeywordExtraction = z.infer<
typeof OllamaSemanticKeywordSchema
>;
export type OllamaActionVerbAnalysis = z.infer<typeof OllamaActionVerbSchema>;
+export type OllamaCombinedResumeAnalysis = z.infer<
+ typeof OllamaCombinedResumeAnalysisSchema
+>;
export type OllamaSkillMatch = z.infer<typeof OllamaSkillMatchSchema>;
export type OllamaSemanticSimilarity = z.infer<
typeof OllamaSemanticSimilaritySchema
diff --git a/src/models/ai.schemas.ts b/src/models/ai.schemas.ts
index a0c022a..e0b887e 100644
--- a/src/models/ai.schemas.ts
+++ b/src/models/ai.schemas.ts
@@ -1,101 +1,136 @@
import { z } from "zod";
-/**
- * Schema for resume review AI response.
- * Uses .describe() to guide the LLM on expected output.
- *
- * Key principles for better output:
- * - Force specific examples from the actual resume
- * - Require evidence-based feedback
- * - Ensure actionable suggestions
- */
-export const ResumeReviewSchema = z.object({
- score: z
+// COMPREHENSIVE RESUME REVIEW SCHEMA
+// Single LLM call with detailed structured output
+
+const ScoresSchema = z.object({
+ overall: z
.number()
.min(0)
.max(100)
- .describe(
- `MUST be a number 0-100. Calculate as sum of 8 criteria:
- - Keywords (0-20): Technical terms, tools, methodologies found
- - Quantified Achievements (0-25): Numbers, %, $, metrics in bullets
- - Action Verbs (0-10): Strong verbs like Led, Architected, Delivered
- - Formatting (0-15): Visual hierarchy, bullets, spacing, ATS-friendly
- - Summary (0-10): Clear value proposition, role target
- - Clarity (0-10): STAR format, clear progression, dates
- - Skills (0-5): Organized, relevant, no fluff
- - Grammar (0-5): Error-free, consistent tense
-
- Realistic ranges: Entry-level 35-50, Mid 45-65, Senior 55-75, Exceptional >75.
- NEVER return 0 unless resume is blank. Most resumes score 45-65.`
- ),
- summary: z.string().describe(
- `2-3 sentences that MUST include:
- 1. The score with interpretation (e.g., "This resume scores 58/100, placing it in the average range")
- 2. The single biggest strength (with brief evidence)
- 3. The single most impactful area to improve
+ .describe("Overall resume score 0-100. Entry-level: 35-50, Mid: 45-65, Senior: 55-75, Exceptional: >75"),
+ impact: z
+ .number()
+ .min(0)
+ .max(100)
+ .describe("Impact score based on quantified achievements, measurable results, and business value demonstrated"),
+ clarity: z
+ .number()
+ .min(0)
+ .max(100)
+ .describe("Clarity score based on readability, organization, STAR format usage, and professional writing"),
+ atsCompatibility: z
+ .number()
+ .min(0)
+ .max(100)
+ .describe("ATS compatibility score based on formatting, keywords, standard sections, and parsability"),
+});
- Example: "This resume scores 62/100, which is above average. The standout strength is the 6 quantified achievements including '40% cost reduction' and '$2M revenue impact'. The highest-impact improvement would be adding a stronger professional summary that clearly articulates your value proposition."`
- ),
- strengths: z
+const AchievementsSchema = z.object({
+ strong: z
.array(z.string())
- .min(2)
- .max(5)
- .describe(
- `List 2-5 specific strengths with EVIDENCE from the resume.
+ .describe("List achievements with measurable impact (numbers, %, $). Quote actual text from resume."),
+ weak: z
+ .array(z.string())
+ .describe("List vague statements that need quantification. Quote actual text that lacks metrics."),
+ missingMetrics: z
+ .array(z.string())
+ .describe("Suggest specific metrics that could be added (e.g., 'Add team size to Managed project' or 'Quantify cost savings')"),
+});
- Format: "[Category]: [Specific evidence quoted or referenced]"
+const KeywordsSchema = z.object({
+ found: z
+ .array(z.string())
+ .describe("Relevant industry/role keywords present in resume (technologies, tools, methodologies, domain terms)"),
+ missing: z
+ .array(z.string())
+ .describe("Important keywords that should be added based on typical role requirements"),
+ overused: z
+ .array(z.string())
+ .describe("Buzzwords or clichés used too frequently (e.g., 'synergy', 'results-driven', 'team player')"),
+});
- Good examples:
- - "Strong quantified impact: Your bullet 'Reduced customer churn by 25% saving $500K annually' demonstrates clear business value"
- - "Technical depth: Listing 12 relevant technologies (React, Node, AWS, etc.) shows comprehensive skill set"
- - "Clear progression: Promotion from Engineer to Senior Engineer in 2 years shows growth"
+const VerbSuggestionSchema = z.object({
+ replace: z.string().describe("Weak verb to replace"),
+ with: z.string().describe("Stronger alternative verb"),
+});
- Bad examples (too vague):
- - "Good experience" (no specifics)
- - "Nice formatting" (no evidence)
- - "Strong skills" (which skills?)`
- ),
- weaknesses: z
+const ActionVerbsSchema = z.object({
+ strong: z
.array(z.string())
- .min(2)
- .max(5)
- .describe(
- `List 2-5 specific weaknesses with WHY they matter.
-
- Format: "[Issue]: [Why it hurts your candidacy]"
+ .describe("Powerful verbs used effectively (e.g., Led, Architected, Spearheaded, Delivered, Transformed)"),
+ weak: z
+ .array(z.string())
+ .describe("Weak verbs that should be replaced (e.g., 'Responsible for', 'Helped with', 'Worked on')"),
+ suggestions: z
+ .array(VerbSuggestionSchema)
+ .describe("Specific verb replacement suggestions with context"),
+});
- Good examples:
- - "Missing metrics in 3 of 5 job bullets: 'Managed client relationships' lacks the impact numbers that recruiters scan for"
- - "No professional summary: Recruiters spend 6 seconds scanning - without a summary, your key qualifications may be missed"
- - "Weak action verbs: 'Responsible for' and 'Helped with' don't convey ownership; use 'Led', 'Delivered', 'Drove'"
+const SectionFeedbackItemSchema = z.object({
+ status: z.enum(["good", "needsWork", "missing"]).describe("Section status assessment"),
+ feedback: z.string().describe("Specific actionable advice for this section"),
+});
- Bad examples (not actionable):
- - "Could be better" (how?)
- - "Needs more detail" (where?)
- - "Formatting issues" (what specifically?)`
- ),
- suggestions: z
- .array(z.string())
- .min(2)
- .max(5)
- .describe(
- `List 2-5 actionable improvements with EXACTLY what to do.
+const ImprovementSchema = z.object({
+ priority: z.number().min(1).max(5).describe("Priority ranking 1-5, where 1 is highest priority"),
+ issue: z.string().describe("What's wrong - be specific"),
+ fix: z.string().describe("How to fix it - be actionable"),
+});
- Format: "[Action verb]: [Specific instruction with example if possible]"
+const GrammarErrorSchema = z.object({
+ text: z.string().describe("Exact text containing the error"),
+ issue: z.string().describe("What's wrong with it"),
+ correction: z.string().describe("Corrected version"),
+});
- Good examples:
- - "Quantify your 'Improved team efficiency' bullet: Add the % improvement or hours saved, e.g., 'Improved team efficiency by 30%, saving 10 hours/week'"
- - "Add a professional summary: Start with '[Title] with [X years] experience in [key skill]. Known for [top achievement]. Seeking [target role]'"
- - "Replace 'Responsible for managing' with 'Managed' or better yet 'Led' - active voice is more impactful"
+const GrammarAndSpellingSchema = z.object({
+ errors: z
+ .array(GrammarErrorSchema)
+ .describe("Grammar and spelling errors found"),
+ punctuationIssues: z
+ .array(z.string())
+ .describe("Punctuation issues (e.g., inconsistent periods, comma problems)"),
+ consistencyIssues: z
+ .array(z.string())
+ .describe("Consistency issues (e.g., tense shifts, formatting inconsistencies, date format variations)"),
+});
- Bad examples (too vague):
- - "Add more numbers" (where? what kind?)
- - "Improve your summary" (how specifically?)
- - "Use better verbs" (which ones? where?)`
- ),
+/**
+ * Comprehensive Resume Review Schema
+ * Single LLM call returns all analysis in structured format
+ */
+export const ResumeReviewSchema = z.object({
+ scores: ScoresSchema.describe("Multiple score dimensions for nuanced assessment"),
+ achievements: AchievementsSchema.describe("Achievement quality assessment with specific examples"),
+ keywords: KeywordsSchema.describe("Keyword relevance analysis"),
+ actionVerbs: ActionVerbsSchema.describe("Action verb strength analysis with suggestions"),
+ sectionFeedback: z
+ .record(z.string(), SectionFeedbackItemSchema)
+ .describe("Section-by-section feedback keyed by section name (e.g., 'Summary', 'Experience', 'Skills', 'Education')"),
+ atsIssues: z
+ .array(z.string())
+ .describe("Formatting or content issues that may cause ATS rejection (tables, graphics, unusual fonts, missing sections)"),
+ topImprovements: z
+ .array(ImprovementSchema)
+ .min(3)
+ .max(5)
+ .describe("Top 3-5 prioritized improvement suggestions"),
+ grammarAndSpelling: GrammarAndSpellingSchema.describe("Grammar, spelling, and consistency analysis"),
+ summary: z
+ .string()
+ .describe("2-3 sentence overall assessment mentioning overall score, top strength, and most impactful improvement area"),
});
export type ResumeReviewResponse = z.infer<typeof ResumeReviewSchema>;
+export type ResumeScores = z.infer<typeof ScoresSchema>;
+export type ResumeAchievements = z.infer<typeof AchievementsSchema>;
+export type ResumeKeywords = z.infer<typeof KeywordsSchema>;
+export type ResumeActionVerbs = z.infer<typeof ActionVerbsSchema>;
+export type SectionFeedback = z.infer<typeof SectionFeedbackItemSchema>;
+export type ResumeImprovement = z.infer<typeof ImprovementSchema>;
+export type GrammarError = z.infer<typeof GrammarErrorSchema>;
+export type GrammarAndSpelling = z.infer<typeof GrammarAndSpellingSchema>;
/**
* Schema for analysis category used in job match response.
@@ -111,7 +146,7 @@ const AnalysisCategorySchema = z.object({
- "Experience Match (18/25 pts)"
- "Keyword Overlap (14/20 pts)"
- "Qualifications (10/15 pts)"
- - "Industry Fit (7/10 pts)"`
+ - "Industry Fit (7/10 pts)"`,
),
value: z.array(z.string()).describe(
`List of specific observations with EVIDENCE.
@@ -129,7 +164,7 @@ const AnalysisCategorySchema = z.object({
For Keyword Overlap:
- "Found: React, TypeScript, Node.js, AWS, Docker, Agile, REST API (7 of 10)"
- - "Missing: Kubernetes, Redis, GraphQL (3 of 10)"`
+ - "Missing: Kubernetes, Redis, GraphQL (3 of 10)"`,
),
});
@@ -160,7 +195,7 @@ export const JobMatchSchema = z.object({
- <35: Poor match, may not be right fit
Most candidates score 40-60 against any given job.
- NEVER return 0 unless completely unrelated industry/role.`
+ NEVER return 0 unless completely unrelated industry/role.`,
),
detailed_analysis: z
.array(AnalysisCategorySchema)
@@ -178,7 +213,7 @@ export const JobMatchSchema = z.object({
4. "Qualifications (X/15 pts)" - Education, certifications match
5. "Industry Fit (X/10 pts)" - Domain knowledge assessment
- Each category MUST have specific evidence, not vague statements.`
+ Each category MUST have specific evidence, not vague statements.`,
),
suggestions: z
.array(AnalysisCategorySchema)
@@ -206,7 +241,7 @@ export const JobMatchSchema = z.object({
- New skills to learn for better match
- Example: ["Learn GraphQL fundamentals", "Get hands-on with PostgreSQL"]
- Each suggestion must be SPECIFIC and IMPLEMENTABLE.`
+ Each suggestion must be SPECIFIC and IMPLEMENTABLE.`,
),
additional_comments: z
.array(z.string())
@@ -229,7 +264,7 @@ export const JobMatchSchema = z.object({
- "Recommendation: Consider upskilling in [X] before applying"
- "Recommendation: This role may not be the best fit currently"
- Be direct and honest about fit. Don't sugarcoat poor matches.`
+ Be direct and honest about fit. Don't sugarcoat poor matches.`,
),
});
@@ -247,27 +282,27 @@ export const SemanticKeywordSchema = z.object({
technical_skills: z.array(z.string()).describe(
`Programming languages, frameworks, libraries extracted from text.
Examples: ["Python", "React", "TypeScript", "Django", "TensorFlow"]
- Be comprehensive - extract ALL technical skills mentioned.`
+ Be comprehensive - extract ALL technical skills mentioned.`,
),
tools_platforms: z.array(z.string()).describe(
`Development tools, platforms, services, and cloud providers.
Examples: ["Docker", "Kubernetes", "AWS", "GitHub Actions", "JIRA", "Figma"]
- Include both infrastructure and productivity tools.`
+ Include both infrastructure and productivity tools.`,
),
methodologies: z.array(z.string()).describe(
`Development methodologies, practices, and processes.
Examples: ["Agile", "Scrum", "TDD", "CI/CD", "DevOps", "Microservices"]
- Include architectural patterns and best practices.`
+ Include architectural patterns and best practices.`,
),
domain_knowledge: z.array(z.string()).describe(
`Industry-specific knowledge and compliance frameworks.
Examples: ["Healthcare", "HIPAA", "FinTech", "SOX", "GDPR", "FDA regulations"]
- Include certifications and domain expertise.`
+ Include certifications and domain expertise.`,
),
soft_skills: z.array(z.string()).describe(
`Leadership and interpersonal skills mentioned.
Examples: ["Team leadership", "Cross-functional collaboration", "Mentoring"]
- Only include if explicitly stated or clearly demonstrated.`
+ Only include if explicitly stated or clearly demonstrated.`,
),
total_count: z
.number()
@@ -291,14 +326,14 @@ export const ActionVerbAnalysisSchema = z.object({
impact_level: z
.enum(["high", "medium"])
.describe(
- "High: Led, Architected, Spearheaded, Delivered. Medium: Managed, Developed, Implemented"
+ "High: Led, Architected, Spearheaded, Delivered. Medium: Managed, Developed, Implemented",
),
- })
+ }),
)
.describe(
`Strong action verbs that demonstrate ownership and impact.
High impact: Led, Architected, Spearheaded, Delivered, Drove, Built, Scaled, Transformed
- Medium impact: Managed, Developed, Implemented, Created, Designed, Coordinated`
+ Medium impact: Managed, Developed, Implemented, Created, Designed, Coordinated`,
),
weak_verbs: z
.array(
@@ -310,12 +345,12 @@ export const ActionVerbAnalysisSchema = z.object({
suggestion: z
.string()
.describe("Stronger alternative verb to use instead"),
- })
+ }),
)
.describe(
`Weak verbs/phrases that reduce impact.
Examples: "Responsible for", "Helped with", "Assisted in", "Worked on", "Involved in"
- These should be replaced with action-oriented alternatives.`
+ These should be replaced with action-oriented alternatives.`,
),
verb_strength_score: z
.number()
@@ -326,12 +361,29 @@ export const ActionVerbAnalysisSchema = z.object({
0-3: Mostly passive language
4-6: Mix of strong and weak verbs
7-8: Predominantly strong verbs
- 9-10: Exceptional action-oriented language throughout`
+ 9-10: Exceptional action-oriented language throughout`,
),
});
export type ActionVerbAnalysis = z.infer<typeof ActionVerbAnalysisSchema>;
+/**
+ * Combined schema for resume analysis (keywords + verbs)
+ * Single LLM call instead of two separate calls
+ */
+export const CombinedResumeAnalysisSchema = z.object({
+ keywords: SemanticKeywordSchema.describe(
+ "All keywords and skills extracted from the resume",
+ ),
+ verbs: ActionVerbAnalysisSchema.describe(
+ "Action verb analysis with strength assessment",
+ ),
+});
+
+export type CombinedResumeAnalysis = z.infer<
+ typeof CombinedResumeAnalysisSchema
+>;
+
/**
* Schema for skill matching between resume and job
* Provides semantic similarity scoring, not just string matching
@@ -349,7 +401,7 @@ export const SemanticSkillMatchSchema = z.object({
.string()
.min(1)
.describe("Quote from job showing this requirement"),
- })
+ }),
)
.describe("Skills that match exactly between resume and job"),
related_matches: z
@@ -366,10 +418,10 @@ export const SemanticSkillMatchSchema = z.object({
.string()
.min(1)
.describe("Why these skills are related/transferable"),
- })
+ }),
)
.describe(
- "Skills that are related/similar but not exact matches (e.g., React vs Vue, PostgreSQL vs MySQL)"
+ "Skills that are related/similar but not exact matches (e.g., React vs Vue, PostgreSQL vs MySQL)",
),
missing_skills: z
.array(
@@ -381,9 +433,9 @@ export const SemanticSkillMatchSchema = z.object({
learnability: z
.enum(["quick", "moderate", "significant"])
.describe(
- "How quickly this could be learned: quick (<1 month), moderate (1-3 months), significant (3+ months)"
+ "How quickly this could be learned: quick (<1 month), moderate (1-3 months), significant (3+ months)",
),
- })
+ }),
)
.describe("Skills required by job but not found in resume"),
overall_match_percentage: z
@@ -391,7 +443,7 @@ export const SemanticSkillMatchSchema = z.object({
.min(0)
.max(100)
.describe(
- "Overall skill match percentage considering exact + related matches"
+ "Overall skill match percentage considering exact + related matches",
),
});
@@ -423,13 +475,13 @@ export const SemanticSimilaritySchema = z.object({
65-79: Strong fit
50-64: Moderate fit
35-49: Weak fit
- 0-34: Poor fit`
+ 0-34: Poor fit`,
),
match_explanation: z.string().describe(
`2-3 sentence explanation of why this candidate is/isn't a good fit.
Start with the key reason (e.g., "Strong technical alignment with 80% skill match...")
- Include both positives and concerns.`
+ Include both positives and concerns.`,
),
key_matches: z
@@ -439,7 +491,7 @@ export const SemanticSimilaritySchema = z.object({
.describe(
`Top 3-5 areas where candidate strongly matches requirements.
Examples: "5+ years React experience matches requirement",
- "Led team of 8 engineers, exceeds leadership requirement"`
+ "Led team of 8 engineers, exceeds leadership requirement"`,
),
key_gaps: z
@@ -449,12 +501,12 @@ export const SemanticSimilaritySchema = z.object({
note: z
.string()
.describe("Brief note on gap severity or how to address"),
- })
+ }),
)
.max(5)
.describe(
`Top 3-5 gaps between resume and job requirements.
- Include severity/importance of each gap.`
+ Include severity/importance of each gap.`,
),
transferable_skills: z
@@ -465,12 +517,12 @@ export const SemanticSimilaritySchema = z.object({
how_it_transfers: z
.string()
.describe("Brief explanation of transferability"),
- })
+ }),
)
.max(4)
.describe(
`Skills in resume that could apply to missing requirements.
- Example: MySQL knowledge transfers to PostgreSQL (both SQL databases)`
+ Example: MySQL knowledge transfers to PostgreSQL (both SQL databases)`,
),
application_recommendation: z.string().describe(
@@ -479,7 +531,7 @@ export const SemanticSimilaritySchema = z.object({
- "Apply now - strong match, highlight your React migration project"
- "Apply after adding Docker basics - critical gap for this role"
- "Consider upskilling in Kubernetes before applying - key requirement"
- - "May not be the best fit - role requires senior-level system design"`
+ - "May not be the best fit - role requires senior-level system design"`,
),
});
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 5bf1024..b206210 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -11,72 +11,101 @@ const config = {
],
prefix: "",
theme: {
- container: {
- center: true,
- padding: "2rem",
- screens: {
- "2xl": "1400px",
- },
- },
- extend: {
- fontFamily: {
- inter: ["var(--font-inter)", ...fontFamily.sans],
- },
- colors: {
- border: "hsl(var(--border))",
- input: "hsl(var(--input))",
- ring: "hsl(var(--ring))",
- background: "hsl(var(--background))",
- foreground: "hsl(var(--foreground))",
- primary: {
- DEFAULT: "hsl(var(--primary))",
- foreground: "hsl(var(--primary-foreground))",
- },
- secondary: {
- DEFAULT: "hsl(var(--secondary))",
- foreground: "hsl(var(--secondary-foreground))",
- },
- destructive: {
- DEFAULT: "hsl(var(--destructive))",
- foreground: "hsl(var(--destructive-foreground))",
- },
- muted: {
- DEFAULT: "hsl(var(--muted))",
- foreground: "hsl(var(--muted-foreground))",
- },
- accent: {
- DEFAULT: "hsl(var(--accent))",
- foreground: "hsl(var(--accent-foreground))",
- },
- popover: {
- DEFAULT: "hsl(var(--popover))",
- foreground: "hsl(var(--popover-foreground))",
- },
- card: {
- DEFAULT: "hsl(var(--card))",
- foreground: "hsl(var(--card-foreground))",
- },
- },
- borderRadius: {
- lg: "var(--radius)",
- md: "calc(var(--radius) - 2px)",
- sm: "calc(var(--radius) - 4px)",
- },
- keyframes: {
- "accordion-down": {
- from: { height: "0" },
- to: { height: "var(--radix-accordion-content-height)" },
- },
- "accordion-up": {
- from: { height: "var(--radix-accordion-content-height)" },
- to: { height: "0" },
- },
- },
- animation: {
- "accordion-down": "accordion-down 0.2s ease-out",
- "accordion-up": "accordion-up 0.2s ease-out",
- },
- },
+ container: {
+ center: true,
+ padding: '2rem',
+ screens: {
+ '2xl': '1400px'
+ }
+ },
+ extend: {
+ fontFamily: {
+ inter: [
+ 'var(--font-inter)',
+ ...fontFamily.sans
+ ]
+ },
+ colors: {
+ border: 'hsl(var(--border))',
+ input: 'hsl(var(--input))',
+ ring: 'hsl(var(--ring))',
+ background: 'hsl(var(--background))',
+ foreground: 'hsl(var(--foreground))',
+ primary: {
+ DEFAULT: 'hsl(var(--primary))',
+ foreground: 'hsl(var(--primary-foreground))'
+ },
+ secondary: {
+ DEFAULT: 'hsl(var(--secondary))',
+ foreground: 'hsl(var(--secondary-foreground))'
+ },
+ destructive: {
+ DEFAULT: 'hsl(var(--destructive))',
+ foreground: 'hsl(var(--destructive-foreground))'
+ },
+ muted: {
+ DEFAULT: 'hsl(var(--muted))',
+ foreground: 'hsl(var(--muted-foreground))'
+ },
+ accent: {
+ DEFAULT: 'hsl(var(--accent))',
+ foreground: 'hsl(var(--accent-foreground))'
+ },
+ popover: {
+ DEFAULT: 'hsl(var(--popover))',
+ foreground: 'hsl(var(--popover-foreground))'
+ },
+ card: {
+ DEFAULT: 'hsl(var(--card))',
+ foreground: 'hsl(var(--card-foreground))'
+ }
+ },
+ borderRadius: {
+ lg: 'var(--radius)',
+ md: 'calc(var(--radius) - 2px)',
+ sm: 'calc(var(--radius) - 4px)'
+ },
+ keyframes: {
+ 'accordion-down': {
+ from: {
+ height: '0'
+ },
+ to: {
+ height: 'var(--radix-accordion-content-height)'
+ }
+ },
+ 'accordion-up': {
+ from: {
+ height: 'var(--radix-accordion-content-height)'
+ },
+ to: {
+ height: '0'
+ }
+ },
+ 'accordion-down': {
+ from: {
+ height: '0'
+ },
+ to: {
+ height: 'var(--radix-accordion-content-height)'
+ }
+ },
+ 'accordion-up': {
+ from: {
+ height: 'var(--radix-accordion-content-height)'
+ },
+ to: {
+ height: '0'
+ }
+ }
+ },
+ animation: {
+ 'accordion-down': 'accordion-down 0.2s ease-out',
+ 'accordion-up': 'accordion-up 0.2s ease-out',
+ 'accordion-down': 'accordion-down 0.2s ease-out',
+ 'accordion-up': 'accordion-up 0.2s ease-out'
+ }
+ }
},
plugins: [require("tailwindcss-animate")],
} satisfies Config;