Vibe coding with Claude Code course ยท Module 2: A Next.js project with Claude Code

The Kraken's Call landing page from plan to push

10 min read ยท
In this lesson13

Ahoy! This is the last lesson of the location and its main project. You have a plan in SPEC.md, regulations in CLAUDE.md and a logbook on GitHub. Today you will build the whole landing page the way you will build every clone on this journey: in small steps, with proof after each one.

The problem: five steps at once is a storm

You could write "carry out the whole plan from SPEC.md". Claude would then change four files within minutes, and if the build fell over, you would not know which step broke it. /rewind would undo everything at once, also what worked. One step per request gives a small diff to read, one check and one point of return.

Where the ship stands

Start with the state of the logbook: type ! git status in the session and compare the result with this:

On branch feature/how-to-play
nothing to commit, working tree clean

This is the branch from lesson 1_5, which already holds the commits with SPEC.md and CLAUDE.md. "Working tree clean" means that the list in Source Control is empty and the last good state is saved. If something is waiting on it, make a commit first.

The loop of one section

Every step of the plan will go through the same loop. You know it from lesson 0_6, and proof from the build is added to it:

1. The list in Source Control is empty: a good state is saved.
2. The request: one step of the plan from @SPEC.md.
3. Proof: Claude runs npm run build and shows the result.
4. Review: the diff in Source Control and the page in the browser.
5. Good? A commit with a message. Bad? /rewind and a smaller step.

The loop always ends with a save or an undo, never with an unsaved change on which the next step is built. Keep the npm run dev server in a second terminal, so that after every step you can look into the browser.

Step 1: a shared crew file

The session in Manual mode, and the request shorter than ever before in this location:

Request for Claude Code:

Carry out step 1 from the "Build plan" part of @SPEC.md and nothing
more. At the end run npm run build and show the result.

The goal, the files, the limits and the check are already in SPEC.md and CLAUDE.md, so you do not repeat them in every conversation. This is how the work from the two previous lessons pays off.

What Claude wrote

Open the new file components/crew.tsx in Cursor. The types from lesson 1_4 got the word export:

export type CrewRole = "captain" | "helmsman" | "cook" | "bosun";

export interface CrewMember {
  name: string;
  role: CrewRole;
  level: number;
  parrot?: string;
}

export makes a name available to other files. Below stand the crew data and the CrewCard component, also with export, and their content has not changed. The app/crew/page.tsx file now begins with a single line:

import { CrewCard, crew } from "@/components/crew";

import fetches names from another file, and the curly braces choose those that the other file exports. @/ is the alias from lesson 1_2, that is, the main project folder. The /crew page lost thirty lines, but in the browser it must look exactly the same: check that before the commit.

Step 2: the hero and the crew on the home page

The request stays the same, only the number of the step changes. In app/page.tsx the hero stopped being the whole page and became the first section, and below it stands the crew section:

<section className="px-6 py-16">
  <h2 className="text-center text-3xl font-bold text-red-600">Crew</h2>
  <div className="mx-auto mt-8 grid max-w-4xl grid-cols-1 gap-4 md:grid-cols-3">
    {crew.map((member) => (
      <CrewCard key={member.name} member={member} />
    ))}
  </div>
</section>

<section> groups one part of the page, and <h2> is a second-level heading, because the <h1> belongs to the name of the game in the hero. The grid and crew.map are the same code as on the /crew page: the cards have not been copied, only imported. The whole page is now wrapped in <div className="bg-black text-white">, so the black background runs through all the sections.

Step 3: How to play

Claude wrote the three steps of the game as data, the same way as the crew:

const steps = [
  { title: "Gather a crew", text: "Pick three pirates and give them roles on deck." },
  { title: "Set the course", text: "Plan a route across the map and steer clear of the shoals." },
  { title: "Defeat the kraken", text: "Win the battle before the kraken drags the ship under the water." },
];

It did not add a type, because TypeScript infers it from the values, as lesson 1_4 said: every step has a title and text as text. The section shows the steps in a numbered list:

<ol className="mx-auto mt-8 grid max-w-4xl grid-cols-1 gap-4 md:grid-cols-3">
  {steps.map((step, index) => (
    <li key={step.title} className="rounded-lg bg-gray-900 p-6">
      <p className="text-sm font-semibold text-yellow-400">Step {index + 1}</p>
      <h3 className="mt-2 text-xl font-bold">{step.title}</h3>
      <p className="mt-2 text-gray-300">{step.text}</p>
    </li>
  ))}
</ol>

