Vibe coding with Claude Code course · Module 7: LinkedIn clone

A notice on the tavern door: a job offer and an application with a skill

9 min read
In this lesson7

The captain of the Black Pearl is looking for a first mate and a notice nailed to the tavern door will be read by a handful of passersby at most. In Crew Connections the whole fleet sees the notice, and a candidate answers it without leaving port. These are two new forms: a job offer and an application with a resume file. The recipe for them already lies in the chest, so in this lesson you check how much your own skill gives you and where it has to be fixed.

The skill in action

Request for Claude Code:

/new-form job offer

Claude Code loaded SKILL.md and put "job offer" in place of $ARGUMENTS. Following the first step of the skill it did not write a single line, only a table of fields and a question whether it was right. In our run it proposed fields in a pirate style: "Ship", "Port of embarkation", a kind of enlistment one-voyage, permanent-crew, season, and "Share of the loot" as plain text. It also said it would extend Field with a select list, because today it handles only text inputs. This is the moment to correct the course, before any code exists:

Fields: title, company, location, type (full-time, part-time, contract,
temporary), level (entry, mid, senior, executive), optional salaryMin
and salaryMax in zloty per month, the upper not lower than the lower,
description. A JobPost type in types/job.ts, labels in English.

What Claude wrote: types from one list

Open types/job.ts in Cursor. At the top stand the lists of values:

export const jobTypes = ["full-time", "part-time", "contract", "temporary"] as const;
export const jobLevels = ["entry", "mid", "senior", "executive"] as const;

export type JobType = (typeof jobTypes)[number];
export type JobLevel = (typeof jobLevels)[number];

as const tells TypeScript that this is a list of specific strings, not arbitrary text, and (typeof jobTypes)[number] turns it into the union "full-time" | "part-time" | ... that you know from lesson 1_4. The gain: the same array will serve the server in a moment, so the list lives in one place. Below it JobPost has a title, a ship (company), a port, type, level, an optional salary?: { min: number; max: number }, because not every captain gives a salary range, a description, postedBy with the author's handle and postedAt as an ISO string. Application joins the offer (jobId) with the candidate, a cover letter and a resume file, and its status is a union of pending, reviewed, interview, rejected and accepted.

What Claude wrote: the offer schema

Open lib/validation/job.ts. The most interesting part is the middle and the end of the schema:

    type: z.enum(jobTypes, "Choose a contract type from the list."),
    level: z.enum(jobLevels, "Choose a level from the list."),
    salaryMin: amount,
    salaryMax: amount,
    // ...
  })
  .refine((job) => !job.salaryMin || !job.salaryMax || job.salaryMax >= job.salaryMin, {
    path: ["salaryMax"],
    error: "The upper limit cannot be lower than the lower limit.",
  })
  // a second .refine: both limits or neither

z.enum takes the same array, so a value outside the list, for example one swapped in the browser tools, gets the error "Choose a contract type from the list.". amount is a helper from this file: an empty field gives undefined, digits give a number. refine checks a relationship between two fields, and path pins the error to the "to" field. The second refine makes sure you give both limits or none. One thing is surprising: Zod runs refine only after all fields have passed, so in our run the salary range error appeared only on the second try, after the too-short description was fixed.

What Claude wrote: the action and the card

app/jobs/new/actions.ts looks like the profile action, with one novelty. There are eight fields, so Claude extracted a readFields helper that reads only the given fields from FormData and always as text:

const user = await getCurrentUser();
const values = readFields(formData, jobFields);
// safeParse and errors as in the profile
const { salaryMin, salaryMax, ...job } = result.data;
await addJob({
  ...job,
  id,
  salary: salaryMin !== undefined && salaryMax !== undefined ? { min: salaryMin, max: salaryMax } : undefined,
  postedBy: user.handle,
  postedAt: new Date().toISOString(),
});

The author and the date are set by the server, as the skill demands. Then revalidatePath("/jobs") refreshes the list, and redirect leads to the page of the new offer. The list draws every offer through JobCard. The salary range looks like this in it:

{job.salary && (
  <p className="mt-1 text-sm font-medium text-gray-800">
    {pln.format(job.salary.min)} - {pln.format(job.salary.max)}
  </p>
)}

