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

Cloudflare Agents SDK rules

Cursor rules for stateful AI agents on Cloudflare (agents package): Durable Object state, SQL, scheduling, and WebSockets.

CursorCloudflare Workers / Hono

Convex backend rules

Cursor rules for Convex backends: schema, validated queries/mutations/actions, indexes, and auth checks.

CursorConvex

Modern C++ with CMake rules

Cursor rules for modern C++ (C++20/23) projects built with CMake presets: RAII, ownership, warnings, and tests.

CursorC++

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.