Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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/donor and apps/missionary, which build with Turbopack. next analyze works only with Turbopack, so it does not apply to apps/factory-console, which builds with next build --webpack.
  • Bun, not pnpm. From the app directory run bunx next analyze --output --snapshot <name> and bunx next analyze export --snapshot <name>, resolve the schema with node -p "require.resolve('next/analyze/graph-v1.schema.json')", and inspect the dependency graph with bun why <package>. Check --help for the installed options. These capture commands are unexercised in Core: they were checked only against --help and 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.gz files 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.md runs the scripts/run-with-ci-env.mjs wrapper from the repository root for builds; it has not been tried with next 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 and bun.lock together, and leave the Next.js and React pins alone unless the task is an upgrade. Lazy boundaries and placeholders reuse @asym/ui and follow docs/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

Полный SKILL.md на GitHub

Установить next-bundle-optimizer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/UPSTREAM-license.mdreferences/fix-patterns.mdreferences/graph-methods.mdreferences/upstream.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить next-bundle-optimizer с