pln is Intl.NumberFormat("en-US", { style: "currency", currency: "PLN", maximumFractionDigits: 0 }). In our run it printed "PLN 9,000 - PLN 12,000": for a currency without its own symbol, the en-US format writes the code first, then a no-break space, then the number with commas. Without salary this line simply disappears and the card keeps working. Above it stand the title as a link to /jobs/[id], the ship, and a line job.location · jobTypeLabels[job.type] · jobLevelLabels[job.level], for example "Tortuga · full-time · officer", and below it "Posted November 10". The type and level values stay in English in the code, because they are identifiers saved in the data. The pirate sees the readable labels from lib/job-labels.ts, so changing a caption on the card touches no saved offer.

The application in a dialog window

The second form is the same skill with a longer argument:

/new-form job application: a cover letter (optional, up to 2000
characters) and a resume as a PDF up to 2 MB, in a dialog window on the
page /jobs/[id]. You cannot apply to your own offer or twice.
The status is set by the server.

The HTML <dialog> element is a window that the showModal() method opens over the page. The browser itself moves focus into it, closes it with the Esc key and returns focus to the Apply button, so you do not write that by hand as in lesson 3_2. Open components/jobs/ApplyDialog.tsx (some classes omitted):

<button type="button" onClick={() => dialogRef.current?.showModal()}>Apply</button>
<dialog ref={dialogRef} aria-labelledby="apply-title" className="m-auto w-full max-w-lg rounded-lg p-6 backdrop:bg-black/50">
  <h2 id="apply-title">You are applying for: {jobTitle}</h2>
  <form action={formAction}>{/* letter, resume file, Send and Cancel */}</form>
</dialog>

dialogRef is the useRef from lesson 2_5, and aria-labelledby gives the screen reader the name of the window. backdrop:bg-black/50 dims the page under the window. m-auto looks like decoration but it is not: Tailwind 4 zeroes the margins of all elements, and a <dialog> sits in the center precisely thanks to margins. In our run, without this class the window stuck to the top left corner. The form inside gets formAction from useActionState(applyToJob.bind(null, jobId), initialState).

The resume file is checked by the schema in lib/validation/application.ts:

resume: z
  .file("Attach your resume as a PDF file.")
  .min(1, "Attach your resume as a PDF file.")
  .max(MAX_RESUME_BYTES, "The resume can be at most 2 MB.")
  .refine(async (file) => isPdf(new Uint8Array(await file.slice(0, 5).arrayBuffer())), "This is not a PDF file."),

z.file checks that a file arrived, and min(1) catches an empty field, because the browser then sends a file of size zero. isPdf from lib/files.ts compares the first five bytes with the string %PDF-, like the MP4 signature in lesson 5_4. The check reads the file asynchronously, so the action calls safeParseAsync. Before that applyToJob rejects a nonexistent offer, your own offer and a second application. It saves the resume in data/resumes under a name from randomUUID(), outside public, because a resume is personal data. The application gets the status pending, and instead of the button the page shows "Your application: sent". After an error the letter stays in the field, but you have to pick the file again: the browser does not let a page type it back in.

Captain's review

  1. The file type according to the browser. The first version of the schema had z.file().mime(["application/pdf"]). In Zod's code that check compares file.type, the type the browser guesses from the extension. The test "rejects an image with a .pdf extension and the type application/pdf" makes sure the bytes decide.
  2. A limit the schema does not know about. Send a resume bigger than 1 MB. In our run, instead of a message, "This page couldn't load" appeared, and the terminal showed Body exceeded 1 MB limit.: a Server Action accepts 1 MB by default (as of November 2026), so the schema with a 2 MB limit never even got a chance. The fix is experimental.serverActions.bodySizeLimit: "3mb" in next.config.ts, with room for the letter and the form boundaries that the documentation mentions. Now a 2.5 MB file gets "The resume can be at most 2 MB.".
  3. Server code in the browser. The first build failed with the Turbopack error does not support external modules (request: node:fs/promises). JobForm is a Client Component, and it imported labels from lib/jobs.ts, which reads the disk. The labels moved to lib/job-labels.ts, and lib/store.ts got the line import "server-only": the documentation recommends it for server-only code, and a build error then shows the whole import path.
  4. Status from the form. Look in ApplyDialog.tsx for type="hidden" fields: the status, the candidate and the date must not come from the client.

Next step

When the review passes, ask for a commit, for example "Job offers and applications with a resume". The skill worked, but three findings appeared only in the review, so add them to the recipe:

