next-bundle-optimizer
БесплатноБез исполняемых скриптовНе проверенAudit and reduce Next.js browser initial-load work. Use for slow route startup, oversized client bundles, duplicate browser dependencies, or features that can…
от Asymmetric-al★ 354 звезды на GitHubОб этом скилле
This repository (Asymmetric-al/core)
Core overlay, reviewed 2026-11-18 against Next.js 16.4.5. The upstream text below is unchanged. Where it conflicts with this block, this block wins.
- Apps. Use it for
apps/admin,apps/donorandapps/missionary, which build with Turbopack.next analyzeworks only with Turbopack, so it does not apply toapps/factory-console, which builds withnext build --webpack. - Bun, not pnpm. From the app directory run
bunx next analyze --output --snapshot <name>andbunx next analyze export --snapshot <name>, resolve the schema withnode -p "require.resolve('next/analyze/graph-v1.schema.json')", and inspect the dependency graph withbun why <package>. Check--helpfor the installed options. These capture commands are unexercised in Core: they were checked only against--helpand no capture has been run here yet, so confirm the exact form on first use and report what worked. - Output stays out of the repository. Snapshots stay in the app's ignored
.next/diagnostics/analyze. Write exported.jsonl.gzfiles to a scratch directory outside the repository, not a hard-coded/tmp, and never commit them. If a capture fails for missing environment, stop and report it; do not supply values yourself.instant-nav.rig.mdruns thescripts/run-with-ci-env.mjswrapper from the repository root for builds; it has not been tried withnext analyze. - Sandboxes. When the capture has to run outside a sandbox, ask through the client's own permission request. Do not change sandbox or approval settings yourself.
- Fix mode. Dependency changes follow
docs/ai/skills/npm-deps-cleanup/SKILL.md, keep the manifests andbun.locktogether, and leave the Next.js and React pins alone unless the task is an upgrade. Lazy boundaries and placeholders reuse@asym/uiand followdocs/ai/rules/frontend.md.
Bundle optimizer
1. Set the scope
Analyze the whole app by default, covering all routes and shared client dependencies. Narrow the scope only when the user specifies a route, dependency, feature or other subset. Choose audit or fix mode. Audit is the default: generate analyzer artifacts and report candidates while leaving application source, dependencies and lockfiles unchanged. Fix mode requires an explicit request to change the app. Ask before changing visible behavior, timing, compatibility or a trust boundary. For a route's static App Shell, use next-cache-components-optimizer; for navigation prefetch work, use next-partial-prefetching-optimizer.
Done: the whole-app or user-specified scope, mode and intended behavior are recorded. A request to capture or export data is audit mode, not permission to fix.
2. Capture and export a baseline
Run from the app directory with its package manager. Read next analyze --help for capture options and next analyze export --help for replay options in the installed CLI. Reuse a selected saved snapshot, or capture with a distinctive name first; then export it through gzip at its default compression level. Keep before/after .jsonl.gz files separate.
Sandbox requirement: If the agent’s sandbox blocks TCP port binding (as Codex’s does), it MUST run the next analyze --output capture outside the sandbox. Do not attempt the capture inside that sandbox, even though --output does not serve the analyzer UI.
Run the pipeline in Bash:
set -o pipefail
# Capture only when a new baseline is needed
pnpm exec next analyze --output --snapshot 'audit-before-unique-1'
pnpm exec next analyze export --snapshot 'audit-before-unique-1' | gzip > /tmp/analyze-app-before.jsonl.gz
--output builds and saves binary/UI artifacts without serving. next analyze export reads a saved snapshot without building; stdout is one typed JSON record per line, with errors on stderr. Omit --route for whole-app analysis; add it for a user-specified route. The route filter keeps the whole-app module graph, so scope it in the next step.
For a custom distDir, replay with --dist-dir <configured-directory> (relative or absolute): capture loads the app config, replay does not. --snapshot <name> selects a retained name; omission selects the newest snapshot. Capture generates a unique timestamp name when omitted, and replaces an existing capture when an explicit name is reused. Use distinct before/after names, including names with spaces, to preserve both baselines. For interactive exploration, capture without --output to serve the UI; next build --analyze also produces replayable data.
Done: the chosen capture is identified, export succeeded, and the baseline file, snapshot name and analysis scope are recorded. Check the whole pipeline's exit status before processing the compressed file: pipefail prevents gzip from hiding a failed export. Export validates one route at a time, so a failure can leave a partial archive even if gzip -t
Установить next-bundle-optimizer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл next-bundle-optimizer?
Audit and reduce Next.js browser initial-load work. Use for slow route startup, oversized client bundles, duplicate browser dependencies, or features that can wait for interaction.
Как установить скилл next-bundle-optimizer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл next-bundle-optimizer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic