← ClaudeAtlas

nextjs-client-auditlisted

Audit a Next.js App Router project for unnecessary or misplaced "use client" directives, measure how much code each one drags into the browser bundle, and give a concrete, safe fix (REMOVE, PUSH_DOWN, CHILDREN_PATTERN, MOVE_FETCH) with Before/After code from the user's own files. Use this whenever the user says "audit use client", "check my client components", "review Server vs Client components", "why is my page heavy / slow", "my Next.js bundle is big", "First Load JS is too high", "too much JavaScript", "do I need use client here", or opens a Next.js app/ project and asks about performance, bundle size, hydration cost or React Server Components, even if they never say "use client".
radyelkasas/nextjs-client-audit · ★ 0 · Web & Frontend · score 70
Install: claude install-skill radyelkasas/nextjs-client-audit
# nextjs-client-audit Find every `"use client"` that should not be there (or sits too high in the tree), show what it costs, and hand the developer a fix they can trust. The developer wants a fast, accurate report built from their real code, not a lecture on Server Components. Why this matters: `"use client"` is not a label for one file. It is a **boundary**. The file and everything it imports gets bundled, shipped and hydrated in the browser. One directive at the top of a page or layout can quietly turn dozens of server-capable modules into client JavaScript. The fix is almost always small, but it has to be placed correctly or the app breaks. That is why this skill leans on a script for the facts and on you for judgment. ## 1. Run the audit (always first) Find the project root: the folder with `package.json` (listing `next`) and `app/` or `src/app/`. In a monorepo, run once per Next.js app. ```bash OUT="$(mktemp -d)" # or your scratchpad folder, if the environment gives you one node <this-skill>/scripts/audit.js <project-root> --json "$OUT/client-audit.json" --md "$OUT/client-audit.md" > /dev/null ``` - The script is **read-only**. It never edits the project, so you can run it without asking. - It prefers the TypeScript compiler API (resolved from the project's own `node_modules`, which almost every Next.js + TS project has), then `@babel/parser`, then a regex fallback. Check `parser` in the JSON. If it says `regex-heuristic`, tell the user the results are less preci