Add to the new-form skill the rules from this lesson: we check a
file by its first bytes, not by file.type; bodySizeLimit in next.config.ts
must be higher than the limit in the schema; labels for a form live
in a file with no disk access.

Then open SKILL.md and read the diff in the Source Control panel. If this is still the session in which the skill was created, type /reload-skills once more: the documentation says a directory created during a session is not watched. In a session started later Claude Code sees the change by itself. A skill grows with the crew's experience, like a logbook. In the editor below waits a job board with an application window: pick a file and compare the type from the browser with the first bytes.

Remember: a notice nailed to a door is read by a few passersby, a notice saved in types is read by the whole fleet, and a captain checks an application by the contents of the chest, not by the label on its lid.

Code for this lesson: App.jsx
// A job board with an application window. The window is a <dialog> element opened by showModal().
// The "server" checks the resume like the schema in the project: size up to 2 MB and the first bytes %PDF-.
import { useRef, useState } from 'react';

const MAX_RESUME_BYTES = 2 * 1024 * 1024;
const pln = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'PLN', maximumFractionDigits: 0 });
const jobTypeLabels = { 'full-time': 'full-time', 'part-time': 'part-time', contract: 'contract', temporary: 'one voyage' };
const jobLevelLabels = { entry: 'deckhand', mid: 'boatswain', senior: 'officer', executive: 'captain' };

const jobs = [
  { id: 'j1', title: 'First mate', company: 'Black Pearl', location: 'Tortuga', type: 'full-time', level: 'senior', salary: { min: 9000, max: 12000 } },
  { id: 'j2', title: 'Expedition cartographer', company: "Queen Anne's Revenge", location: 'Nassau', type: 'contract', level: 'mid' },
];

// Sample files for those who do not have a resume at hand.
const samples = [
  { label: 'Real PDF', make: () => new File(['%PDF-1.7\n% Cartographer resume\n'], 'cv.pdf', { type: 'application/pdf' }) },
  { label: 'Image renamed to .pdf', make: () => new File([new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a])], 'cv.pdf', { type: 'application/pdf' }) },
  { label: 'PDF too large (2.5 MB)', make: () => new File(['%PDF-1.7\n', new Uint8Array(2.5 * 1024 * 1024)], 'cv-large.pdf', { type: 'application/pdf' }) },
];

async function serverCheckResume(file) {
  if (!file || file.size === 0) return 'Attach your resume as a PDF file.';
  if (file.size > MAX_RESUME_BYTES) return 'The resume can be at most 2 MB.';
  const head = new Uint8Array(await file.slice(0, 5).arrayBuffer());
  if (new TextDecoder().decode(head) !== '%PDF-') return 'This is not a PDF file.';
  return null;
}

function JobCard({ job, status, onApply }) {
  return (
    <article className="rounded-lg border border-gray-200 bg-white p-4">
      <h2 className="text-lg font-bold text-blue-700">{job.title}</h2>
      <p className="font-medium">{job.company}</p>
      <p className="text-sm text-gray-600">
        {job.location} · {jobTypeLabels[job.type]} · {jobLevelLabels[job.level]}
      </p>
      {job.salary && (
        <p className="text-sm font-medium">
          {pln.format(job.salary.min)} - {pln.format(job.salary.max)}
        </p>
      )}
      <div className="mt-3">
        {status ? (
          <p className="font-semibold text-green-700">Your application: {status}</p>
        ) : (
          <button type="button" onClick={() => onApply(job)} className="rounded-full bg-blue-600 px-5 py-1.5 font-semibold text-white">
            Apply
          </button>
        )}
      </div>
    </article>
  );
}

