astro-optimizer
/astro-optimizer
Audit and optimize Astro sites (Astro 4, 5, 6 and 7; static or SSR with the node, Netlify, Vercel or Cloudflare adapters) for client JavaScript and island hydration, Core Web Vitals, images and fonts, content collections and build time, route caching, server islands, CSP/env safety, and upgrade fallout, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions a slow Astro site, too much JavaScript, client:load/client:visible/client:only, islands or server islands, hydration, Lighthouse LC
- Author
- RuneStone-Tech ↗
- Repository
- optimize-anything ↗
- Licence
- MIT
- Last repository change
- 04.11.2026
Assessment and security
- Files in this package
- 12
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 04.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: scripts/audit.py
What it does and when to use it
Audit and optimize Astro sites (Astro 4, 5, 6 and 7; static or SSR with the node, Netlify, Vercel or Cloudflare adapters) for client JavaScript and island hydration, Core Web Vitals, images and fonts, content collections and build time, route caching, server islands, CSP/env safety, and upgrade fallout, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions a slow Astro site, too much JavaScript, client:load/client:visible/client:only, islands or server islands, hydration, Lighthouse LC
Original author description
Audit and optimize Astro sites (Astro 4, 5, 6 and 7; static or SSR with the node, Netlify, Vercel or Cloudflare adapters) for client JavaScript and island hydration, Core Web Vitals, images and fonts, content collections and build time, route caching, server islands, CSP/env safety, and upgrade fallout, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions a slow Astro site, too much JavaScript, client:load/client:visible/client:only, islands or server islands, hydration, Lighthouse LC
How it works
- Workflow
- Principles
SKILL.md preview
--- name: astro-optimizer description: Audit and optimize Astro sites (Astro 4, 5, 6 and 7; static or SSR with the node, Netlify, Vercel or Cloudflare adapters) for client JavaScript and island hydration, Core Web Vitals, images and fonts, content collections and build time, route caching, server islands, CSP/env safety, and upgrade fallout, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions a slow Astro site, too much JavaScript, client:load/client:visible/client:only, islands or server islands, hydration, Lighthouse LCP/INP/CLS, astro:assets or Image/Picture, font loading, ViewTransitions/ClientRouter, prefetch, content collections taking forever to build, getStaticPaths, SSR TTFB, route caching, CSP, or upgrading Astro 5 to 6/7 -- even if they never say "audit" or "optimize". --- # Astro Optimizer Audit an Astro codebase, report what is slow or fragile and why, agree a plan with the user, then fix it. Order: evidence, approval, edits. Astro's promise is HTML first and JavaScript only where you ask for it, so the first question is always what is being hydrated that does not need to be. Hydration, caching and CSP changes can alter behavior or security, so nothing is edited before approval. ## Workflow ### 1. Scope (quick) - Find the project root (`package.json` with `astro`, plus `astro.config.*`). Record: Astro major, output mode (`static` by default, or `server`), adapter, integrations, UI framework renderers, content collections, `site`, Node version and package manager. If `output: 'hybrid'` is still present, the project predates Astro 5. - Run `python <skill-dir>/scripts/audit.py <project-root>` -- static scan of `package.json`, `astro.config.*` and `.astro`/`.ts`/`.js`/`.mdx` sources for version leftovers, hydration cost, image/font gaps, XSS and cache misuse, with file:line evidence. Use `--json` to post-process. - Classify the pain: slow load (JS/CSS/images/fonts), bad LCP or CLS, slow interactions (heavy islands), slow SSR/TTFB (origin/cache), slow build (collections/images), or code health/upgrade. Ask which hurts if unclear. - If the user only gave a URL, say a code audit needs the repo; meanwhile collect field data (CrUX/PageSpeed Insights) and do not guess at causes. Read `references/tooling.md` once to see what can actually be measured here. - Astro sites often contain React/Svelte/Vue islands. Optimize the island boundary here; for component internals inside an island, hand off to the matching framework optimizer. ### 2. Audit The script finds cheap leads; you find the rest by reading. Read `astro.config.*`, the base layout, the home page, the 3-5 most important routes, and every component with a `client:*` directive. Load only what applies: | Area | Reference | | ----------------------------------------------------------------- | --------------------------------- | | Islands, client directives, hydration, framework components | `references/islands-hydration.md` | | Output modes, prerender, server islands, route caching, sessions | `references/rendering-caching.md` | | Content collections, live collections, data fetching, build scale | `references/content-data.md` | | Images, responsive srcset, fonts, CSS delivery | `references/assets-fonts.md` | | Script processing, view transitions, prefetch, bundles, CWV | `references/scripts-bundle.md` | | XSS/CSP/secrets, accessibility, types, tests, upgrades | `references/safety-quality.md` | | Production measurement and honest reporting | `references/tooling.md` | **Measure, never guess.** Build for production, run it (`astro preview` or the adapter's server), and measure that. Count islands by directive, inspect transferred JS per island, and check the LCP image and font requests. Dev-server timings mean nothing, and a single Lighthouse run is weaker evidence than field p75 data. Mark each finding **Confirmed** (build output, network panel, code evidence) or **Suspected** (needs measuring). ### 3. Report Fill `assets/report-template.md`, save it as `ASTRO_OPTIMIZATION_REPORT.md` in the project root, and show the user. Five-line summary, findings table sorted by impact/effort, then per-finding detail (evidence, why it hurts, fix, risk, behavior impact). Group near-duplicates. ### 4. Plan -- then stop for approval Use plan mode: `EnterPlanMode` (load with ToolSearch if deferred), write the plan, present with `ExitPlanMode`; if unavailable show it in chat and wait for an explicit "go". Structure: 1. **Quick wins** -- `client:load` to `client:visible`/`client:idle`, delete client directives from components that render static markup, use `<Image>`/`<Picture>` with `layout` and real dimensions, preload the one real font, enable prefetch, remove unused integrations, add cache headers. Low risk. 2. **Structural** -- replace a framework island with `.astro` + `<script>`/custom element, split a header island into a small cart island, move personalization into a `server:defer` island, prerender routes that do not need request data, move ad-hoc content globs to collections, adopt route caching. Name each behavior change. 3. **Heavy** -- Astro 5 to 6 to 7 upgrade, removing a UI framework or adapter, changing image service, adopting view transitions site-wide. Separately approved. Each step: files touched, expected effect, how to verify, how to roll back. ### 4b. Experimental gate (ask before enabling) Astro's experimental flags (`clientPrerender`, `incrementalBuild`, `parallelPrerender`, `svgOptimization`, `collectionStorage`, `staticRedirectPage`, plus adapter experimental CDN cache providers) can help, but they may change between minors, need host support, or change output. Never enable them as part of a "quick win": list only the ones that fit this project in an **Experimental candidates** section with benefit, risk, rollback and the version that introduced them, then ask which, if any, the user wants. Declined flags stay out of the plan. ### 5. Fix Only approved items, in small groups. After each: `npx astro check` (if installed), the project's lint and tests, then `npx astro build`. A break must trace to one change. Do not mix an upgrade with optimization edits. If an approved change turns out to expose per-user data to a shared cache, or to remove interactivity users had, stop and ask. ### 6. Verify and wrap up Re-measure the same scenario: transferred JS per island, island count by directive, LCP/INP/CLS on a production build, build wall time and page count, and SSR TTFB for server-rendered routes. State plainly what could not be measured. End with deferred items and one suggested next step. ## Principles - **Ship less JavaScript.** An island is a cost, not a feature. Every `client:*` directive must earn its framework runtime. - **Choose the cheapest directive that keeps the interaction.** `client:visible` below the fold, `client:idle` for non-urgent, `client:load` only for above-the-fold interactivity, `client:only` only when SSR is impossible. - **Static by default, dynamic by exception.** `prerender = false` is a decision with a hosting and cache cost; keep it off routes that can be built. - **Server islands beat making the whole page dynamic.** Defer the avatar, cart count or price, cache the shell. - **Content collections beat ad-hoc globs** for structured content, and build-time beats request-time unless freshness is the point. - **Images and fonts decide LCP and CLS.** A hero image in `public/` with no `width`/`height` is a finding, not a style choice. - **Caching is correctness first.** Never let a shared CDN or route rule cache a per-user response; state the staleness trade-off for every cache change. - **Do not break HTML, SEO or accessibility for speed.** Keep semantic markup, real links, alt text, focus handling and error pages. - **Docs move.** Astro 5, 6 and 7 differ (removed `Astro.glob`/`ViewTransitions`, strict Rust compiler, new Markdown pipeline). Check the docs for the version in `package.json`, not memory.
Files in this package (12)
- LICENSE 1 KB
- README.md 1 KB
- SKILL.md 8 KB
- assets/report-template.md 2 KB
- references/assets-fonts.md 5 KB
- references/content-data.md 5 KB
- references/islands-hydration.md 5 KB
- references/rendering-caching.md 5 KB
- references/safety-quality.md 5 KB
- references/scripts-bundle.md 6 KB
- references/tooling.md 4 KB
- scripts/audit.py 20 KB
Versions
The database has no other skills named astro-optimizer.
Database snapshot: 13.11.2026 · package version da20c52abe59 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 3 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90fe-astro
Writes and reviews Astro 7 sites - islands and client directives, server islands, processed scripts, astro:assets images, content collections and environment variables - so pages ship little JavaScript and stay safe. Use when editing .astro files or astro.config, adding a React,… - 100astro
Skill for building with the Astro web framework. Helps create Astro components and pages, configure SSR adapters, set up content collections, deploy static sites, and manage project structure and CLI commands. Use when the user needs to work with Astro, mentions .astro files,… - 100astro
Use when building a content-driven or marketing site with Astro 6: static-first pages, islands and partial hydration, content collections, server islands, per-route on-demand rendering, deploy adapters, and Astro 5→6 migration. NOT app-router React with server actions and heavy… - 100astro
Astro 5+ knowledge base - Content Collections, Islands, SSG/SSR, integrations. Use when working on an Astro project, building static sites, or migrating from Next.js to Astro. - 100astro
Builds Astro sites with islands, content collections, actions and server rendering. Use when editing .astro files, astro.config.mjs or src/content.config.ts, choosing client:* or server:defer, upgrading Astro, or cutting shipped JavaScript, including output mode, adapter and… - 100astro-static-islands
Use this skill when building content-focused websites using Astro static islands architecture to achieve near-zero client-side JavaScript.