Astro Rules
Content-focused static site with Astro and islands
# Role You are an expert Astro developer building content-focused websites with island architecture. # Tech Stack - Astro 5+ - TypeScript - MDX - Tailwind CSS # Code Conventions - Use Astro components (`.astro` files) for static content. - Use island architecture — only hydrate interactive components. - Use `client:load`, `client:visible`, or `client:idle` directives for interactive islands. - Use content collections for structured content (blog posts, docs). - Use TypeScript for type-safe frontmatter and props. - Use `getStaticPaths()` for dynamic routes. - Use Astro's built-in image optimization. - Keep pages zero-JS by default. # Code Style Preferences - Use TypeScript strict mode. Define types for all variables, parameters, and return values. - Never use the `any` type. Use `unknown` if the type is truly uncertain, then narrow it. - Use `const` by default. Only use `let` when reassignment is needed. Never use `var`. - Always handle errors explicitly. Use try/catch for async operations. Never silently swallow errors. - Use early returns (guard clauses) to reduce nesting and improve readability. - Use descriptive, meaningful names for variables, functions, and classes. Avoid abbreviations. - Keep functions small and focused. Each function should do one thing. Aim for under 50 lines. # What to Avoid - Do not ship unnecessary JavaScript to the client. - Do not use `client:load` on components that don't need interactivity. - Do not use heavy frameworks for static content. - Do not skip image optimization.
About Astro AI Rules
AI coding rules files help your AI assistant (Cursor, Windsurf, Claude Code, GitHub Copilot, or Cline) understand your project's conventions, tech stack, and coding standards. This ensures the AI generates code that matches your team's style and follows best practices for Astro.
This preset is designed for Astro projects and includes rules for:
- Use Astro components (`.astro` files) for static content.
- Use island architecture — only hydrate interactive components.
- Use `client:load`, `client:visible`, or `client:idle` directives for interactive islands.
- Use content collections for structured content (blog posts, docs).
- Use TypeScript for type-safe frontmatter and props.
Simply select your preferred AI IDE format above, then copy or download the generated rules file. Place it in your project's root directory and your AI assistant will automatically follow these conventions.
Get This Preset for a Specific IDE
Cursor
Astro rules for Cursor
Windsurf
Astro rules for Windsurf
Claude Code
Astro rules for Claude Code
GitHub Copilot
Astro rules for GitHub Copilot
Cline
Astro rules for Cline
Zed AI
Astro rules for Zed AI
Aider
Astro rules for Aider
Continue.dev
Astro rules for Continue.dev
Devin AI
Astro rules for Devin AI
Amazon Q
Astro rules for Amazon Q
Bolt.new
Astro rules for Bolt.new
Lovable
Astro rules for Lovable
Replit AI
Astro rules for Replit AI
Augment Code
Astro rules for Augment Code
JetBrains AI
Astro rules for JetBrains AI