Free Astro tutorials for complete beginners.

Beginner's Guide to Astro

9 Mistakes AI Makes With Astro (and How to Spot Them)

Claude, ChatGPT and other AI tools learned Astro from older tutorials. Here are the old patterns they produce, and the current code to use instead.

Tested on Astro 7.4

Cover image for 9 Mistakes AI Makes With Astro (and How to Spot Them)
In this guide
  1. 1. The content config in the wrong place
  2. 2. Old ways of reading posts
  3. 3. The old Tailwind integration
  4. 4. ViewTransitions instead of ClientRouter
  5. 5. Unclosed HTML tags
  6. 6. Markdown plugins without the extra setup
  7. 7. Astro DB
  8. 8. Words running together
  9. 9. Too old a Node.js version
  10. How to protect yourself
  11. Frequently asked questions

AI tools learned Astro from tutorials. Most tutorials are old. So the code was right in 2024 and breaks in 2026. We have seen every item on this list. We checked each fix against Astro 7.4.

1. The content config in the wrong place

What AI writes: src/content/config.ts.

What’s current: src/content.config.ts, right inside src. Astro also expects a loader now. A loader tells Astro where to find your posts:

import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';

const posts = defineCollection({
  loader: glob({ base: './src/content/posts', pattern: '**/*.md' }),
  schema: z.object({ title: z.string(), date: z.coerce.date() }),
});

export const collections = { posts };

How you’ll know: your blog shows nothing. Or the build complains it can’t find the collection. A build is making the finished copy of your site.

2. Old ways of reading posts

What AI writes: getEntryBySlug(), post.slug, or post.render().

What’s current: post.id for the address, and a separate render() function:

import { getCollection, render } from 'astro:content';
const { Content } = await render(post);

How you’ll know: errors that say slug or render does not exist.

3. The old Tailwind integration

Tailwind is a popular tool for styling pages. An integration is an add-on for Astro.

What AI writes: npx astro add tailwind that installs @astrojs/tailwind, plus a tailwind.config file.

What’s current: the same command now installs the Tailwind Vite plugin. It makes src/styles/global.css with one line, @import "tailwindcss";. There is no config file. See how to add Tailwind to Astro.

How you’ll know: the AI tells you to make tailwind.config.mjs.

4. ViewTransitions instead of ClientRouter

What AI writes: import { ViewTransitions } from 'astro:transitions'.

What’s current: import { ClientRouter } from 'astro:transitions'. Or just the CSS rule @view-transition { navigation: auto; } with no import at all. See page transitions in Astro.

5. Unclosed HTML tags

What AI writes: a <div> or <p> that never closes. Older Astro quietly fixed this.

What’s current: Astro 7 refuses to build it:

[CompilerError] Expected corresponding JSX closing tag for 'div'.

How you’ll know: exactly that error, with a file and line number.

6. Markdown plugins without the extra setup

What AI writes: remarkPlugins or rehypePlugins in your config, as if they just work.

What’s current: Astro 7 uses a new Markdown processor. Those plugins need an extra package and a processor setting. If you don’t need the plugin, remove it. If you do, the Astro 7 upgrade guide has the steps.

7. Astro DB

What AI writes: @astrojs/db and astro:db for storing data.

What’s current: Astro DB was removed in Astro 7. For a beginner site, use content collections. For a real database, see the best CMS for Astro or EmDash.

8. Words running together

What AI writes: inline elements on separate lines. For example, a <b> and an <i> one under the other.

What’s current: Astro 7 removes the space between them. So “Hello world” can become “Helloworld”. Add an explicit {" "} between the elements when the space matters.

9. Too old a Node.js version

What AI writes: “Astro needs Node 18” or similar.

What’s current: Astro 7 needs Node.js 22.23.4 or newer. Node.js is the program that runs Astro on your computer. Run node -v to check.

How to protect yourself

  • Say “Astro 7.4” in your first message, every time.
  • Connect your AI tool to the official Astro docs.
  • Run npm run build after every change. Most of these mistakes fail the build with a clear message. That is far better than failing quietly.
  • When in doubt, paste the AI’s code back. Ask it to check for the items on this list. Prompt 10 in our prompt collection does just that.

Frequently asked questions

Why does AI produce outdated Astro code?

AI models learn from text written before a cutoff date. Astro changed a lot in 2025 and 2026. Unless the tool checks the current docs, it reaches for what it saw most often, which is older code.

How do I stop these mistakes?

Tell the AI your Astro version. Connect it to the official Astro docs. Run npm run build after every change. Most of these mistakes produce a clear error.

Stuck on a step?

Check the common errors guide, look up a word in the glossary, or ask the friendly people in the official Astro and EmDash Discords. How to ask so people can help.

Keep reading

  1. How to Get Your Astro Site Cited by ChatGPT, Claude and Google AI

    AI assistants answer with links. What makes a site easy for them to read and cite: clear pages, structured data, a sitemap, Bing and llms.txt. Honest about what's proven.

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

  2. How to Build an Astro Website With Gemini

    Use Google's Gemini to build an Astro site, in the free chat or with Antigravity, Google's coding agent that replaced the Gemini CLI in 2026.

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

  3. Can I Build an Astro Site With Grok, Kimi, DeepSeek or Qwen?

    Yes. Any AI chat can write Astro code for you. Here's the method that works with all of them, and which ones also have a coding agent that edits your project.

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

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