Home › Astro › Astro content site rules

Astro content site rules

Cursor rules for Astro 5 sites with content collections, islands, and zero-JS-by-default pages.

CursorAstro

How to use

Save this as .cursor/rules/astro.mdc in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.cursor/rules/astro.mdcDownload  
---
description: Astro conventions
globs: ["src/**/*.{astro,ts,tsx,md,mdx}"]
---

# Astro

- Ship zero JavaScript by default. Use `.astro` components for static UI; add a framework island (`client:visible`, `client:idle`) only when interactivity is required, and prefer `client:visible` over `client:load`.
- Content lives in content collections defined in `src/content.config.ts` with zod schemas; query with `getCollection`/`getEntry`, never by globbing files manually.
- Every page sets `<title>`, meta description and canonical through a shared `BaseLayout.astro` with typed `Props`.
- Images via `astro:assets` `<Image />` with explicit `alt`; put source images in `src/assets`, not `public/`.
- Dynamic routes export `getStaticPaths`. Keep `output: 'static'` unless an adapter is explicitly needed.
- Styles: scoped `<style>` in components or Tailwind, whichever the file already uses.
- Verify with `npm run astro check && npm run build` before finishing.

Related rules

Chrome extension (Manifest V3) rules

Cursor rules for building Manifest V3 browser extensions with TypeScript and minimal permissions.

CursorChrome extensions

Universal vibe-coding guardrails

Always-on Cursor rules that keep any AI agent careful: plan first, small diffs, verify, never fake it.

CursorAny stack

Next.js App Router (TypeScript) rules

Cursor project rules for Next.js 15 App Router apps with TypeScript, Server Components, and Tailwind.

CursorNext.js

Nuxt 3 + Vue rules

Cursor rules for Nuxt 3 / Vue 3 apps using the Composition API, script setup and Pinia.

CursorVue / Nuxt

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.