<ol> is a numbered list and <li> is its element. index is the number of the step counted from zero, which is why the page shows index + 1. On a phone the steps stand one under another, and from 768 pixels in three columns.

The footer stands below <main>, because it does not belong to the main content of the page:

<footer className="border-t border-gray-800 px-6 py-8 text-center text-sm text-gray-400">
  <p>Kraken&apos;s Call, 2026</p>
  <a href="https://github.com/YOUR-LOGIN/krakens-call" className="mt-2 inline-block text-yellow-400 underline hover:text-yellow-300">
    Game code on GitHub
  </a>
</footer>

<a> with the href attribute is a link, and YOUR-LOGIN you replace with your own login. The underline class stays permanently, because hover: does not work on a phone, and a link should look like a link without hovering. Step 5 changes the title in metadata in app/layout.tsx to "Kraken's Call", so that the browser tab does not say "Create Next App", and checks that lang="en" stands in the <html> tag: according to MDN the lang attribute lets screen readers pronounce the text in the right language. I checked this code in a copy of the project: npm run build, npm run lint and npx tsc --noEmit pass without errors.

Break it and recover

Break the build on purpose once, so that the safety net is not just theory. After the commit of any step, give this request:

In @components/crew.tsx rename the level field in the CrewMember
interface to rank. Change only that one line and do not run any
commands.

Then run the check yourself by typing ! npm run build. The result ends more or less like this:

โœ“ Compiled successfully in 308ms
  Running TypeScript ...
components/crew.tsx(11,42): error TS2353: Object literal may only specify known properties, and 'level' does not exist in type 'CrewMember'.
components/crew.tsx(25,39): error TS2339: Property 'level' does not exist on type 'CrewMember'.
Failed to type check.

"Compiled successfully" does not mean success: only the type check discovered that the data and the card still use level, while the contract no longer knows it. Type /rewind, choose that request and Restore code. The list in Source Control is empty again, and ! npm run build passes. When the error is real, ask Claude to read the message and fix only its cause. After two failed fixes do not add a third: go back with /rewind to a good state and give a smaller request.

What /rewind will not undo here

A checkpoint remembers the files that Claude changes with its editing tools. In this project the limits from lesson 0_6 look like this:

  • a package from npm install: package.json and package-lock.json are changed by a command, so if Claude had not edited them earlier with its tool, /rewind will not restore them; git restore package.json package-lock.json will;
  • a commit: git commit is also a command, so the save stays in the history even after the files are undone;
  • a push: what went to GitHub has left your computer.

That is why you make a commit before a risky step, and push only after a review.

Push to GitHub

When each of the five steps has its commit, ask for the branch to be merged and sent:

Request for Claude Code:

Merge the feature/how-to-play branch into main and push main to
GitHub. Show the commands before you run them, and at the end the
result of git log --oneline.

Claude will ask for consent to three commands:

git switch main
git merge feature/how-to-play
git push

git switch main returns to the main branch, and git merge pours the commits of the feature branch into it. Nothing has changed on main in the meantime, so Git simply moves it forward and prints "Fast-forward". After the merge git status says "Your branch is ahead of 'origin/main'", that is, main knows its repository on GitHub and a plain git push is enough. Before you agree, check that --force stands nowhere.

The captain's checklist

Before you send the link to the mentor, go through the list:

  1. Build: npm run build, npm run lint and npx tsc --noEmit pass, and you saw the results yourself.
  2. Honest types: the diffs have no any or @ts-ignore.
  3. Narrow screen: after narrowing the window to a phone width the cards and steps stand one under another, and the text does not touch the edges.
  4. Contrast: every text clearly stands out from the background, and the link is underlined.
  5. Secrets: the repository has no .env, because the .gitignore from the wizard skips every file that begins with .env.
  6. Logbook: git log --oneline shows a small commit for every step, and the titles say what changed.

A typical agent mistake in this loop: it does more than you asked, for example at step 3 it adds the footer "while at it". You will see it in Source Control as a diff bigger than the step announced. Answer with /rewind and repeat the request with the addition "only step 3".

Next step

Open the repository in the browser and paste its address into the mentor task. The mentor will check SPEC.md with the plan, a short CLAUDE.md with the @AGENTS.md import, commits in small steps and a build without errors. In the next location you will start a Twitter clone and take every feature of it through the same loop. In the editor below waits a ready landing page in HTML: narrow the preview and go through the checklist with your own eyes.

Remember: every clone on this journey you will build with the same loop, and today you sailed it for the first time from port to port.

Code for this lesson: index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kraken's Call</title>
    <!-- Tailwind CSS 4 from a CDN: a version for learning, not for production -->
    <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
