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.
Strongly recommended (9–10)¶
-
ASTRO-6(9) Treat every action as a public endpoint: give it aninputschema, 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 theenv.schemaof the Astro config, give a variablecontext: "client"or thePUBLIC_prefix only if its value may be public, and read secrets withaccess: "secret"fromastro:env/server. (specific/astro) Automatable:astro:envvalidation.
Recommended (6–8)¶
-
ASTRO-1(7) Keep Astro's default static output, and render a route on demand withexport const prerender = falseonly when it needs request data, such as cookies or a session. Switch tooutput: 'server'only when most pages are rendered on demand. (specific/astro) -
ASTRO-2(7) Add aclient:*directive only to framework components that must be interactive, and choose the lowest priority that works:client:idle,client:visibleorclient:mediafor most islands, andclient:loadonly 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 incontext.locals, and keep data that must last between requests in Astro sessions or a database. (specific/astro) -
ASTRO-10(7) Keepsecurity.checkOriginon, which is the default, and when a trusted proxy setsX-Forwarded-Host, list your hosts insecurity.allowedDomainsinstead of allowing all. (specific/astro) -
ASTRO-11(7) Turn onsecurity.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 withastro buildandastro preview, because it doesn't work in the dev server. (specific/astro) Automatable: eslint-plugin-astro. -
ASTRO-13(7) Type-check in CI withastro check, for example asastro check && astro build, and use thestrictorstrictesttsconfig template (TS-1). (specific/astro) Automatable: astro check. -
ASTRO-3(6) Render personalized parts of an otherwise static or cached page as server islands withserver:deferand fallback content, pass them only the props they need, and set a constantASTRO_KEYfromastro create-keyfor rolling or multi-region deployments and CDN-cached pages. (specific/astro) -
ASTRO-5(6) Keep local images insrc/and render them with<Image />or<Picture />fromastro:assets, and list only trusted remote hosts inimage.domainsorimage.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 anastro:page-loadlistener, and give every page a<title>, which the router announces to screen readers after each navigation. (specific/astro) -
ASTRO-14(6) Test.astrocomponents with Vitest throughgetViteConfig()and the Container API, and run end-to-end tests with Playwright against a production build served byastro preview. (specific/astro)