export default function App() {
  const dialogRef = useRef(null);
  const [job, setJob] = useState(null);
  const [file, setFile] = useState(null);
  const [report, setReport] = useState(null);
  const [error, setError] = useState(null);
  const [statuses, setStatuses] = useState({});

  const open = (selected) => {
    setJob(selected);
    setFile(null);
    setReport(null);
    setError(null);
    dialogRef.current?.showModal();
  };

  const choose = async (picked) => {
    setFile(picked);
    setError(null);
    if (!picked) return setReport(null);
    const head = new Uint8Array(await picked.slice(0, 5).arrayBuffer());
    setReport({
      name: picked.name,
      type: picked.type || '(none)',
      size: picked.size < 1024 ? picked.size + ' B' : (picked.size / 1024).toFixed(1) + ' KB',
      head: Array.from(head, (b) => b.toString(16).padStart(2, '0')).join(' '),
    });
  };

  const submit = async (event) => {
    event.preventDefault();
    const problem = await serverCheckResume(file);
    if (problem) return setError(problem);
    setStatuses((prev) => ({ ...prev, [job.id]: 'sent' }));
    dialogRef.current?.close();
  };

  return (
    <div className="min-h-screen bg-gray-100 p-4 text-gray-900">
      <div className="mx-auto max-w-xl space-y-3">
        <h1 className="text-2xl font-bold">Job offers</h1>
        {jobs.map((item) => (
          <JobCard key={item.id} job={item} status={statuses[item.id]} onApply={open} />
        ))}
      </div>

      <dialog ref={dialogRef} aria-labelledby="apply-title" className="m-auto w-full max-w-md rounded-lg p-5 backdrop:bg-black/50">
        <h2 id="apply-title" className="mb-3 text-xl font-bold">You are applying for: {job?.title}</h2>
        <form onSubmit={submit} className="space-y-3">
          <label htmlFor="resume" className="block font-semibold">Resume (PDF, up to 2 MB)</label>
          <input id="resume" type="file" accept="application/pdf" onChange={(e) => choose(e.target.files?.[0] ?? null)} />
          <div className="flex flex-wrap gap-2">
            {samples.map((sample) => (
              <button key={sample.label} type="button" onClick={() => choose(sample.make())} className="rounded border border-gray-300 px-2 py-1 text-xs">
                {sample.label}
              </button>
            ))}
          </div>
          {report && (
            <dl className="rounded bg-gray-50 p-2 font-mono text-xs">
              <div>name: {report.name}</div>
              <div>type from the browser: {report.type}</div>
              <div>size: {report.size}</div>
              <div>first bytes: {report.head}</div>
            </dl>
          )}
          {error && <p role="alert" className="text-sm text-red-600">{error}</p>}
          <div className="flex gap-2">
            <button type="submit" className="rounded-full bg-blue-600 px-5 py-1.5 font-semibold text-white">Send application</button>
            <button type="button" onClick={() => dialogRef.current?.close()} className="rounded-full border border-gray-300 px-5 py-1.5">Cancel</button>
          </div>
        </form>
      </dialog>
    </div>
  );
}

Spotted a mistake in this lesson?

Check yourself

Answer the questions from this lesson. Pick an answer to see right away whether it is correct.

  1. 1. What does the JobPost type in Crew Connections contain?

  2. 2. Why does the type field in JobPost come from the jobTypes array written with as const?

These are 2 of 6 questions for this lesson. Solve the rest in the game.

Hands-on tasks in the game

  • Horizontal ordering

    Arrange in one line the call that opens the application window: dialogRef.current?.showModal()

  • Code editor

    Job listing card

  • Vertical ordering

    Arrange the steps of the applyToJob Server Action:

  • Click in order

    Arrange reading the minimum salary from the offer: job.salary.min

  • Click in order

    Arrange the schema field with a list of allowed values: z.enum(jobTypes, "Choose a contract type from the list.")

  • Horizontal ordering

    Arrange in one line the salary range from JobCard: pln.format(job.salary.min) - pln.format(job.salary.max)

  • Horizontal ordering

    Arrange from the left the parts of the info line from JobCard (separated by a dot ·):

  • Code editor

    Job application modal

  • Vertical ordering

    Arrange an application for an offer from the click to the status:

  1. QuestionQuiz: JobPost fields
  2. QuestionQuiz: The jobTypes list with as const
  3. QuestionQuiz: The salary field
  4. Put in orderSorting: Opening the dialog window
  5. Coding taskPractice: Job card
  6. Put in orderSorting: Steps of the applyToJob action
  7. Click in orderSorting: Reading job.salary.min
  8. Click in orderSorting: A list of values in a schema
  9. Put in orderSorting: Salary range
  10. QuestionQuiz: Application status
  11. QuestionQuiz: Status of a new application
  12. Put in orderSorting: The offer info line
  13. Coding taskPractice: Apply modal
  14. Put in orderSorting: An application from click to status
  15. QuestionQuiz: The resume file type

Useful articles