</head>
<body class="bg-black text-white">
    <!-- The landing page from lesson 1_8 in plain HTML. In the Next.js project it is app/page.tsx with className -->
    <main>
        <!-- Step 2: the hero as the first section -->
        <section class="flex min-h-screen items-center justify-center px-6">
            <div class="max-w-xl text-center">
                <h1 class="text-4xl font-bold text-red-600 md:text-6xl">Kraken's Call</h1>
                <p class="mt-4 text-lg text-gray-300">
                    A pirate browser game: gather a crew and face the kraken.
                </p>
                <button class="mt-8 rounded-lg bg-yellow-500 px-6 py-3 font-semibold text-black transition-colors hover:bg-yellow-600">
                    Join the crew
                </button>
            </div>
        </section>

        <!-- Step 2: the crew section, the same cards as on the /crew page -->
        <section class="px-6 py-16">
            <h2 class="text-center text-3xl font-bold text-red-600">Crew</h2>
            <div class="mx-auto mt-8 grid max-w-4xl grid-cols-1 gap-4 md:grid-cols-3">
                <article class="rounded-lg border border-yellow-500 bg-gray-900 p-6">
                    <h3 class="text-xl font-bold">Anne Bonny</h3>
                    <p class="mt-2 text-gray-300">captain, level 10</p>
                    <p class="mt-2 text-yellow-400">Parrot: Captain Feather</p>
                </article>
                <article class="rounded-lg border border-yellow-500 bg-gray-900 p-6">
                    <h3 class="text-xl font-bold">Jack Rackham</h3>
                    <p class="mt-2 text-gray-300">helmsman, level 7</p>
                </article>
                <article class="rounded-lg border border-yellow-500 bg-gray-900 p-6">
                    <h3 class="text-xl font-bold">Mary Read</h3>
                    <p class="mt-2 text-gray-300">cook, level 5</p>
                </article>
            </div>
        </section>

        <!-- Step 3: How to play, a numbered list -->
        <section class="px-6 py-16">
            <h2 class="text-center text-3xl font-bold text-red-600">How to play</h2>
            <ol class="mx-auto mt-8 grid max-w-4xl grid-cols-1 gap-4 md:grid-cols-3">
                <li class="rounded-lg bg-gray-900 p-6">
                    <p class="text-sm font-semibold text-yellow-400">Step 1</p>
                    <h3 class="mt-2 text-xl font-bold">Gather a crew</h3>
                    <p class="mt-2 text-gray-300">Pick three pirates and give them roles on deck.</p>
                </li>
                <li class="rounded-lg bg-gray-900 p-6">
                    <p class="text-sm font-semibold text-yellow-400">Step 2</p>
                    <h3 class="mt-2 text-xl font-bold">Set the course</h3>
                    <p class="mt-2 text-gray-300">Plan a route across the map and steer clear of the shoals.</p>
                </li>
                <li class="rounded-lg bg-gray-900 p-6">
                    <p class="text-sm font-semibold text-yellow-400">Step 3</p>
                    <h3 class="mt-2 text-xl font-bold">Defeat the kraken</h3>
                    <p class="mt-2 text-gray-300">Win the battle before the kraken drags the ship under the water.</p>
                </li>
            </ol>
        </section>
    </main>

    <!-- Step 4: the footer below main, the link underlined permanently -->
    <footer class="border-t border-gray-800 px-6 py-8 text-center text-sm text-gray-400">
        <p>Kraken's Call, 2026</p>
        <a href="https://github.com/YOUR-LOGIN/krakens-call" class="mt-2 inline-block text-yellow-400 underline hover:text-yellow-300">
            Game code on GitHub
        </a>
    </footer>
    <!-- Checklist: narrow the preview to a phone width. Do the cards and steps stand one under another? Does the text avoid the edges? -->
</body>
</html>

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. After a plan step npm run build ends with a type error. What do you do first?

  2. 2. Claude reports: step done, npm run build passes. What will that build not check for you?

  3. 3. Why do you build the landing page with one plan step per request and not with the whole plan at once?

Hands-on tasks in the game

  • Vertical ordering

    Arrange the steps of the exercise in which you break the build on purpose and return to the working version:

  • Click in order

    Click the elements in order to build the command that merges the feature/how-to-play branch into the current branch:

  1. QuestionQuiz: The build does not pass
  2. Put in orderOrdering: Break it and recover
  3. QuestionQuiz: What the build will not check
  4. Click in orderOrdering: Branch merge command
  5. QuestionQuiz: One step per request
  6. Project to submitSubmit the Kraken's Call landing page
  7. VideoModule Summary

Useful articles