$npx -y skills add vercel-labs/dev3000 --skill analyze-bundleanalyze-bundle is an agent skill published from vercel-labs/dev3000, installable through the skills CLI.
| 1 | # analyze-to-ndjson |
| 2 | |
| 3 | Converts Next.js bundle analyzer binary `.data` files into grep/jq-friendly NDJSON. |
| 4 | |
| 5 | ## Analyze artifacts |
| 6 | |
| 7 | This workflow pre-generates analyzer artifacts in: |
| 8 | |
| 9 | - `.next/diagnostics/analyze/ndjson/routes.ndjson` |
| 10 | - `.next/diagnostics/analyze/ndjson/sources.ndjson` |
| 11 | - `.next/diagnostics/analyze/ndjson/output_files.ndjson` |
| 12 | - `.next/diagnostics/analyze/ndjson/module_edges.ndjson` |
| 13 | - `.next/diagnostics/analyze/ndjson/modules.ndjson` |
| 14 | |
| 15 | Focus on reading these files and using their evidence to prioritize changes. |
| 16 | |
| 17 | ## Output files |
| 18 | |
| 19 | | File | What's in it | |
| 20 | |---|---| |
| 21 | | `modules.ndjson` | Global module registry (`id`, `ident`, `path`) | |
| 22 | | `module_edges.ndjson` | Module dependency graph (`from`, `to`, `kind`: sync/async) | |
| 23 | | `sources.ndjson` | Per-route source tree with sizes and environment flags | |
| 24 | | `chunk_parts.ndjson` | Granular size data: one line per (source, output_file) pair | |
| 25 | | `output_files.ndjson` | Per-route output files with aggregated sizes | |
| 26 | | `routes.ndjson` | Route-level summaries | |
| 27 | |
| 28 | ## Browsing the output |
| 29 | |
| 30 | ### Route overview |
| 31 | |
| 32 | ```bash |
| 33 | jq -s 'sort_by(-.total_compressed_size)' .next/diagnostics/analyze/ndjson/routes.ndjson |
| 34 | ``` |
| 35 | |
| 36 | ### Find large sources |
| 37 | |
| 38 | ```bash |
| 39 | jq -s ' |
| 40 | group_by(.full_path) |
| 41 | | map(max_by(.compressed_size)) |
| 42 | | sort_by(-.compressed_size) |
| 43 | | .[0:10] |
| 44 | | .[] | {full_path, compressed_size, size, route} |
| 45 | ' .next/diagnostics/analyze/ndjson/sources.ndjson |
| 46 | ``` |
| 47 | |
| 48 | ### Client-side JS |
| 49 | |
| 50 | ```bash |
| 51 | grep '"client":true' .next/diagnostics/analyze/ndjson/sources.ndjson \ |
| 52 | | grep '"js":true' \ |
| 53 | | jq -s 'sort_by(-.compressed_size) | .[0:10] | .[] | {full_path, compressed_size}' |
| 54 | ``` |
| 55 | |
| 56 | ### Module dependencies |
| 57 | |
| 58 | ```bash |
| 59 | grep '"from":42,' .next/diagnostics/analyze/ndjson/module_edges.ndjson | jq .to |
| 60 | grep '"to":42,' .next/diagnostics/analyze/ndjson/module_edges.ndjson | jq .from |
| 61 | grep 'react-dom' .next/diagnostics/analyze/ndjson/modules.ndjson | jq '{id, path}' |
| 62 | ``` |
| 63 | |
| 64 | ### Output files for a route |
| 65 | |
| 66 | ```bash |
| 67 | grep '"route":"/"' .next/diagnostics/analyze/ndjson/output_files.ndjson \ |
| 68 | | jq -s 'sort_by(-.total_compressed_size) | .[0:10] | .[] | {filename, total_compressed_size, num_parts}' |
| 69 | ``` |
| 70 | |
| 71 | ### Directory tree for a route |
| 72 | |
| 73 | ```bash |
| 74 | grep '"route":"/"' .next/diagnostics/analyze/ndjson/sources.ndjson \ |
| 75 | | jq 'select(.parent_id == null)' |
| 76 | ``` |