astro

astro is a cursor rule for Cursor from nedcodes-ok/cursorrules-collection. It costs 408 tokens per session, scanned A, original, MIT.

A set of coding rules for Astro, a web framework for building fast websites, covering page structure, content, browser-side code, and images.

In plain words
What is it for?
It helps build Astro sites with file-based pages, validated content collections, reusable components, static generation, and limited browser-side JavaScript.
Why use it?
It gives an Astro project consistent decisions about where files belong, when JavaScript should run, and how structured content is checked.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

Good fit It helps build Astro sites with file-based pages, validated content collections, reusable components, static generation, and limited browser-side JavaScript.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/astro
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for astro

README.md
[![agentmods](https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/astro/github.svg)](https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/astro)
Your own site
<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/astro"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/astro/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for astro

Your own site · 80×15
<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/astro"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/astro.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 408 This file is loaded in full into every session.
When invoked 408 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00408 $0.00408
Opus 5.5 $0.00163 $0.00163
Sonnet 5.5 $0.00082 $0.00082
Haiku 4.5 $0.00041 $0.00041

Measured 1mo ago against content hash 1b752df3fb35, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

astro scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules-mdc/frameworks/astro.mdc · 46 lines

What it actually says

Astro Cursor Rules

You are an expert Astro developer. Follow these rules:

Architecture

  • Server-first: default to zero client JS. Add islands only for interactivity
  • Content collections with Zod schemas for all structured content
  • File-based routing in src/pages/. Dynamic routes with [...slug].astro
  • Layouts in src/layouts/, reusable components in src/components/

Islands Architecture

  • client:load only for immediately interactive components (nav menus, forms)
  • client:visible for below-fold interactive content (comments, carousels)
  • client:idle for non-critical interactivity (analytics widgets)
  • client:media for responsive islands (mobile-only menus)
  • Never client:load what could be client:visible

Content

  • Define collections in src/content/config.ts with strict Zod schemas
  • Use getCollection() and getEntry() — never raw file imports
  • MDX for content that needs components. Markdown for everything else
  • Frontmatter validation catches errors at build time — use it

Performance

  • Static generation (SSG) by default. SSR only for personalized/dynamic pages
  • Image component for all images — automatic format/size optimization
  • Inline critical CSS. Astro does this automatically — dont fight it
  • Prefetch visible links with data-astro-prefetch

Styling

  • Scoped styles in tags — they are component-scoped by default
  • Use :global() sparingly and only in layouts
  • CSS custom properties for theming over CSS-in-JS
  • No Tailwind classes in .astro files unless project-wide decision

Data Fetching

  • Fetch in frontmatter (server-side) — runs at build time for SSG
  • API routes in src/pages/api/ for dynamic endpoints
  • Use Astro.response for setting headers/status in SSR
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 46 lines · 408 tokens per session scan A 1b752df3fb35

Subscribe to this mod's changes

astro is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (38 stars, last pushed 7mo ago), licensed MIT. It adds 408 tokens to every session, about $0.0016 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.