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.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
feat: add skills section to resume with CRUD operations
Khuram Niaz875cd54c0fcc
diff --git a/__tests__/tag.actions.spec.ts b/__tests__/tag.actions.spec.tsindex 223ab38..c361ac5 100644--- a/__tests__/tag.actions.spec.ts+++ b/__tests__/tag.actions.spec.ts@@ -24,6 +24,9 @@ vi.mock("@prisma/client", () => {question: {count: vi.fn(),},+ skill: {+ count: vi.fn(),+ },};return { PrismaClient: vi.fn(function() { return mPrismaClient; }) };});@@ -212,6 +215,7 @@ describe("Tag Actions", () => {(getCurrentUser as any).mockResolvedValue(mockUser);(prisma.job.count as any).mockResolvedValue(0);(prisma.question.count as any).mockResolvedValue(0);+ (prisma.skill.count as any).mockResolvedValue(0);(prisma.tag.delete as any).mockResolvedValue(mockTag);const result = await deleteTagById("tag-1");@@ -226,6 +230,7 @@ describe("Tag Actions", () => {(getCurrentUser as any).mockResolvedValue(mockUser);(prisma.job.count as any).mockResolvedValue(3);(prisma.question.count as any).mockResolvedValue(0);+ (prisma.skill.count as any).mockResolvedValue(0);const result = await deleteTagById("tag-1");@@ -241,6 +246,7 @@ describe("Tag Actions", () => {(getCurrentUser as any).mockResolvedValue(mockUser);(prisma.job.count as any).mockResolvedValue(0);(prisma.question.count as any).mockResolvedValue(5);+ (prisma.skill.count as any).mockResolvedValue(0);const result = await deleteTagById("tag-1");@@ -256,6 +262,7 @@ describe("Tag Actions", () => {(getCurrentUser as any).mockResolvedValue(mockUser);(prisma.job.count as any).mockResolvedValue(2);(prisma.question.count as any).mockResolvedValue(4);+ (prisma.skill.count as any).mockResolvedValue(0);const result = await deleteTagById("tag-1");@@ -267,6 +274,22 @@ describe("Tag Actions", () => {expect(prisma.tag.delete).not.toHaveBeenCalled();});+ it("should return error when tag is linked to skills only", async () => {+ (getCurrentUser as any).mockResolvedValue(mockUser);+ (prisma.job.count as any).mockResolvedValue(0);+ (prisma.question.count as any).mockResolvedValue(0);+ (prisma.skill.count as any).mockResolvedValue(2);++ const result = await deleteTagById("tag-1");++ expect(result).toEqual({+ success: false,+ message:+ "Skill tag cannot be deleted because it is linked to 2 skill(s).",+ });+ expect(prisma.tag.delete).not.toHaveBeenCalled();+ });+it("should return error for unauthenticated user", async () => {(getCurrentUser as any).mockResolvedValue(null);@@ -282,6 +305,7 @@ describe("Tag Actions", () => {(getCurrentUser as any).mockResolvedValue(mockUser);(prisma.job.count as any).mockResolvedValue(0);(prisma.question.count as any).mockResolvedValue(0);+ (prisma.skill.count as any).mockResolvedValue(0);(prisma.tag.delete as any).mockRejectedValue(new Error("DB error"));const result = await deleteTagById("tag-1");diff --git a/prisma/migrations/20260627071346_add_skill_section/migration.sql b/prisma/migrations/20260627071346_add_skill_section/migration.sqlnew file mode 100644index 0000000..1970d9b--- /dev/null+++ b/prisma/migrations/20260627071346_add_skill_section/migration.sql@@ -0,0 +1,15 @@+-- CreateTable+CREATE TABLE "Skill" (+ "id" TEXT NOT NULL PRIMARY KEY,+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "updatedAt" DATETIME NOT NULL,+ "category" TEXT,+ "order" INTEGER NOT NULL DEFAULT 0,+ "tagId" TEXT NOT NULL,+ "resumeSectionId" TEXT NOT NULL,+ CONSTRAINT "Skill_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "Tag" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "Skill_resumeSectionId_fkey" FOREIGN KEY ("resumeSectionId") REFERENCES "ResumeSection" ("id") ON DELETE RESTRICT ON UPDATE CASCADE+);++-- CreateIndex+CREATE INDEX "Skill_resumeSectionId_idx" ON "Skill"("resumeSectionId");diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex b28ab1b..a156f7c 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -117,6 +117,7 @@ model ResumeSection {educations Education[]licenseOrCertifications LicenseOrCertification[]others OtherSection[]+ skills Skill[]Resume Resume @relation(fields: [resumeId], references: [id])}@@ -452,10 +453,25 @@ model Tag {user User @relation(fields: [createdBy], references: [id])jobs Job[]questions Question[]+ skills Skill[]@@unique([value, createdBy])}+model Skill {+ id String @id @default(uuid())+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ category String?+ order Int @default(0)+ tagId String+ Tag Tag @relation(fields: [tagId], references: [id])+ resumeSectionId String+ ResumeSection ResumeSection @relation(fields: [resumeSectionId], references: [id])++ @@index([resumeSectionId])+}+model Question {id String @id @default(uuid())question Stringdiff --git a/src/actions/profile.actions.ts b/src/actions/profile.actions.tsindex 3028df5..80d6660 100644--- a/src/actions/profile.actions.ts+++ b/src/actions/profile.actions.ts@@ -8,6 +8,10 @@ import { AddExperienceFormSchema } from "@/models/addExperienceForm.schema";import { AddSummarySectionFormSchema } from "@/models/addSummaryForm.schema";import { CreateResumeFormSchema } from "@/models/createResumeForm.schema";import { ResumeSection, SectionType, Summary } from "@/models/profile.model";+import {+ AddSkillsFormSchema,+ UpdateSkillsFormSchema,+} from "@/models/skills.schema";import { getCurrentUser } from "@/utils/user.utils";import { APP_CONSTANTS } from "@/lib/constants";import { revalidatePath } from "next/cache";@@ -105,6 +109,7 @@ export const getResumeById = async (},},licenseOrCertifications: true,+ skills: { include: { Tag: true } },},},},@@ -351,6 +356,9 @@ export const deleteResumeById = async (await tx.licenseOrCertification.deleteMany({where: { ResumeSection: { resumeId } },});+ await tx.skill.deleteMany({+ where: { ResumeSection: { resumeId } },+ });await tx.resumeSection.deleteMany({ where: { resumeId } });await tx.resume.delete({@@ -751,3 +759,113 @@ export const updateCertification = async (return handleError(error, msg);}};++export const addSkillsSection = async (+ data: z.infer<typeof AddSkillsFormSchema>,+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();+ if (!user) throw new Error("Not authenticated");++ const owned = await prisma.resume.findUnique({+ where: { id: data.resumeId, profile: { userId: user.id } },+ select: { id: true },+ });+ if (!owned) throw new Error("Resume not found or access denied");++ const section = await prisma.resumeSection.create({+ data: {+ resumeId: data.resumeId,+ sectionTitle: data.sectionTitle,+ sectionType: SectionType.SKILLS,+ },+ });++ let order = 0;+ const skillRows = data.categories.flatMap((cat) =>+ cat.tagIds.map((tagId) => ({+ tagId,+ category: cat.label?.trim() || null,+ order: order++,+ resumeSectionId: section.id,+ })),+ );++ await prisma.skill.createMany({ data: skillRows });++ revalidatePath(`/dashboard/profile/resume/${data.resumeId}`);+ return { success: true, data: section };+ } catch (error) {+ return handleError(error, "Failed to add skills section.");+ }+};++export const updateSkillsSection = async (+ data: z.infer<typeof UpdateSkillsFormSchema>,+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();+ if (!user) throw new Error("Not authenticated");++ const section = await prisma.resumeSection.findFirst({+ where: {+ id: data.sectionId,+ Resume: { profile: { userId: user.id } },+ },+ select: { id: true, resumeId: true },+ });+ if (!section) throw new Error("Section not found or access denied");++ let order = 0;+ const skillRows = data.categories.flatMap((cat) =>+ cat.tagIds.map((tagId) => ({+ tagId,+ category: cat.label?.trim() || null,+ order: order++,+ resumeSectionId: section.id,+ })),+ );++ await prisma.$transaction([+ prisma.skill.deleteMany({ where: { resumeSectionId: section.id } }),+ prisma.resumeSection.update({+ where: { id: section.id },+ data: { sectionTitle: data.sectionTitle },+ }),+ prisma.skill.createMany({ data: skillRows }),+ ]);++ revalidatePath(`/dashboard/profile/resume/${section.resumeId}`);+ return { success: true };+ } catch (error) {+ return handleError(error, "Failed to update skills section.");+ }+};++export const deleteSkillsSection = async (+ sectionId: string,+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();+ if (!user) throw new Error("Not authenticated");++ const section = await prisma.resumeSection.findFirst({+ where: {+ id: sectionId,+ Resume: { profile: { userId: user.id } },+ },+ select: { id: true, resumeId: true },+ });+ if (!section) throw new Error("Section not found or access denied");++ await prisma.$transaction([+ prisma.skill.deleteMany({ where: { resumeSectionId: section.id } }),+ prisma.resumeSection.delete({ where: { id: section.id } }),+ ]);++ revalidatePath(`/dashboard/profile/resume/${section.resumeId}`);+ return { success: true };+ } catch (error) {+ return handleError(error, "Failed to delete skills section.");+ }+};diff --git a/src/actions/tag.actions.ts b/src/actions/tag.actions.tsindex fab62d5..3c0dcff 100644--- a/src/actions/tag.actions.ts+++ b/src/actions/tag.actions.ts@@ -42,7 +42,7 @@ export const getTagList = async (id: true,label: true,value: true,- _count: { select: { jobs: true, questions: true } },+ _count: { select: { jobs: true, questions: true, skills: true } },},orderBy: { jobs: { _count: "desc" } },}),@@ -84,15 +84,17 @@ export const deleteTagById = async (throw new Error("Not authenticated");}- const [jobs, questions] = await Promise.all([+ const [jobs, questions, skills] = await Promise.all([prisma.job.count({ where: { tags: { some: { id: tagId } } } }),prisma.question.count({ where: { tags: { some: { id: tagId } } } }),+ prisma.skill.count({ where: { tagId } }),]);- if (jobs > 0 || questions > 0) {+ if (jobs > 0 || questions > 0 || skills > 0) {const links = [jobs > 0 ? `${jobs} job(s)` : "",questions > 0 ? `${questions} question(s)` : "",+ skills > 0 ? `${skills} skill(s)` : "",].filter(Boolean).join(" and ");diff --git a/src/components/admin/TagsTable.tsx b/src/components/admin/TagsTable.tsxindex c42919c..2851875 100644--- a/src/components/admin/TagsTable.tsx+++ b/src/components/admin/TagsTable.tsx@@ -37,11 +37,13 @@ function TagsTable({ tags, reloadTags }: TagsTableProps) {const onDeleteTag = (tag: Tag) => {const jobCount = tag._count?.jobs ?? 0;const questionCount = tag._count?.questions ?? 0;+ const skillCount = tag._count?.skills ?? 0;- if (jobCount > 0 || questionCount > 0) {+ if (jobCount > 0 || questionCount > 0 || skillCount > 0) {const links = [jobCount > 0 ? `${jobCount} job(s)` : "",questionCount > 0 ? `${questionCount} question(s)` : "",+ skillCount > 0 ? `${skillCount} skill(s)` : "",].filter(Boolean).join(" and ");diff --git a/src/components/myjobs/TagInput.tsx b/src/components/myjobs/TagInput.tsxindex b68950e..a591ff2 100644--- a/src/components/myjobs/TagInput.tsx+++ b/src/components/myjobs/TagInput.tsx@@ -26,12 +26,20 @@ interface TagInputProps {availableTags: Tag[];selectedTagIds: string[];onChange: (ids: string[]) => void;+ max?: number;+ placeholder?: string;+ noun?: string;+ onTagCreated?: (tag: Tag) => void;}export function TagInput({availableTags,selectedTagIds,onChange,+ max = APP_CONSTANTS.MAX_JOB_TAGS,+ placeholder = "Search or add a skill...",+ noun = "skills",+ onTagCreated,}: TagInputProps) {const [open, setOpen] = useState(false);const [inputValue, setInputValue] = useState("");@@ -39,7 +47,7 @@ export function TagInput({const [isPending, startTransition] = useTransition();const selectedTags = localTags.filter((t) => selectedTagIds.includes(t.id));- const isMaxReached = selectedTagIds.length >= APP_CONSTANTS.MAX_JOB_TAGS;+ const isMaxReached = selectedTagIds.length >= max;// Tags not yet selected, filtered by inputconst filteredOptions = localTags.filter(@@ -54,7 +62,7 @@ export function TagInput({);const addTagById = (id: string) => {- if (selectedTagIds.length >= APP_CONSTANTS.MAX_JOB_TAGS) return;+ if (selectedTagIds.length >= max) return;onChange([...selectedTagIds, id]);};@@ -82,6 +90,7 @@ export function TagInput({prev.some((t) => t.id === newTag.id) ? prev : [...prev, newTag],);addTagById(newTag.id);+ onTagCreated?.(newTag);setInputValue("");setOpen(false);});@@ -108,9 +117,7 @@ export function TagInput({disabled={isMaxReached}type="button">- {isMaxReached- ? `Max ${APP_CONSTANTS.MAX_JOB_TAGS} skills reached`- : "Search or add a skill..."}+ {isMaxReached ? `Max ${max} ${noun} reached` : placeholder}<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" /></Button></PopoverTrigger>diff --git a/src/components/profile/AddResumeSection.tsx b/src/components/profile/AddResumeSection.tsxindex 2e28609..58084a2 100644--- a/src/components/profile/AddResumeSection.tsx+++ b/src/components/profile/AddResumeSection.tsx@@ -20,6 +20,7 @@ import AddResumeSummary from "./AddResumeSummary";import AddExperience from "./AddExperience";import AddEducation from "./AddEducation";import AddCertification from "./AddCertification";+import AddSkills from "./AddSkills";interface AddResumeSectionProps {resume: Resume;@@ -31,6 +32,7 @@ export interface AddResumeSectionRef {openExperienceDialog: (s: ResumeSection) => void;openEducationDialog: (s: ResumeSection) => void;openCertificationDialog: (s: ResumeSection) => void;+ openSkillsDialog: (s: ResumeSection) => void;}const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(@@ -41,6 +43,7 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(const [educationDialogOpen, setEducationDialogOpen] = useState(false);const [certificationDialogOpen, setCertificationDialogOpen] =useState(false);+ const [skillsDialogOpen, setSkillsDialogOpen] = useState(false);const [contactInfoToEdit, setContactInfoToEdit] =useState<ContactInfo | null>(null);const [summaryToEdit, setSummaryToEdit] = useState<ResumeSection | null>(@@ -52,6 +55,9 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(useState<ResumeSection | null>(null);const [certificationToEdit, setCertificationToEdit] =useState<ResumeSection | null>(null);+ const [skillsToEdit, setSkillsToEdit] = useState<ResumeSection | null>(+ null,+ );useImperativeHandle(ref, () => ({openContactInfoDialog(contactInfo: ContactInfo) {setContactInfoDialogOpen(true);@@ -73,6 +79,10 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(setCertificationDialogOpen(true);setCertificationToEdit({ ...certificationSection });},+ openSkillsDialog(skillsSection: ResumeSection) {+ setSkillsDialogOpen(true);+ setSkillsToEdit({ ...skillsSection });+ },}));const summarySection = resume?.ResumeSections?.find((section) => section.sectionType === SectionType.SUMMARY,@@ -86,6 +96,9 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(const certificationSection = resume?.ResumeSections?.find((section) => section.sectionType === SectionType.CERTIFICATION,);+ const skillsSection = resume?.ResumeSections?.find(+ (section) => section.sectionType === SectionType.SKILLS,+ );const resetExperienceToEdit = () => {setExperienceToEdit(null);};@@ -115,6 +128,10 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(}setCertificationDialogOpen(true);};+ const openSkillsDialog = () => {+ setSkillsToEdit(null);+ setSkillsDialogOpen(true);+ };return (<><DropdownMenu>@@ -146,6 +163,13 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(>Add Summary</DropdownMenuItem>+ <DropdownMenuItem+ className="cursor-pointer"+ onClick={openSkillsDialog}+ disabled={!!skillsSection}+ >+ Add Skills+ </DropdownMenuItem><DropdownMenuItemclassName="cursor-pointer"onClick={openExperienceDialog}@@ -200,6 +224,12 @@ const AddResumeSection = forwardRef<AddResumeSectionRef, AddResumeSectionProps>(setDialogOpen={setCertificationDialogOpen}certificationToEdit={certificationToEdit!}/>+ <AddSkills+ resumeId={resume?.id}+ dialogOpen={skillsDialogOpen}+ setDialogOpen={setSkillsDialogOpen}+ skillsToEdit={skillsToEdit}+ /></>);},diff --git a/src/components/profile/AddSkills.tsx b/src/components/profile/AddSkills.tsxnew file mode 100644index 0000000..a5d2cc6--- /dev/null+++ b/src/components/profile/AddSkills.tsx@@ -0,0 +1,264 @@+"use client";+import { useEffect, useState, useTransition } from "react";+import { useForm, useFieldArray } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";+import { PlusCircle, X } from "lucide-react";+import {+ Dialog,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "../ui/dialog";+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from "../ui/form";+import { Input } from "../ui/input";+import { Button } from "../ui/button";+import { Loader } from "lucide-react";+import { toast } from "../ui/use-toast";+import { TagInput } from "../myjobs/TagInput";+import { Tag } from "@/models/job.model";+import { ResumeSection, Skill } from "@/models/profile.model";+import { addSkillsSection, updateSkillsSection } from "@/actions/profile.actions";+import { getAllTags } from "@/actions/tag.actions";+import { APP_CONSTANTS } from "@/lib/constants";+import {+ AddSkillsFormSchema,+ UpdateSkillsFormSchema,+} from "@/models/skills.schema";+type AddSkillsProps = {+ resumeId: string | undefined;+ dialogOpen: boolean;+ setDialogOpen: (open: boolean) => void;+ skillsToEdit?: ResumeSection | null;+};++function AddSkills({+ resumeId,+ dialogOpen,+ setDialogOpen,+ skillsToEdit,+}: AddSkillsProps) {+ const isEditing = !!skillsToEdit;+ const [allTags, setAllTags] = useState<Tag[]>([]);+ const [isPending, startTransition] = useTransition();++ const form = useForm<z.infer<typeof AddSkillsFormSchema>>({+ resolver: zodResolver(AddSkillsFormSchema),+ defaultValues: {+ resumeId: resumeId ?? "",+ sectionTitle: "Core Skills",+ categories: [{ label: "", tagIds: [] }],+ },+ });++ const { fields, append, remove } = useFieldArray({+ control: form.control,+ name: "categories",+ });++ useEffect(() => {+ if (!dialogOpen) return;+ getAllTags().then((tags) => {+ if (Array.isArray(tags)) {+ setAllTags(tags);+ } else {+ toast({ variant: "destructive", title: "Error", description: "Failed to load skills. Please close and reopen the dialog." });+ }+ });++ if (isEditing && skillsToEdit) {+ const skills = [...(skillsToEdit.skills ?? [])].sort(+ (a, b) => a.order - b.order,+ );+ // Group by category preserving insertion order+ const categoryMap = new Map<string, Skill[]>();+ for (const skill of skills) {+ const key = skill.category ?? "";+ if (!categoryMap.has(key)) categoryMap.set(key, []);+ categoryMap.get(key)!.push(skill);+ }+ const categories = Array.from(categoryMap.entries()).map(+ ([label, items]) => ({+ label,+ tagIds: items.map((s) => s.tagId),+ }),+ );+ form.reset({+ resumeId: resumeId ?? "",+ sectionTitle: skillsToEdit.sectionTitle,+ categories: categories.length > 0 ? categories : [{ label: "", tagIds: [] }],+ });+ } else {+ form.reset({+ resumeId: resumeId ?? "",+ sectionTitle: "Core Skills",+ categories: [{ label: "", tagIds: [] }],+ });+ }+ }, [dialogOpen, isEditing, skillsToEdit, resumeId, form]);++ const handleTagCreated = (newTag: Tag) => {+ setAllTags((prev) =>+ prev.some((t) => t.id === newTag.id) ? prev : [...prev, newTag],+ );+ };++ const onSubmit = (data: z.infer<typeof AddSkillsFormSchema>) => {+ startTransition(async () => {+ let res;+ if (isEditing && skillsToEdit?.id) {+ res = await updateSkillsSection({+ ...data,+ sectionId: skillsToEdit.id,+ } as z.infer<typeof UpdateSkillsFormSchema>);+ } else {+ res = await addSkillsSection(data);+ }++ if (!res.success) {+ toast({+ variant: "destructive",+ title: "Error!",+ description: res.message,+ });+ } else {+ form.reset();+ setDialogOpen(false);+ toast({+ variant: "success",+ description: `Skills section ${isEditing ? "updated" : "added"} successfully`,+ });+ }+ });+ };++ return (+ <Dialog open={dialogOpen} onOpenChange={setDialogOpen}>+ <DialogContent className="max-h-[85vh] md:max-w-[40rem] overflow-y-auto">+ <DialogHeader>+ <DialogTitle>{isEditing ? "Edit Skills" : "Add Skills"}</DialogTitle>+ <p className="text-sm text-muted-foreground">+ Group your skills into categories. Leave a name blank to list skills+ without a heading.+ </p>+ </DialogHeader>+ <Form {...form}>+ <form+ onSubmit={form.handleSubmit(onSubmit)}+ className="flex flex-col gap-4 p-2"+ >+ <FormField+ control={form.control}+ name="sectionTitle"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Section heading</FormLabel>+ <FormControl>+ <Input {...field} placeholder="e.g. Core Skills" />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <hr />++ <div className="flex flex-col gap-3">+ {fields.map((field, index) => (+ <div+ key={field.id}+ className="border rounded-md p-3 flex flex-col gap-2"+ >+ <div className="flex items-center gap-2">+ <FormField+ control={form.control}+ name={`categories.${index}.label`}+ render={({ field: f }) => (+ <FormItem className="flex-1">+ <FormControl>+ <Input+ {...f}+ placeholder="Category name (optional, e.g. Languages)"+ className="uppercase text-xs font-medium"+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ {fields.length > 1 && (+ <Button+ type="button"+ variant="ghost"+ size="sm"+ className="shrink-0"+ onClick={() => remove(index)}+ >+ <X className="h-4 w-4" />+ </Button>+ )}+ </div>+ <FormField+ control={form.control}+ name={`categories.${index}.tagIds`}+ render={({ field: f }) => (+ <FormItem>+ <FormControl>+ <TagInput+ availableTags={allTags}+ selectedTagIds={f.value}+ onChange={f.onChange}+ max={APP_CONSTANTS.MAX_SKILLS_PER_CATEGORY}+ placeholder="Search or add a skill…"+ onTagCreated={handleTagCreated}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ </div>+ ))}+ </div>++ <Button+ type="button"+ variant="outline"+ size="sm"+ className="self-start"+ disabled={fields.length >= APP_CONSTANTS.MAX_SKILL_CATEGORIES}+ onClick={() => append({ label: "", tagIds: [] })}+ >+ <PlusCircle className="h-4 w-4 mr-2" />+ Add category+ </Button>++ <DialogFooter>+ <Button+ type="button"+ variant="outline"+ onClick={() => setDialogOpen(false)}+ >+ Cancel+ </Button>+ <Button type="submit" disabled={isPending}>+ Save+ {isPending && <Loader className="h-4 w-4 shrink-0 spinner ml-2" />}+ </Button>+ </DialogFooter>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+}++export default AddSkills;diff --git a/src/components/profile/ResumeContainer.tsx b/src/components/profile/ResumeContainer.tsxindex 8c9984e..1174b1e 100644--- a/src/components/profile/ResumeContainer.tsx+++ b/src/components/profile/ResumeContainer.tsx@@ -10,6 +10,7 @@ import SummarySectionCard from "./SummarySectionCard";import ExperienceCard from "./ExperienceCard";import EducationCard from "./EducationCard";import CertificationCard from "./CertificationCard";+import SkillsSectionCard from "./SkillsSectionCard";import AiResumeReviewSection from "./AiResumeReviewSection";import { DownloadFileButton } from "./DownloadFileButton";import {@@ -43,7 +44,7 @@ import {Loader,AlertTriangle,} from "lucide-react";-import { deleteResumeById } from "@/actions/profile.actions";+import { deleteResumeById, deleteSkillsSection } from "@/actions/profile.actions";import {resolveImportCard,ImportCardPayload,@@ -485,7 +486,8 @@ function ResumeContainer({ resume }: { resume: Resume }) {s.summary?.content ||s.workExperiences?.length ||s.educations?.length ||- s.licenseOrCertifications?.length,+ s.licenseOrCertifications?.length ||+ s.skills?.length,);if (!hasName && !hasSections) {toast({@@ -566,6 +568,9 @@ function ResumeContainer({ resume }: { resume: Resume }) {const certificationSection = ResumeSections?.find((s) => s.sectionType === SectionType.CERTIFICATION,);+ const skillsSection = ResumeSections?.find(+ (s) => s.sectionType === SectionType.SKILLS,+ );const openContactInfoDialog = () =>resumeSectionRef.current?.openContactInfoDialog(ContactInfo!);@@ -589,6 +594,23 @@ function ResumeContainer({ resume }: { resume: Resume }) {};resumeSectionRef.current?.openEducationDialog(section);};+ const openSkillsDialogForEdit = () => {+ resumeSectionRef.current?.openSkillsDialog(skillsSection!);+ };+ const handleDeleteSkillsSection = async () => {+ if (!skillsSection?.id) return;+ const result = await deleteSkillsSection(skillsSection.id);+ if (!result.success) {+ toast({+ variant: "destructive",+ title: "Error",+ description: result.message,+ });+ } else {+ router.refresh();+ }+ };+const openCertificationDialogForEdit = (certificationId: string) => {const section: ResumeSection = {...certificationSection!,@@ -753,6 +775,13 @@ function ResumeContainer({ resume }: { resume: Resume }) {openDialogForEdit={openSummaryDialogForEdit}/>)}+ {skillsSection && (+ <SkillsSectionCard+ skillsSection={skillsSection}+ openDialogForEdit={openSkillsDialogForEdit}+ onDelete={handleDeleteSkillsSection}+ />+ )}{experienceSection && (<ExperienceCardexperienceSection={experienceSection}diff --git a/src/components/profile/SkillsSectionCard.tsx b/src/components/profile/SkillsSectionCard.tsxnew file mode 100644index 0000000..afa04cb--- /dev/null+++ b/src/components/profile/SkillsSectionCard.tsx@@ -0,0 +1,126 @@+"use client";+import { ResumeSection, Skill } from "@/models/profile.model";+import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";+import { Button } from "../ui/button";+import { Edit, Trash2 } from "lucide-react";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ AlertDialogTrigger,+} from "../ui/alert-dialog";++interface SkillsSectionCardProps {+ skillsSection: ResumeSection;+ openDialogForEdit: () => void;+ onDelete: () => void;+}++function groupByCategory(skills: Skill[]): Map<string, Skill[]> {+ const map = new Map<string, Skill[]>();+ const sorted = [...skills].sort((a, b) => a.order - b.order);+ for (const skill of sorted) {+ const key = skill.category ?? "";+ if (!map.has(key)) map.set(key, []);+ map.get(key)!.push(skill);+ }+ return map;+}++function SkillsSectionCard({+ skillsSection,+ openDialogForEdit,+ onDelete,+}: SkillsSectionCardProps) {+ const skills = skillsSection.skills ?? [];+ const grouped = groupByCategory(skills);+ const hasCategories = Array.from(grouped.keys()).some((k) => k !== "");++ return (+ <>+ <CardTitle className="pl-6 py-3">{skillsSection.sectionTitle}</CardTitle>+ <Card>+ <CardHeader className="p-2 pb-0 flex-row justify-between items-center relative">+ <div />+ <div className="flex gap-1 absolute top-0 right-1">+ <Button+ variant="ghost"+ size="sm"+ className="h-8 gap-1"+ onClick={openDialogForEdit}+ >+ <Edit className="h-3.5 w-3.5" />+ <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">+ Edit+ </span>+ </Button>+ <AlertDialog>+ <AlertDialogTrigger asChild>+ <Button+ variant="ghost"+ size="sm"+ className="h-8 gap-1 text-destructive hover:text-destructive"+ >+ <Trash2 className="h-3.5 w-3.5" />+ <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">+ Delete+ </span>+ </Button>+ </AlertDialogTrigger>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete skills section?</AlertDialogTitle>+ <AlertDialogDescription>+ This will remove the entire skills section and all skills in+ it. The skill tags themselves are not deleted.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ className="bg-destructive text-destructive-foreground hover:bg-destructive/90"+ onClick={onDelete}+ >+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </div>+ </CardHeader>+ <CardContent className="p-4 pt-2">+ {hasCategories ? (+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1">+ {Array.from(grouped.entries()).map(([category, items]) => (+ <div+ key={category || "__flat"}+ className={`flex gap-2 text-sm${category ? "" : " col-span-2"}`}+ >+ {category && (+ <span className="text-muted-foreground uppercase text-xs font-medium w-28 shrink-0 pt-0.5">+ {category}+ </span>+ )}+ <span>+ {items.map((s) => s.Tag?.label).filter(Boolean).join(" · ")}+ </span>+ </div>+ ))}+ </div>+ ) : (+ <p className="text-sm">+ {skills.map((s) => s.Tag?.label).filter(Boolean).join(" · ")}+ </p>+ )}+ </CardContent>+ </Card>+ </>+ );+}++export default SkillsSectionCard;diff --git a/src/components/profile/resume-pdf/ProfessionalTemplate.tsx b/src/components/profile/resume-pdf/ProfessionalTemplate.tsxindex 515ed22..f67b581 100644--- a/src/components/profile/resume-pdf/ProfessionalTemplate.tsx+++ b/src/components/profile/resume-pdf/ProfessionalTemplate.tsx@@ -63,6 +63,9 @@ export function ProfessionalResumeDocument({ resume, htmlNodes }: Props) {const summarySection = ResumeSections?.find((sec) => sec.sectionType === SectionType.SUMMARY,);+ const skillsSection = ResumeSections?.find(+ (sec) => sec.sectionType === SectionType.SKILLS,+ );const experienceSection = ResumeSections?.find((sec) => sec.sectionType === SectionType.EXPERIENCE,);@@ -125,6 +128,43 @@ export function ProfessionalResumeDocument({ resume, htmlNodes }: Props) {<View style={{ marginBottom: 4 }}>{htmlNodes.summary}</View>)}+ {/* Skills */}+ {skillsSection?.skills && skillsSection.skills.length > 0 && (() => {+ const sorted = [...skillsSection.skills].sort((a, b) => a.order - b.order);+ const grouped = new Map<string, typeof sorted>();+ for (const sk of sorted) {+ const key = sk.category ?? "";+ if (!grouped.has(key)) grouped.set(key, []);+ grouped.get(key)!.push(sk);+ }+ const hasCategories = Array.from(grouped.keys()).some((k) => k !== "");+ return (+ <View>+ <SectionHeading title={skillsSection.sectionTitle} />+ {hasCategories ? (+ <View style={s.twoColRow}>+ {Array.from(grouped.entries()).map(([cat, items]) => (+ <View key={cat || "__flat"} style={s.twoColLeft}>+ {cat ? (+ <Text style={{ fontSize: 9, fontFamily: "Helvetica-Bold", textTransform: "uppercase", marginBottom: 1 }}>+ {cat}+ </Text>+ ) : null}+ <Text style={{ fontSize: 10 }}>+ {items.map((sk) => sk.Tag?.label).filter(Boolean).join(" · ")}+ </Text>+ </View>+ ))}+ </View>+ ) : (+ <Text style={{ fontSize: 10 }}>+ {sorted.map((sk) => sk.Tag?.label).filter(Boolean).join(" · ")}+ </Text>+ )}+ </View>+ );+ })()}+{/* Experience */}{experienceSection?.workExperiences &&experienceSection.workExperiences.length > 0 && (diff --git a/src/components/profile/resume-pdf/SimpleTemplate.tsx b/src/components/profile/resume-pdf/SimpleTemplate.tsxindex bc27766..0e03dac 100644--- a/src/components/profile/resume-pdf/SimpleTemplate.tsx+++ b/src/components/profile/resume-pdf/SimpleTemplate.tsx@@ -27,6 +27,9 @@ type Props = {export function SimpleResumeDocument({ resume, htmlNodes }: Props) {const { ContactInfo, ResumeSections } = resume;+ const skillsSection = ResumeSections?.find(+ (s) => s.sectionType === SectionType.SKILLS,+ );const experienceSection = ResumeSections?.find((s) => s.sectionType === SectionType.EXPERIENCE,);@@ -74,6 +77,39 @@ export function SimpleResumeDocument({ resume, htmlNodes }: Props) {</View>)}+ {/* Skills */}+ {skillsSection?.skills && skillsSection.skills.length > 0 && (() => {+ const sorted = [...skillsSection.skills].sort((a, b) => a.order - b.order);+ const grouped = new Map<string, typeof sorted>();+ for (const s of sorted) {+ const key = s.category ?? "";+ if (!grouped.has(key)) grouped.set(key, []);+ grouped.get(key)!.push(s);+ }+ const hasCategories = Array.from(grouped.keys()).some((k) => k !== "");+ return (+ <View>+ <SectionHeading title={skillsSection.sectionTitle} />+ {hasCategories ? (+ Array.from(grouped.entries()).map(([cat, items]) => (+ <View key={cat || "__flat"} style={simpleStyles.skillRow}>+ {cat ? (+ <Text style={simpleStyles.skillCat}>{cat.toUpperCase()}</Text>+ ) : null}+ <Text style={simpleStyles.skillVals}>+ {items.map((s) => s.Tag?.label).filter(Boolean).join(" · ")}+ </Text>+ </View>+ ))+ ) : (+ <Text style={simpleStyles.bodyText}>+ {sorted.map((s) => s.Tag?.label).filter(Boolean).join(" · ")}+ </Text>+ )}+ </View>+ );+ })()}+{/* Experience */}{experienceSection?.workExperiences &&experienceSection.workExperiences.length > 0 && (diff --git a/src/components/profile/resume-pdf/styles/simple.styles.ts b/src/components/profile/resume-pdf/styles/simple.styles.tsindex 8e78980..c6eb562 100644--- a/src/components/profile/resume-pdf/styles/simple.styles.ts+++ b/src/components/profile/resume-pdf/styles/simple.styles.ts@@ -64,6 +64,20 @@ export const simpleStyles = StyleSheet.create({marginBottom: 3,marginTop: 4,},+ skillRow: {+ flexDirection: "row",+ marginBottom: 3,+ },+ skillCat: {+ fontFamily: "Helvetica-Bold",+ fontSize: 10,+ width: 110,+ flexShrink: 0,+ },+ skillVals: {+ flex: 1,+ fontSize: 11,+ },});export const simpleHtmlStyles: HtmlStyleSet = {diff --git a/src/lib/ai/prompts/resume-review/user.ts b/src/lib/ai/prompts/resume-review/user.tsindex 787372b..d260619 100644--- a/src/lib/ai/prompts/resume-review/user.ts+++ b/src/lib/ai/prompts/resume-review/user.ts@@ -6,6 +6,8 @@export function buildResumeReviewPrompt(resumeText: string): string {return `Review the following resume.+IMPORTANT: The resume below is a structured-text serialization of the candidate's data for your analysis. The "##" section markers and plain-text formatting are artifacts of this serialization — NOT the actual document format. The real resume exports to a professionally formatted PDF (no markdown headers, no plain text). Do NOT flag markdown syntax or plain-text layout as ATS or formatting issues.+<resume>${resumeText}</resume>diff --git a/src/lib/ai/tools/preprocessing.ts b/src/lib/ai/tools/preprocessing.tsindex 7ed68ad..fa58786 100644--- a/src/lib/ai/tools/preprocessing.ts+++ b/src/lib/ai/tools/preprocessing.ts@@ -177,9 +177,23 @@ export const convertResumeToText = (resume: Resume): Promise<string> => {.join("\n\n");};+ const SECTION_ORDER: Record<string, number> = {+ [SectionType.SUMMARY]: 0,+ [SectionType.SKILLS]: 1,+ [SectionType.EXPERIENCE]: 2,+ [SectionType.EDUCATION]: 3,+ [SectionType.CERTIFICATION]: 4,+ [SectionType.LICENSE]: 5,+ };+const formatResumeSections = (sections?: ResumeSection[]) => {if (!sections || sections.length === 0) return "";- return sections+ const sorted = [...sections].sort(+ (a, b) =>+ (SECTION_ORDER[a.sectionType] ?? 99) -+ (SECTION_ORDER[b.sectionType] ?? 99),+ );+ return sorted.map((section) => {switch (section.sectionType) {case SectionType.SUMMARY: {@@ -203,6 +217,24 @@ export const convertResumeToText = (resume: Resume): Promise<string> => {? `## ${section.sectionTitle.toUpperCase()}\n${content}`: "";}+ case SectionType.SKILLS: {+ const skills = section.skills;+ if (!skills || skills.length === 0) return "";+ const sorted = [...skills].sort((a, b) => a.order - b.order);+ const grouped = new Map<string, typeof sorted>();+ for (const s of sorted) {+ const key = s.category ?? "";+ if (!grouped.has(key)) grouped.set(key, []);+ grouped.get(key)!.push(s);+ }+ const toTitleCase = (s: string) =>+ s.replace(/\w\S*/g, (w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase());+ const lines = Array.from(grouped.entries()).map(([cat, items]) => {+ const labels = items.map((s) => s.Tag?.label).filter(Boolean).join(", ");+ return cat ? `${toTitleCase(cat)}: ${labels}` : labels;+ });+ return `## ${section.sectionTitle.toUpperCase()}\n${lines.join("\n")}`;+ }default:return "";}diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex 86ca12c..f27c3af 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -14,6 +14,8 @@ export const APP_CONSTANTS = {RECORDS_PER_PAGE: 25,MAX_AUTOMATIONS_PER_USER: 10,MAX_JOB_TAGS: 10,+ MAX_SKILL_CATEGORIES: 8,+ MAX_SKILLS_PER_CATEGORY: 20,ACTIVITY_MAX_DURATION_MINUTES: 8 * 60, // 8 HoursACTIVITY_MAX_DURATION_MS: 8 * 60 * 60 * 1000, // 8 hours in millisecondsRECENT_NUM_JOBS_ACTIVITIES: 7,diff --git a/src/lib/scraper/runner.ts b/src/lib/scraper/runner.tsindex dffb6c6..763f8f7 100644--- a/src/lib/scraper/runner.ts+++ b/src/lib/scraper/runner.ts@@ -125,6 +125,11 @@ interface ResumeWithSections extends PrismaResume {expirationDate: Date | null;credentialUrl: string | null;}>;+ skills: Array<{+ category: string | null;+ order: number;+ Tag: { label: string };+ }>;}>;}@@ -171,6 +176,7 @@ export async function runAutomation(},},licenseOrCertifications: true,+ skills: { include: { Tag: true } },},},},@@ -627,6 +633,22 @@ async function convertResumeForMatch();}}++ if (section.sectionType === "skills" && section.skills.length > 0) {+ const sorted = [...section.skills].sort((a, b) => a.order - b.order);+ const grouped = new Map<string, typeof sorted>();+ for (const s of sorted) {+ const key = s.category ?? "";+ if (!grouped.has(key)) grouped.set(key, []);+ grouped.get(key)!.push(s);+ }+ parts.push("## SKILLS");+ for (const [cat, items] of grouped.entries()) {+ const labels = items.map((s) => s.Tag.label).join(", ");+ parts.push(cat ? `${cat}: ${labels}` : labels);+ }+ parts.push("");+ }}return parts.filter(Boolean).join("\n");diff --git a/src/models/job.model.ts b/src/models/job.model.tsindex 56f9576..366014d 100644--- a/src/models/job.model.ts+++ b/src/models/job.model.ts@@ -25,6 +25,7 @@ export interface Tag {_count?: {jobs: number;questions: number;+ skills: number;};}diff --git a/src/models/profile.model.ts b/src/models/profile.model.tsindex 9f150a7..a6e1040 100644--- a/src/models/profile.model.ts+++ b/src/models/profile.model.ts@@ -1,4 +1,4 @@-import { Company, JobLocation, JobTitle } from "./job.model";+import { Company, JobLocation, JobTitle, Tag } from "./job.model";export interface Resume {id?: string;@@ -46,6 +46,15 @@ export enum SectionType {COURSE = "course",PROJECT = "project",OTHER = "other",+ SKILLS = "skills",+}++export interface Skill {+ id?: string;+ category?: string | null;+ order: number;+ tagId: string;+ Tag: Tag;}export interface Summary {@@ -81,6 +90,7 @@ export interface ResumeSection {workExperiences?: WorkExperience[];educations?: Education[];licenseOrCertifications?: LicenseOrCertification[];+ skills?: Skill[];}export interface WorkExperience {diff --git a/src/models/skills.schema.ts b/src/models/skills.schema.tsnew file mode 100644index 0000000..790f3d3--- /dev/null+++ b/src/models/skills.schema.ts@@ -0,0 +1,26 @@+import { z } from "zod";+import { APP_CONSTANTS } from "@/lib/constants";++const SkillCategorySchema = z.object({+ label: z.string().trim().max(60).optional(),+ tagIds: z+ .array(z.string())+ .min(1, "Add at least one skill")+ .max(APP_CONSTANTS.MAX_SKILLS_PER_CATEGORY),+});++export const AddSkillsFormSchema = z.object({+ resumeId: z.string(),+ sectionTitle: z.string().trim().min(1, "Section title is required"),+ categories: z+ .array(SkillCategorySchema)+ .min(1, "Add at least one category")+ .max(APP_CONSTANTS.MAX_SKILL_CATEGORIES),+});++export const UpdateSkillsFormSchema = AddSkillsFormSchema.extend({+ sectionId: z.string(),+});++export type AddSkillsForm = z.infer<typeof AddSkillsFormSchema>;+export type UpdateSkillsForm = z.infer<typeof UpdateSkillsFormSchema>;