nuxt-optimizer
Skill1 starsChanged 8 days agoMITView on GitHub
Audit and optimize Nuxt apps (Nuxt 4.6, Nuxt 5 compatibility flags, Vue 3.5, Vite 8, Nitro) for SSR/hybrid rendering and TTFB, useFetch/useAsyncData payload size and refetch waterfalls, route rules/ISR/SWR/caching correctness, server-route and database latency, bundle size and lazy hydration, images/fonts/scripts, and deployment, 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 Nuxt site, Nuxt 4 to 5, compatibilityVersion, useFetch/useAsyncData, payload size, routeRules/prerender/ISR/SWR, Nitro/server routes, NuxtImg/Nuxt Fonts/Nuxt Scripts, lazy hydration, hydration mismatch, bundle size, or "optimize my Nuxt app" -- even if they never say "audit" or "optimize".
- Reads credentials
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architecture-optimizerSkill
- csharp-optimizerSkill
- cpp-optimizerSkill
- c-optimizerSkill
- go-optimizerSkill
- node-service-optimizerSkill
- ruby-optimizerSkill
- rust-optimizerSkill
- docker-optimizerSkill
- kubernetes-optimizerSkill
- terraform-optimizerSkill
- animate-cssSkill
- animejsSkill
- auto-animateSkill
- gsapSkill
- lenisSkill
- magicuiSkill
- motionSkill
- react-moveSkill
- react-springSkill
- react-three-fiberSkill
- theatrejsSkill
- threejsSkill
- optimizer-routerSkill
- bootstrap-optimizerSkill
- pandacss-optimizerSkill
- sass-scss-optimizerSkill
- stylex-optimizerSkill
- tailwindcss-optimizerSkill
- twind-optimizerSkill
- unocss-optimizerSkill
- vanilla-extract-optimizerSkill
- angular-optimizerSkill
- astro-optimizerSkill
- ui-components-optimizerSkill
- nextjsSkill
- node-optimizerSkill
- react-optimizerSkill
- remix-optimizerSkill
- solid-optimizerSkill
- svelte-optimizerSkill
- tanstack-start-optimizerSkill
- vue-optimizerSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Run python <skill-dir>/scripts/audit.py <project-root> -- static scan of package.json, nuxt.config.*, app/, server/ and .vue/.ts sources …
- Very specific: line 17
Read references/tooling.md once: what can be measured here (nuxt build, nuxt preview, nuxt analyze, DevTools, Lighthouse).
- Very specific: line 34
Measure, never guess: Run nuxt build and nuxt preview (or the Nitro preset's server), then measure that.
- Very specific: line 44
Use plan mode: EnterPlanMode (load with ToolSearch if deferred), write the plan, present with ExitPlanMode.
- Very specific: line 63
One rendering mode per route: Use route rules for prerender/ISR/SWR/SSR:false instead of a global compromise.
- Very specific: line 65
Server code stays in
server/: Never import Vue app code into Nitro handlers or server code into the app. - Very specific: line 66
Runtime config, not
process.env, in app code: Only runtimeConfig.public reaches the browser. - Very specific: line 70
Docs move: Check nuxt.com for the installed version (4.x vs 5.x compat), not memory.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Nuxt Optimizer
Audit a Nuxt codebase, report what is slow or fragile and why, agree a plan with the user, then fix it. Order: evidence, approval, edits. Nuxt's performance is mostly decided by rendering mode, the SSR payload, caching rules and server handlers; changing those can silently change freshness or leak user data, so nothing is edited before approval.
Workflow
1. Scope (quick)
- Find the root (
package.jsonwithnuxt,nuxt.config.ts). Record: Nuxt version (4.6 current; 5 behindfuture.compatibilityVersion), Vue/Vite, rendering (universal, SPA, hybrid), Nitro preset, modules (image/fonts/scripts/content/ui), data layer, auth/session, and whetherapp/or legacy root dirs are used. - Run
python <skill-dir>/scripts/audit.py <project-root>-- static scan ofpackage.json,nuxt.config.*,app/,server/and.vue/.tssources for$fetchin setup, payload bloat, route-rule/cache mistakes, server/client leakage, raw images, XSS and bundle risks, with file:line evidence. Use--jsonto post-process. - Classify the pain: slow TTFB (SSR/data/cache), large payload/hydration, slow client navigation, slow API/server routes, build/deploy, or code health/migration. Ask which hurts if unclear.
- Read
references/tooling.mdonce: what can be measured here (nuxt build,nuxt preview,nuxt analyze, DevTools, Lighthouse).
2. Audit
The script finds cheap leads; you find the rest by reading. Read nuxt.config.ts, app/app.vue, the 3-5 hot pages, their composables, and the server routes they call. Load only what applies:
| Area | Reference |
| useFetch/useAsyncData, keys, payload, refetch, caching | references/data-fetching.md |
| Universal/SPA/hybrid, route rules, ISR/SWR/prerender, cache | references/rendering-cache.md |
| server/api, middleware, validation, runtimeConfig, storage | references/server-routes.md |
| NuxtImg, Fonts, Scripts, lazy components/hydration, CSS | references/ui-assets.md |
| Modules, Vite bundle, auto-imports, build/deploy | references/modules-build.md |
| XSS, secrets, auth/CSRF, types/tests, server/client split | references/safety-quality.md |
| Nuxt 5 compatibilityVersion and Nuxt 3 → 4 layout | references/nuxt5-migration.md |
| Measurement and honest reporting | references/tooling.md |
Measure, never guess. Run nuxt build and nuxt preview (or the Nitro preset's server), then measure that. Dev mode and a single warm navigation are not evidence. Record SSR TTFB, payload size, query/API timings, route JS, hydration and LCP/CLS.
Mark each finding Confirmed (build output, network/profiler, code evidence) or Suspected (needs measuring).
3. Report
Fill assets/report-template.md, save it as NUXT_OPTIMIZATION_REPORT.md in the project root, and show the user. Five-line summary, findings table 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:
- Quick wins -- replace setup
$fetchwithuseFetch/useAsyncData, add keys/pick/transform, parallelize independent requests, lazy non-critical data, addNuxtImg/fonts, lazy components, route rules for static pages, fix cache keys/headers. Low risk. - Structural -- choose SSR/ISR/SWR per route, move auth/data into server routes, split slow handlers, cache expensive functions, reduce payload/DTOs, add lazy hydration/
noScriptsfor static pages, restructure modules. Name each behavior change. - Heavy -- Nuxt 4 → 5 compatibility migration, Nuxt 3 → 4 layout, Nitro preset/edge change, module replacements, server architecture. Separately approved. Each step: files touched, expected effect, how to verify, how to roll back.
5. Fix
Only approved items, in small groups. After each: nuxt typecheck, lint, tests, nuxt build. A break must trace to one change. Do not mix a Nuxt major/compatibility migration with optimization edits. If a change makes a response cacheable that contains user data, or moves secret/server code toward the client, stop and ask.
6. Verify and wrap up
Re-measure the same routes: SSR TTFB, payload/HTML size, route JS, API/query latency, navigation, LCP/INP/CLS, cache hit rate. State plainly what could not be measured. End with deferred items and one suggested next step.
Principles
- The payload is the contract.
useFetch/useAsyncDataserialize server data into HTML for hydration;$fetchin setup fetches twice. - Keys and freshness are correctness. Same key means shared data; explicit keys,
pick/transform,watch,getCachedDataandclearNuxtDatadecide freshness and memory. - One rendering mode per route. Use route rules for prerender/ISR/SWR/SSR:false instead of a global compromise.
- Never cache per-user data in a shared layer. Cache keys must include user/tenant/locale when the output depends on them.
- Server code stays in
server/. Never import Vue app code into Nitro handlers or server code into the app. - Runtime config, not
process.env, in app code. OnlyruntimeConfig.publicreaches the browser; secrets stay private. - Ship less JS by default. Lazy components, lazy hydration,
noScripts, NuxtImg/Fonts/Scripts, and module pruning beat micro-optimizations. - Payload size beats extra requests.
pick/transform/DTOs andserialize: falsefor non-critical data keep HTML small. - Nuxt 5 is opt-in.
compatibilityVersion: 5changes data-fetching semantics; treat it as a migration. - Docs move. Check nuxt.com for the installed version (
4.xvs5.xcompat), not memory.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

