Free Astro tutorials for complete beginners.

Beginner's Guide to Astro

How to Build an Astro Website With Claude (Step by Step)

Use Claude to build a real Astro site, in the chat at claude.ai or with Claude Code in your terminal. This very site was built that way.

Tested on Astro 7.4

Cover image for How to Build an Astro Website With Claude (Step by Step)
In this guide
  1. Which way should you use?
  2. Before you start: create the project yourself
  3. Option 1: Build with the chat at claude.ai
  4. Option 2: Build with Claude Code
  5. Give Claude the Astro docs
  6. Check the work
  7. Where to go next
  8. Frequently asked questions

Claude is the AI assistant made by Anthropic. You can use it two ways to build an Astro site: chat with it at claude.ai and paste the code in yourself, or run Claude Code, which works inside your project and edits files for you.

Full disclosure: AstroBeginner itself was built with Claude Code, with a person checking the work. So this guide is what we actually do.

Which way should you use?

Chat at claude.ai Claude Code
Where it runs In your browser In your terminal, editor, or the Claude desktop app
Who edits the files You Claude, with your approval
Can it run commands? No Yes
Cost Free plan available Needs a paid Claude plan or API credits
Best for Learning, small changes Building and changing whole sites

If you’ve never built a site, start with the chat. You’ll learn more by pasting the code in yourself. Move to Claude Code when you’re comfortable.

Before you start: create the project yourself

Whichever way you go, create the Astro project with the official tool, not by asking the AI to write every file from scratch. The official starter is always up to date, and AI tools sometimes reach for old patterns.

npm create astro@latest my-site -- --template basics

If this is new to you, our free course walks through it. The project includes an AGENTS.md file with instructions for AI tools, which both Claude and ChatGPT read.

Option 1: Build with the chat at claude.ai

Step 1: Tell Claude what you have

Open a new chat and set the scene. Be specific about your version, because Astro changed a lot in 2026:

I'm a beginner building a website with Astro 7.4. I created the project with
"npm create astro@latest" using the basics template. I want a personal site
with a home page, an about page and a blog. Walk me through it one step at
a time, and show me the full contents of each file you want me to create.

Step 2: Do one step at a time

Claude will give you a file. Create it in your editor, paste the contents, save, and look at your site in the browser. Then tell Claude what you see, including any error, before asking for the next step.

This back-and-forth matters. If you ask for everything at once, one small mistake early on becomes ten confusing errors later.

Step 3: Paste errors exactly

When something breaks, copy the whole error from your terminal or browser and paste it. Don’t describe it in your own words. The file name and line number in the error are what Claude needs. See how to fix Astro errors with AI.

Option 2: Build with Claude Code

Step 1: Install Claude Code

On a Mac or Linux, run this in your terminal:

curl -fsSL https://claude.ai/install.sh | bash

Windows users have a PowerShell command in the official quickstart. Then open a new terminal window and check it worked:

claude --version

Step 2: Start it inside your project

cd my-site
claude

The first time, it asks you to log in through your browser. Then you’re at a prompt where you type in plain English.

Step 3: Give it the job

Try this as your first request:

Read AGENTS.md first. Then add an about page at /about with a short bio, and
add a link to it in the navigation. Start the dev server in the background
and check the page loads before you finish.

Claude Code reads your files, proposes changes, and asks before making them. Say yes when the change looks right. When it’s done, open the page yourself and check.

Step 4: Keep the steps small

Good requests for a beginner:

  • “Add a blog using content collections, with one example post.”
  • “Add Tailwind CSS using the official astro add command.”
  • “Build the site and tell me if there are any errors.”
  • “Deploy this to Cloudflare Workers. Explain each step before you run it.”

Avoid “build me a complete website”. You’ll get something, but you won’t understand it, and you won’t be able to fix it.

Give Claude the Astro docs

Claude’s knowledge has a cutoff date, and Astro moves fast. The fix is to connect it to the live Astro documentation through an MCP server. It’s a one-line setup, and it stops a whole class of outdated-code mistakes. See how to connect Claude and ChatGPT to the Astro docs.

Check the work

Before you publish anything an AI wrote:

  1. Run npm run build and make sure it passes.
  2. Click through every page on your phone and your computer.
  3. Read the code once, even if you don’t understand all of it. You’ll catch things like a wrong site name or a leftover placeholder.

Our list of mistakes AI makes with Astro tells you what to look for.

Where to go next

Frequently asked questions

Do I need to pay for Claude to build a website?

The chat at claude.ai has a free plan, which is enough to generate code you paste in yourself. Claude Code, which edits files for you, needs a paid Claude plan or API credits, according to its documentation.

Can Claude put my site online?

Claude Code can run the deploy commands for you if you give it permission. The chat version can only tell you what to type. Either way, you own the hosting account.

Is code from Claude safe to publish?

Treat it like code from a helpful colleague. Read it, run it, and test it before you publish. Our guide to the mistakes AI makes with Astro lists the things to check.

Stuck on a step?

Check the common errors guide, look up a word in the glossary, or ask in the official Astro Discord, where the support channels are friendly to beginners.

Keep reading

  1. How to Build an Astro Website With ChatGPT

    Use ChatGPT to build an Astro site, either by chatting and pasting code, or with Codex, OpenAI's coding agent that works inside your project.

    Build with AI, 8 minute read, November 6, 2026

  2. How to Build an EmDash Site With Claude or ChatGPT

    EmDash projects ship with files made for AI coding tools. Here's how to use Claude Code or Codex to customize an EmDash site without writing the code yourself.

    Build with AI, 7 minute read, November 6, 2026

  3. Claude vs ChatGPT for Building Websites: A Beginner's Comparison

    Claude and ChatGPT can both build an Astro site. Here's how they differ in practice, what each costs to use for coding, and how to choose.

    Build with AI, 6 minute read, November 6, 2026

Try "blog", "deploy" or "EmDash".