Generate production-ready Astro Cursor rules for Project Rules (.mdc), AGENTS.md, or legacy .cursorrules. This template encodes stack-specific conventions for projects using Astro. Content-first web framework with island architecture and zero-JS defaults.
The template focuses Cursor AI on concrete Astro practices instead of generic coding advice. Required sections are always included; optional sections can be enabled when they match your project.
Required guidance
- Component Model
- Content & Data
- Performance & Islands
- Routing & Pages
Default style
- Indentation: 2 spaces
- Quotes: single
- Semicolons: disabled
- Naming: camelCase
Example Astro Rules
The generator turns these sections into Project Rules with frontmatter, AGENTS.md, or a single .cursorrules file depending on the output format you choose.
Component Model
- Use .astro files for static/server-rendered components.
- Use framework components (React, Vue, Svelte) only for interactive islands.
- Use 2 spaces for indentation.
- Use camelCase for variable and function names.
- Keep component scripts (--- fences) server-side only.
- Use client:* directives only when client interactivity is needed.
Content & Data
- Use Content Collections for type-safe markdown/MDX content.
- Define collection schemas with Zod in src/content/config.ts.
- Use getCollection() for fetching content with filtering and sorting.
- Use getEntry() for single content items.
- Use Astro.glob() for non-collection file imports.
- Prefer static generation with getStaticPaths() for content pages.
Performance & Islands
- Ship zero JavaScript by default — add only where needed.
- Use client:load for immediately interactive components.
- Use client:idle for deferring to browser idle time.
- Use client:visible for lazy-loaded interactive components.
- Use client:media for media-query-driven hydration.
- Use client:only when a component must skip SSR entirely.
What does the Astro Cursor rules template include?
It includes 4 rule sections covering component model, content & data, performance & islands and other Astro development conventions.
Can I generate Astro Project Rules and AGENTS.md from the same template?
Yes. The generator can export the same stack-specific guidance as modern Project Rules (.mdc), AGENTS.md, or a legacy .cursorrules file.
Should I combine Astro with other Cursor rules templates?
Yes. You can combine Astro with related templates such as TypeScript, Tailwind CSS, Docker, or backend frameworks when your project uses multiple technologies.