Skip to content

Astro checklist

Copy this list into a pull request, design review or project kickoff and tick what applies. Rules are grouped by level and sorted by score (criteria). Each links to the file that explains it and cites its sources. Automatable names tools that can check the rule in CI (see the file's "How to enforce" section).

Also apply the general checklist.

This file is generated by python3 scripts/rank.py fix from the guidelines. Don't edit it by hand.

  • ASTRO-6 (9) Treat every action as a public endpoint: give it an input schema, and check authorization in its handler, not only in middleware or on the page that calls it. (specific/astro)
  • ASTRO-7 (9) Declare environment variables in the env.schema of the Astro config, give a variable context: "client" or the PUBLIC_ prefix only if its value may be public, and read secrets with access: "secret" from astro:env/server. (specific/astro) Automatable: astro:env validation.
  • ASTRO-1 (7) Keep Astro's default static output, and render a route on demand with export const prerender = false only when it needs request data, such as cookies or a session. Switch to output: 'server' only when most pages are rendered on demand. (specific/astro)
  • ASTRO-2 (7) Add a client:* directive only to framework components that must be interactive, and choose the lowest priority that works: client:idle, client:visible or client:media for most islands, and client:load only for visible UI that must be interactive at once. (specific/astro)
  • ASTRO-4 (7) Manage sets of structured content in content collections with a schema, and prefer build-time collections: use live collections only when content must be fresh on every request. (specific/astro) Automatable: Content collection schema validation.
  • ASTRO-8 (7) Render every page that depends on the visitor, such as pages behind a login or with personalized content, on demand, and check authentication on each request in middleware or in the page. (specific/astro)
  • ASTRO-9 (7) Pass request data, such as the current user, from middleware to pages and endpoints in context.locals, and keep data that must last between requests in Astro sessions or a database. (specific/astro)
  • ASTRO-10 (7) Keep security.checkOrigin on, which is the default, and when a trusted proxy sets X-Forwarded-Host, list your hosts in security.allowedDomains instead of allowing all. (specific/astro)
  • ASTRO-11 (7) Turn on security.csp, which adds hashes for Astro's own scripts and styles to a CSP <meta> element on every page, add your other directives in its options, and don't add 'unsafe-inline'. Test it with astro build and astro preview, because it doesn't work in the dev server. (specific/astro) Automatable: eslint-plugin-astro.
  • ASTRO-13 (7) Type-check in CI with astro check, for example as astro check && astro build, and use the strict or strictest tsconfig template (TS-1). (specific/astro) Automatable: astro check.
  • ASTRO-3 (6) Render personalized parts of an otherwise static or cached page as server islands with server:defer and fallback content, pass them only the props they need, and set a constant ASTRO_KEY from astro create-key for rolling or multi-region deployments and CDN-cached pages. (specific/astro)
  • ASTRO-5 (6) Keep local images in src/ and render them with <Image /> or <Picture /> from astro:assets, and list only trusted remote hosts in image.domains or image.remotePatterns. (specific/astro)
  • ASTRO-12 (6) Prefer the browser's native cross-document view transitions, and add <ClientRouter /> only for features that need it. With it, run code that must run on every page in an astro:page-load listener, and give every page a <title>, which the router announces to screen readers after each navigation. (specific/astro)
  • ASTRO-14 (6) Test .astro components with Vitest through getViteConfig() and the Container API, and run end-to-end tests with Playwright against a production build served by astro preview. (specific/astro)