Skip to content

docs: add guide for optimizing the static shell - #97737

Merged
aurorascharff merged 55 commits into
canaryfrom
codex/optimize-static-shell-guide
Oct 6, 2026
Merged

aurorascharff merged 55 commits into
canaryfrom
codex/optimize-static-shell-guide

Conversation

@aurorascharff

@aurorascharff aurorascharff commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

What?

Adds an Optimizing the static shell guide that follows one team settings route through focused Suspense boundaries, deferred authentication, cache-versus-stream decisions, loading-state reuse, shared layouts, and parallel routes.

Updates next-cache-components-optimizer to use that guide and the canonical Insight pages as its framework source of truth. The original phase-based Skill workflow is preserved, including the production rig, exact test contract, trustworthy RED-to-GREEN loop, parity check, differential, and reporting. Reusable implementation guidance now links to the corresponding guide section instead of being duplicated in Skill-only references.

Clarifies that the optimizer can target either a direct page load or a named client navigation. Both use the same App Shell patterns and instant() verification loop. When the destination App Shell is already instant and the goal is to include additional URL-specific content before a click, the Skill hands off to the Partial Prefetching optimizer.

Aligns the Cache Components and Partial Prefetching optimizers around the same workflow: define the contract, reuse the production rig, prove current behavior, make the smallest optimization, verify and ship. Their framework-specific decisions remain separate. The Partial Prefetching adoption rig also receives the shared visible, committed DOM-marker rule because it uses the same instant() testing API.

Why?

The optimizer's framework patterns are useful outside the agent workflow. Keeping them in public docs gives developers and agents one source of truth while each Skill stays focused on its product decision and reliable production verification.

Eval

The corrected-contract comparison uses Claude Opus 4.8 and Claude Sonnet 4.5 with a fixed Claude Haiku 4.5 judge. It compares the baseline, bundled guide, production Skill from canary, and proposed local Skill. The bundled-guide and Skill treatments use a local Next.js tarball containing the new guide.

The eval now contains 11 granular checks so product behavior, test quality, and workflow discipline are visible independently. They cover configuration, direct and client-navigation instant() coverage, exact shell markers, preserved data sources, reusable and request-time UI placement, all completed-route variants, viewer-cookie behavior, trustworthy RED, full-suite GREEN, and the bounded differential. The prompt names the Aurora, Nebula, unknown-release, and viewer-cookie parity cases explicitly.

All eight treatments were rerun against this 11-check rubric.

Model Treatment Checks passed Overall Duration Tokens processed Total run cost Cost change
Opus 4.8 Baseline 9/11 Fail 26m 38s 4.83M $4.66 —
Opus 4.8 Bundled guide 8/11 Fail 36m 36s 4.99M $5.29 +13.5%
Opus 4.8 Production Skill 9/11 Fail 28m 20s 3.25M $3.35 -28.0%
Opus 4.8 Proposed Skill 11/11 Pass 32m 9s 5.25M $5.24 +12.5%
Sonnet 4.5 Baseline 8/11 Fail 22m 31s 2.73M $1.29 —
Sonnet 4.5 Bundled guide 8/11 Fail 17m 58s 2.38M $1.18 -8.1%
Sonnet 4.5 Production Skill 4/11 Fail 27m 18s 2.94M $1.38 +7.3%
Sonnet 4.5 Proposed Skill 4/11 Fail 25m 26s 5.49M $2.53 +96.1%

Token totals count each unique model message once and include uncached input, cache creation, cache reads, and output. Total run cost applies the current AI Gateway base rates to each token category. Judge cost is excluded.

The eight runs processed 31.87M tokens and cost $24.91 in total, excluding the judge. This is one run per model and treatment, so the comparison is descriptive rather than a stable pass-rate measurement.

The proposed Opus Skill is the only treatment to pass every check. Baseline and production Skill each passed 9/11, but both skipped the bounded differential. Baseline also missed the viewer-cookie timing lock. Production Skill omitted exact loading-state coverage. The guide-only treatment implemented the product behavior but missed an exact selector, trustworthy RED, and the differential.

The proposed Sonnet Skill preserved the exact instant() contract, but replaced the existing runtime file read with a build-time import. It then stopped using the documented production command, encountered port conflicts from starting another Playwright server lifecycle, and never completed parity, GREEN, or a valid differential. This is a model adherence failure rather than a sandbox or credential failure. It shows that the restored workflow is sufficient for Opus but still too easy for Sonnet to abandon after it encounters test friction.

Verification

  • Local Next.js build passed.
  • Prettier, TypeScript, ESLint through the commit hook, Alex, and diff checks passed.
  • Documentation link validation passed in CI.
  • All eight treatments finalized against the current 11-check rubric.

@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Stats from current PR

🔴 1 regression, 1 improvement

Metric Canary PR Change Trend
Webpack Build Time 24.492s 25.074s 🔴 +582ms (+2%) █▂█▁▁
node_modules Size 553 MB 553 MB 🟢 625 kB (0%) ▁▁▁▁▁
📊 All Metrics
📖 Metrics Glossary

Dev Server Metrics:

  • Listen = TCP port starts accepting connections
  • First Request = HTTP server returns successful response
  • Cold = Fresh build (no cache)
  • Warm = With cached build artifacts

Build Metrics:

  • Fresh = Clean build (no .next directory)
  • Cached = With existing .next directory

Change Thresholds:

  • Time: Changes < 50ms AND < 10%, OR < 2% are insignificant
  • Size: Changes < 1KB AND < 1% are insignificant
  • All other changes are flagged to catch regressions

⚡ Dev Server

Metric Canary PR Change Trend
Cold (Listen) 863ms 814ms ✓ █████
Cold (Ready in log) 829ms 821ms ✓ ▇█▆▅▅
Cold (First Request) 1.331s 1.320s ✓ ▇█▆▄▃
Warm (Listen) 864ms 816ms ✓ █████
Warm (Ready in log) 827ms 817ms ✓ ▅▆▅▃▄
Warm (First Request) 1.324s 1.317s ✓ ▅▇▆▂▃
📦 Dev Server (Webpack) (Legacy)

📦 Dev Server (Webpack)

Metric Canary PR Change Trend
Cold (Listen) 814ms 813ms ✓ █▁█▁▁
Cold (Ready in log) 807ms 808ms ✓ █▂█▁▁
Cold (First Request) 3.356s 3.380s ✓ █▁▇▁▁
Warm (Listen) 865ms 813ms ✓ █▁▇▁▁
Warm (Ready in log) 826ms 809ms ✓ █▁█▁▁
Warm (First Request) 3.461s 3.436s ✓ █▁▇▁▁

⚡ Production Builds

Metric Canary PR Change Trend
Fresh Build 6.297s 6.139s ✓ █▇▇▇▇
Cached Build 3.266s 3.260s ✓ ██▆▅▂
📦 Production Builds (Webpack) (Legacy)

📦 Production Builds (Webpack)

Metric Canary PR Change Trend
Fresh Build 24.492s 25.074s 🔴 +582ms (+2%) █▂█▁▁
Cached Build 24.659s 24.437s ✓ █▂█▁▁
node_modules Size 553 MB 553 MB 🟢 625 kB (0%) ▁▁▁▁▁
📦 Bundle Sizes

Bundle Sizes

⚡ Turbopack

Client

Main Bundles
Canary PR Change
017_4moyv5m34.js gzip 117 B 117 B ✓
05jocc85-b73_.js gzip 341 B N/A -
096twxhe86hwd.js gzip 7.53 kB N/A -
0cz1d0mv5g_q7.js gzip 39.4 kB 39.4 kB ✓
0e5lgz-xcf6ln.js gzip 273 B 273 B ✓
0enhddgqs2dl-.js gzip 265 B 265 B ✓
0h34mejwa_7pd.js gzip 354 B 354 B ✓
0w853zxni3ro0.js gzip 1.36 kB N/A -
1-j27ycnrp24e.js gzip 71.5 kB N/A -
13lq2aw3_0bgw.js gzip 3.52 kB N/A -
1elt1qium-r2m.css gzip 115 B 115 B ✓
1m5vdnlf0deiv.js gzip 411 B 411 B ✓
1nigpy_mr0xvj.js gzip 339 B N/A -
1p0l8mn2wz5f2.js gzip 1.97 kB N/A -
1s-3t9k2_uhom.js gzip 117 B N/A -
1sqoyy39jpgkq.js gzip 121 B 121 B ✓
1tf1phijqlx9j.js gzip 220 B 220 B ✓
2-54v5vj7orwp.js gzip 46.8 kB N/A -
2b05_424u1zq-.js gzip 120 B N/A -
2ca40xittx95r.js gzip 8.75 kB N/A -
2hgz42b8sldyc.js gzip 5.85 kB N/A -
2j02uk1ob2zes.js gzip 155 B N/A -
2kci0vnt-49o-.js gzip 113 B 113 B ✓
2sxgl_rcrrn_p.js gzip 399 B N/A -
2u_p__ndkooh-.js gzip 5.66 kB N/A -
2vt62i17bhbdu.js gzip 2.35 kB N/A -
342di-crrg9kq.js gzip 119 B N/A -
36hfc2_979aw2.js gzip 119 B N/A -
38wfp6jjrrdfm.js gzip 131 B 131 B ✓
3dl1ilk37-30g.js gzip 117 B N/A -
3h0us7yy7bd_o.js gzip 13.1 kB N/A -
3kvxagoobts7h.js gzip 117 B N/A -
3p99hd9vwe6ae.js gzip 13 kB N/A -
3r0475panhk6m.js gzip 123 B N/A -
3s0i-weykgzrt.js gzip 125 B N/A -
3wijk2ywqgsv9.js gzip 2.52 kB N/A -
41kebu3wv5f4d.js gzip 65.5 kB N/A -
41u5s3oe2-erp.js gzip 2.29 kB N/A -
turbopack-0d..9ejy.js gzip 3.74 kB 3.74 kB ✓
02zc7sqlpqxn3.js gzip N/A 119 B -
0e28eh3gbwmp0.js gzip N/A 3.51 kB -
0jwho9fkrb_t3.js gzip N/A 2.29 kB -
0longconn5mlm.js gzip N/A 123 B -
0p4l3ozbez2cz.js gzip N/A 2.35 kB -
0sbh_15ejop4o.js gzip N/A 13 kB -
0skdm-9rpid8g.js gzip N/A 117 B -
0wv-h56sz83wn.js gzip N/A 120 B -
137xup2t69ovc.js gzip N/A 1.97 kB -
17vvacc-4yow1.js gzip N/A 71.5 kB -
1a90tbnmyizib.js gzip N/A 153 B -
1fk10s3m1oecx.js gzip N/A 400 B -
1w_md9hqn6f4o.js gzip N/A 65.5 kB -
20qhkyyj2_tla.js gzip N/A 116 B -
25lb_468wpv8t.js gzip N/A 117 B -
2imyufe18bsb7.js gzip N/A 1.36 kB -
2mr-6hunyw7uo.js gzip N/A 7.53 kB -
2p4n3-8-xixh_.js gzip N/A 341 B -
2vqdfieehz5do.js gzip N/A 8.75 kB -
2xn85ykzw2v1e.js gzip N/A 13.1 kB -
33gdcu1dj0nl9.js gzip N/A 46.7 kB -
34knadd6wu9qg.js gzip N/A 119 B -
37-g1kp39exux.js gzip N/A 5.85 kB -
39jq2b6t6z6up.js gzip N/A 339 B -
3a9a9tvkag_-j.js gzip N/A 2.52 kB -
3hk-fj9wj-l1s.js gzip N/A 5.66 kB -
3t121tj-h0kbm.js gzip N/A 125 B -
Total 299 kB 299 kB ✅ -69 B

Server

Middleware
Canary PR Change
middleware-b..fest.js gzip 1.02 kB 1.02 kB ✓
Total 1.02 kB 1.02 kB ✓
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 846 B 845 B ✓
Total 846 B 845 B ✅ -1 B
Build Cache
Canary PR Change
00000001.sst gzip 15.9 MB 14.2 MB 🟢 1.7 MB (-11%)
00000002.sst gzip 10 MB 16.5 MB 🔴 +6.5 MB (+65%)
00000003.sst gzip 14.4 MB 11.9 MB 🟢 2.55 MB (-18%)
00000004.sst gzip 11.4 MB 12.1 MB 🔴 +683 kB (+6%)
00000005.sst gzip 13.1 MB 2.75 MB 🟢 10.3 MB (-79%)
00000006.sst gzip 2.75 MB 10 MB 🔴 +7.29 MB (+265%)
00000007.sst gzip 59 B 59 B ✓
00000008.meta gzip 89 B 89 B ✓
00000009.meta gzip 297 kB 297 kB ✓
00000010.meta gzip 297 kB 297 kB ✓
00000011.meta gzip 297 kB 297 kB ✓
00000012.sst gzip 53 kB 53.8 kB 🔴 +763 B (+1%)
00000013.sst gzip 1.71 MB 1.8 MB 🔴 +90.6 kB (+5%)
00000014.sst gzip 59 B 59 B ✓
00000015.meta gzip 116 B 116 B ✓
00000016.meta gzip 327 kB 327 kB ✓
00000017.meta gzip 402 kB 406 kB 🔴 +3.89 kB (+1%)
00000018.sst gzip 53.8 kB 54.6 kB 🔴 +820 B (+2%)
00000019.sst gzip 1.36 MB 1.39 MB 🔴 +33.7 kB (+2%)
00000020.sst gzip 59 B 59 B ✓
00000021.meta gzip 116 B 116 B ✓
00000022.meta gzip 327 kB 327 kB ✓
00000023.meta gzip 372 kB 372 kB ✓
00000024.sst gzip 53.9 kB 54.7 kB 🔴 +858 B (+2%)
00000025.sst gzip 1.36 MB 1.37 MB 🔴 +7.95 kB (+1%)
00000026.sst gzip 59 B 59 B ✓
00000027.meta gzip 116 B 116 B ✓
00000028.meta gzip 327 kB 327 kB ✓
00000029.meta gzip 372 kB 372 kB ✓
00000030.sst gzip 53.2 kB 54 kB 🔴 +861 B (+2%)
00000031.sst gzip 1.36 MB 1.37 MB 🔴 +7.9 kB (+1%)
00000032.sst gzip 59 B 59 B ✓
00000033.meta gzip 116 B 116 B ✓
00000034.meta gzip 327 kB 327 kB ✓
00000035.meta gzip 372 kB 372 kB ✓
00000036.sst gzip 53.7 kB 54.6 kB 🔴 +902 B (+2%)
00000037.sst gzip 1.36 MB 1.37 MB 🔴 +7.92 kB (+1%)
00000038.sst gzip 59 B 59 B ✓
00000039.meta gzip 116 B 116 B ✓
00000040.meta gzip 327 kB 327 kB ✓
00000041.meta gzip 372 kB 372 kB ✓
CURRENT gzip 94 B 94 B ✓
LOG gzip 681 B 678 B ✓
Total 79.4 MB 79.5 MB ⚠️ +46.5 kB

📦 Webpack

Client

Main Bundles
Canary PR Change
3322-HASH.js gzip 65.7 kB N/A -
4191.HASH.js gzip 169 B N/A -
9784-HASH.js gzip 5.57 kB N/A -
b1ad9f4c-HASH.js gzip 63.5 kB N/A -
framework-HASH.js gzip 59.7 kB 59.7 kB ✓
main-app-HASH.js gzip 253 B 254 B ✓
main-HASH.js gzip 39.8 kB 39.7 kB ✓
webpack-HASH.js gzip 1.68 kB 1.68 kB ✓
3577.HASH.js gzip N/A 168 B -
578-HASH.js gzip N/A 65.8 kB -
8590-HASH.js gzip N/A 5.53 kB -
a8984546-HASH.js gzip N/A 63.5 kB -
Total 236 kB 236 kB ⚠️ +42 B
Polyfills
Canary PR Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB ✓
Total 39.4 kB 39.4 kB ✓
Pages
Canary PR Change
_app-HASH.js gzip 194 B 193 B ✓
_error-HASH.js gzip 181 B 182 B ✓
css-HASH.js gzip 334 B 331 B ✓
dynamic-HASH.js gzip 1.81 kB 1.81 kB ✓
edge-ssr-HASH.js gzip 255 B 253 B ✓
head-HASH.js gzip 349 B 351 B ✓
hooks-HASH.js gzip 382 B 384 B ✓
image-HASH.js gzip 5.02 kB 5.01 kB ✓
index-HASH.js gzip 260 B 259 B ✓
link-HASH.js gzip 2.48 kB 2.48 kB ✓
routerDirect..HASH.js gzip 317 B 318 B ✓
script-HASH.js gzip 384 B 386 B ✓
withRouter-HASH.js gzip 316 B 315 B ✓
1afbb74e6ecf..834.css gzip 106 B 106 B ✓
Total 12.4 kB 12.4 kB ✓

Server

Edge SSR
Canary PR Change
edge-ssr.js gzip 128 kB 128 kB ✓
page.js gzip 293 kB 292 kB ✓
Total 421 kB 420 kB ✅ -1.09 kB
Middleware
Canary PR Change
middleware-b..fest.js gzip 600 B 600 B ✓
middleware-r..fest.js gzip 156 B 156 B ✓
middleware.js gzip 45.6 kB 45.2 kB ✓
edge-runtime..pack.js gzip 842 B 842 B ✓
Total 47.2 kB 46.8 kB ✅ -410 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 698 B 698 B ✓
Total 698 B 698 B ✓
Build Cache
Canary PR Change
0.pack gzip 4.8 MB 4.78 MB 🟢 18.6 kB (0%)
index.pack gzip 124 kB 123 kB ✓
index.pack.old gzip 124 kB 123 kB 🟢 1.42 kB (-1%)
Total 5.05 MB 5.03 MB ✅ -20.6 kB

🔄 Shared (bundler-independent)

Runtimes
Canary PR Change
app-page-exp...dev.js gzip 375 kB 373 kB ✓
app-page-exp..prod.js gzip 206 kB 206 kB ✓
app-page-tur...dev.js gzip 374 kB 373 kB ✓
app-page-tur..prod.js gzip 206 kB 206 kB ✓
app-page-tur...dev.js gzip 370 kB 369 kB ✓
app-page-tur..prod.js gzip 204 kB 203 kB ✓
app-page.run...dev.js gzip 371 kB 370 kB ✓
app-page.run..prod.js gzip 204 kB 203 kB ✓
app-route-ex...dev.js gzip 82.5 kB 82.5 kB ✓
app-route-ex..prod.js gzip 55.6 kB 55.6 kB ✓
app-route-tu...dev.js gzip 82.5 kB 82.5 kB ✓
app-route-tu..prod.js gzip 55.6 kB 55.6 kB ✓
app-route-tu...dev.js gzip 82.1 kB 82.1 kB ✓
app-route-tu..prod.js gzip 55.4 kB 55.4 kB ✓
app-route.ru...dev.js gzip 82.1 kB 82.1 kB ✓
app-route.ru..prod.js gzip 55.4 kB 55.4 kB ✓
dev-validati...dev.js gzip 134 kB 134 kB ✓
dev-validati...dev.js gzip 134 kB 134 kB ✓
dev-validati...dev.js gzip 132 kB 132 kB ✓
dev-validati...dev.js gzip 132 kB 132 kB ✓
dist_client_...dev.js gzip 324 B 324 B ✓
dist_client_...dev.js gzip 326 B 326 B ✓
dist_client_...dev.js gzip 318 B 318 B ✓
dist_client_...dev.js gzip 317 B 317 B ✓
pages-api-tu...dev.js gzip 46.2 kB 46.2 kB ✓
pages-api-tu..prod.js gzip 34.3 kB 34.3 kB ✓
pages-api.ru...dev.js gzip 46.2 kB 46.2 kB ✓
pages-api.ru..prod.js gzip 34.3 kB 34.2 kB ✓
pages-turbo....dev.js gzip 54.6 kB 54.6 kB ✓
pages-turbo...prod.js gzip 39.7 kB 39.6 kB ✓
pages.runtim...dev.js gzip 54.6 kB 54.6 kB ✓
pages.runtim..prod.js gzip 39.6 kB 39.6 kB ✓
server.runti..prod.js gzip 65.9 kB 65.8 kB ✓
use-cache-pr...dev.js gzip 73.3 kB 72.5 kB 🟢 764 B (-1%)
use-cache-pr...dev.js gzip 73.3 kB 72.5 kB 🟢 767 B (-1%)
use-cache-pr...dev.js gzip 71.5 kB 70.7 kB 🟢 762 B (-1%)
use-cache-pr...dev.js gzip 71.5 kB 70.7 kB 🟢 756 B (-1%)
Total 4.1 MB 4.09 MB ✅ -10.6 kB
📝 Changed Files (33 files)

Files with changes:

  • app-page-exp..ntime.dev.js
  • app-page-exp..time.prod.js
  • app-page-tur..ntime.dev.js
  • app-page-tur..time.prod.js
  • app-page-tur..ntime.dev.js
  • app-page-tur..time.prod.js
  • app-page.runtime.dev.js
  • app-page.runtime.prod.js
  • app-route-ex..ntime.dev.js
  • app-route-ex..time.prod.js
  • app-route-tu..ntime.dev.js
  • app-route-tu..time.prod.js
  • app-route-tu..ntime.dev.js
  • app-route-tu..time.prod.js
  • app-route.runtime.dev.js
  • app-route.ru..time.prod.js
  • dev-validati..ntime.dev.js
  • dev-validati..ntime.dev.js
  • dev-validati..ntime.dev.js
  • dev-validati..ntime.dev.js
  • ... and 13 more
View diffs
app-page-exp..ntime.dev.js
failed to diff
app-page-exp..time.prod.js

Diff too large to display

app-page-tur..ntime.dev.js
failed to diff
app-page-tur..time.prod.js

Diff too large to display

app-page-tur..ntime.dev.js
failed to diff
app-page-tur..time.prod.js

Diff too large to display

app-page.runtime.dev.js
failed to diff
app-page.runtime.prod.js

Diff too large to display

app-route-ex..ntime.dev.js

Diff too large to display

app-route-ex..time.prod.js

Diff too large to display

app-route-tu..ntime.dev.js

Diff too large to display

app-route-tu..time.prod.js

Diff too large to display

app-route-tu..ntime.dev.js

Diff too large to display

app-route-tu..time.prod.js

Diff too large to display

app-route.runtime.dev.js

Diff too large to display

app-route.ru..time.prod.js

Diff too large to display

dev-validati..ntime.dev.js
failed to diff
dev-validati..ntime.dev.js
failed to diff
dev-validati..ntime.dev.js
failed to diff
dev-validati..ntime.dev.js
failed to diff
pages-api-tu..ntime.dev.js

Diff too large to display

pages-api-tu..time.prod.js

Diff too large to display

pages-api.runtime.dev.js

Diff too large to display

pages-api.ru..time.prod.js

Diff too large to display

pages-turbo...ntime.dev.js

Diff too large to display

pages-turbo...time.prod.js

Diff too large to display

pages.runtime.dev.js

Diff too large to display

pages.runtime.prod.js

Diff too large to display

server.runtime.prod.js

Diff too large to display

use-cache-pr..ntime.dev.js

Diff too large to display

use-cache-pr..ntime.dev.js

Diff too large to display

use-cache-pr..ntime.dev.js

Diff too large to display

use-cache-pr..ntime.dev.js

Diff too large to display

📎 Tarball URL
https://vercel-packages.vercel.app/next/commits/c5854eb3ec3e4f1dfece8da10c0227989124309f/next

Commit: c5854eb

@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 5842cd1

@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

All broken links are now fixed, thank you!

Comment thread docs/01-app/02-guides/optimizing-the-static-shell.mdx Outdated
aurorascharff added a commit that referenced this pull request Aug 27, 2026
## What

Adds an agent eval for the static-shell optimization workflow in #97737.
The fixture uses a release-operations route with a request-specific
viewer, reusable checklist, live rollout data, and both direct and
client navigation.

## Why

This tests whether agents can transfer the guide and optimizer skill to
a difficult refactor that is similar to, but not copied from, the guide
example.

## Verification

- Claude Sonnet 4.6: baseline 2/7, bundled docs 2/7, optimizer skill 6/7
- The skill treatment passed every final-code criterion; its only miss
was executing the browser RED-to-GREEN loop because the sandbox lacked
Chromium libraries
- Browser-dependent fixtures now provision those libraries during setup;
a follow-up attempt passed setup but stalled before producing a
transcript
@aurorascharff
aurorascharff changed the base branch from canary to codex/adoption-skill-evals August 27, 2026 17:06
Base automatically changed from codex/adoption-skill-evals to canary August 31, 2026 18:52
Comment thread evals/eval.config.json
aurorascharff added a commit that referenced this pull request Sep 8, 2026
Adds an agent eval for the static-shell optimization workflow in #97737.
The fixture uses a release-operations route with a request-specific
viewer, reusable checklist, live rollout data, and both direct and
client navigation.

This tests whether agents can transfer the guide and optimizer skill to
a difficult refactor that is similar to, but not copied from, the guide
example.

- Claude Sonnet 4.6: baseline 2/7, bundled docs 2/7, optimizer skill 6/7
- The skill treatment passed every final-code criterion; its only miss
was executing the browser RED-to-GREEN loop because the sandbox lacked
Chromium libraries
- Browser-dependent fixtures now provision those libraries during setup;
a follow-up attempt passed setup but stalled before producing a
transcript
@aurorascharff
aurorascharff force-pushed the codex/optimize-static-shell-guide branch from a2a4dca to 2d3e336 Compare September 8, 2026 21:08
aurorascharff added a commit that referenced this pull request Sep 10, 2026
Adds an agent eval for the static-shell optimization workflow in #97737.
The fixture uses a release-operations route with a request-specific
viewer, reusable checklist, live rollout data, and both direct and
client navigation.

This tests whether agents can transfer the guide and optimizer skill to
a difficult refactor that is similar to, but not copied from, the guide
example.

- Claude Sonnet 4.6: baseline 2/7, bundled docs 2/7, optimizer skill 6/7
- The skill treatment passed every final-code criterion; its only miss
was executing the browser RED-to-GREEN loop because the sandbox lacked
Chromium libraries
- Browser-dependent fixtures now provision those libraries during setup;
a follow-up attempt passed setup but stalled before producing a
transcript
@aurorascharff
aurorascharff force-pushed the codex/optimize-static-shell-guide branch from 8ee42d4 to b1698b2 Compare September 10, 2026 09:20
aurorascharff added a commit that referenced this pull request Sep 10, 2026
Adds an agent eval for the static-shell optimization workflow in #97737.
The fixture uses a release-operations route with a request-specific
viewer, reusable checklist, live rollout data, and both direct and
client navigation.

This tests whether agents can transfer the guide and optimizer skill to
a difficult refactor that is similar to, but not copied from, the guide
example.

- Claude Sonnet 4.6: baseline 2/7, bundled docs 2/7, optimizer skill 6/7
- The skill treatment passed every final-code criterion; its only miss
was executing the browser RED-to-GREEN loop because the sandbox lacked
Chromium libraries
- Browser-dependent fixtures now provision those libraries during setup;
a follow-up attempt passed setup but stalled before producing a
transcript
@aurorascharff
aurorascharff force-pushed the codex/optimize-static-shell-guide branch from e81343d to 06887cd Compare September 10, 2026 13:34
@aurorascharff
aurorascharff changed the base branch from canary to codex/partial-prefetching-optimizer September 10, 2026 13:34
aurorascharff added a commit that referenced this pull request Sep 10, 2026
## Summary

- add a Partial Prefetching optimizer Skill for selected source Links
and destinations
- keep prefetch stages and Link policy in the public [Optimizing
prefetching
guide](https://nextjs.org/docs/app/guides/optimizing-prefetching), and
rely on the same static-shell documentation as the Cache Components
optimizer for cache placement, Suspense, loading UI, and authorization
- keep the Skill focused on the product decision, production `instant()`
loop, differential verification, and mutation freshness when an
optimization adds a cache around mutable data
- reference the canonical
[`unstable_prefetch()`](https://nextjs.org/docs/app/api-reference/functions/prefetch)
and
[`unstable_navigation()`](https://nextjs.org/docs/app/api-reference/functions/navigation)
docs instead of explaining the APIs again in the Skill
- link cache-writing optimizations to the canonical
[Revalidating](https://nextjs.org/docs/app/getting-started/caching-and-revalidating#revalidating)
documentation and verify a populated-cache mutation in the Skill and
eval
- bundle a self-contained production rig aligned with the related
adoption and optimizer Skills, tuned to record each source-link and
prefetch-stage contract
- add an eval that compares baseline, the bundled guide, and the local
Skill against the same prefetched-UI and cache-freshness goal
- document the optimizer in the AI agents guide

This follows the same guide/Skill split as #97737. Partial Prefetching
adoption preserves existing behavior; this optimizer is the later
decision about what is worth preparing before a click and what should
wait for navigation.

Related: #97712, #97737, #97759, #98122, #98175

## Eval

One run per treatment with Claude Opus 4.8 and Claude Sonnet 4.5, using
a fixed Claude Haiku 4.5 judge. The bundled-guide and Skill treatments
use a local Next.js tarball containing the new guide and API references.

| Model | Treatment | Criteria | Score change | Overall | Duration |
Tokens processed | Total run cost | Cost change |
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| Opus 4.8 | Baseline | 10/10 (100%) | — | Pass | 18m 42s | 3.39M |
$3.46 | — |
| Opus 4.8 | Bundled guide | 9/10 (90%) | -10 pp | Fail | 13m 37s |
3.02M | $2.84 | -18.0% |
| Opus 4.8 | Local Skill | 10/10 (100%) | +10 pp | Pass | 17m 22s |
2.80M | $2.54 | -10.6% |
| Sonnet 4.5 | Baseline | 2/10 (20%) | — | Fail | 15m 55s | 1.97M |
$1.06 | — |
| Sonnet 4.5 | Bundled guide | 5/10 (50%) | +30 pp | Fail | 15m 49s |
2.17M | $1.11 | +4.5% |
| Sonnet 4.5 | Local Skill | 8/10 (80%) | +30 pp | Fail | 15m 31s |
1.41M | $0.77 | -30.4% |

Token totals count each unique model message once and include uncached
input, cache creation, cache reads, and output. Cache reads account for
most of the total in every treatment. Total run cost applies the current
AI Gateway base rates to each token category: Opus 4.8 costs $5/M input,
$6.25/M cache writes, $0.50/M cache reads, and $25/M output; Sonnet 4.5
costs $3/M input, $3.75/M cache writes, $0.30/M cache reads, and $15/M
output. The six agent runs cost $11.78 in total.

Compared with baseline, the Opus Skill run maintained a 100% criteria
pass rate while reducing cost by 26.7%. The Sonnet Skill run improved
the criteria pass rate from 20% to 80%, a 60 percentage-point increase,
while reducing cost by 27.3%.

The stronger model could solve the fixture without the Skill, although
it independently searched the bundled Next.js documentation and took
slightly longer than the Skill treatment. The Opus guide-only run
implemented the correct behavior but missed the required
RED-before-GREEN proof.

The Sonnet treatments show a clearer progression. Baseline did not
implement the required caching, navigation stage, `instant()` contract,
or cache invalidation. The bundled guide added the cached summary and
production test, but missed the navigation stage, deferred-state
assertions, tag invalidation, and RED-before-GREEN proof. The Skill
treatment completed the `instant()` RED-to-GREEN loop and final
production behavior, but left `connection()` in the related-sessions
read and used path revalidation instead of tagging the cached read. It
therefore passed 8 of 10 criteria but failed the overall eval.

All six measured runs completed through grading. Chromium and its system
dependencies are provisioned before the agent starts, so missing browser
libraries did not determine these results.

## Verification

- `pnpm --filter=next build`
- `pnpm prettier --check` for the changed guide, prompt, Skill, and eval
fixture
- `pnpm exec tsc -p
evals/evals/agent-051-optimize-partial-prefetching/tsconfig.json
--noEmit`
- `node --check run-evals.js`
- `git diff --check`
- packed a local Next.js tarball and confirmed it contains the optimizer
guide plus the `navigation()` and `prefetch()` references
- verified the `navigation()` contract in the minimal reproduction and
NextBeats on Next.js 16.4.0-canary.22
- merged the latest `canary`, preserving both generic fixture setup and
Playwright provisioning

<!-- NEXT_JS_LLM -->
Base automatically changed from codex/partial-prefetching-optimizer to canary September 10, 2026 20:27
@aurorascharff
aurorascharff marked this pull request as ready for review September 10, 2026 20:29
@aurorascharff
aurorascharff marked this pull request as ready for review September 11, 2026 14:02
Comment thread docs/01-app/02-guides/optimizing-the-static-shell.mdx
Comment thread docs/01-app/02-guides/optimizing-the-static-shell.mdx Outdated
Copilot AI lite review requested due to automatic review settings September 28, 2026 10:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved moderate findings remain in the Playwright lifecycle guidance and evaluation coverage.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds an “Optimizing the static shell” guide, aligns related optimizer Skills and verification workflows, and introduces a production evaluation fixture.

Changes:

  • Adds static-shell optimization patterns and cross-links.
  • Strengthens instant() testing and marker guidance.
  • Adds and registers the static-shell evaluation fixture.
File Description
skills/​next-partial-prefetching-optimizer/​reference/​red-test-robustness.md Strengthens committed-marker guidance.
skills/​next-partial-prefetching-adoption/​rig-template.md Adds visible DOM-marker requirements.
skills/​next-cache-components-optimizer/​test-template.md Clarifies focused tests and initial-load behavior.
skills/​next-cache-components-optimizer/​SKILL.md Delegates framework patterns to the new guide.
skills/​next-cache-components-optimizer/​rig-template.md Refines Playwright lifecycle guidance.
skills/​next-cache-components-optimizer/​reference/​red-test-robustness.md Expands RED validation checks.
skills/​next-cache-components-optimizer/​reference/​real-app-patterns.md Removes duplicated framework patterns.
skills/​next-cache-components-optimizer/​reference/​patterns.md Removes duplicated framework patterns.
evals/​README.md Documents browser-dependent eval setup.
evals/​evals/​agent-050-optimize-static-shell/​tsconfig.json Adds eval TypeScript configuration.
evals/​evals/​agent-050-optimize-static-shell/​tests/​helpers.ts Adds eval URL helpers.
evals/​evals/​agent-050-optimize-static-shell/​PROMPT.md Defines the static-shell optimization task.
evals/​evals/​agent-050-optimize-static-shell/​playwright.config.ts Configures the production Playwright rig.
evals/​evals/​agent-050-optimize-static-shell/​package.json Defines fixture dependencies and scripts.
evals/​evals/​agent-050-optimize-static-shell/​next.config.ts Enables Cache Components and test API exposure.
evals/​evals/​agent-050-optimize-static-shell/​next-env.d.ts Adds Next.js type references.
evals/​evals/​agent-050-optimize-static-shell/​lib/​releases.ts Provides fixture data sources.
evals/​evals/​agent-050-optimize-static-shell/​instant-nav.rig.md Documents the production test contract.
evals/​evals/​agent-050-optimize-static-shell/​EVAL.ts Defines evaluation checks.
evals/​evals/​agent-050-optimize-static-shell/​data/​launch-checklist.json Supplies reusable checklist data.
evals/​evals/​agent-050-optimize-static-shell/​app/​releases/​[release]/​viewer-controls.tsx Defines viewer UI and skeleton.
evals/​evals/​agent-050-optimize-static-shell/​app/​releases/​[release]/​release-panels.tsx Defines checklist and rollout panels.
evals/​evals/​agent-050-optimize-static-shell/​app/​releases/​[release]/​page.tsx Defines the release route.
evals/​evals/​agent-050-optimize-static-shell/​app/​releases/​[release]/​layout.tsx Defines the release layout.
evals/​evals/​agent-050-optimize-static-shell/​app/​page.tsx Adds the navigation source page.
evals/​evals/​agent-050-optimize-static-shell/​app/​layout.tsx Adds the fixture root layout.
evals/​eval.config.json Registers the new eval fixture.
docs/​01-app/​02-guides/​streaming.mdx Links to the new guide.
docs/​01-app/​02-guides/​optimizing-the-static-shell.mdx Adds the static-shell guide.
docs/​01-app/​02-guides/​optimizing-prefetching.mdx Adds optimizer guidance.
docs/​01-app/​02-guides/​migrating-to-cache-components.mdx Links the new guide and canonical Skill.
docs/​01-app/​02-guides/​instant-navigation.mdx Updates static-shell guidance.
docs/​01-app/​02-guides/​ai-agents.mdx Updates optimizer Skill documentation.
docs/​01-app/​02-guides/​adopting-partial-prefetching.mdx Links the canonical adoption Skill.
docs/​01-app/​01-getting-started/​08-caching.mdx Links the new workflow guide.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread skills/next-cache-components-optimizer/rig-template.md Outdated
Comment thread evals/README.md Outdated
@aurorascharff
aurorascharff enabled auto-merge (squash) October 6, 2026 11:52
@aurorascharff
aurorascharff merged commit 7c16cc9 into canary Oct 6, 2026
56 checks passed
@aurorascharff
aurorascharff deleted the codex/optimize-static-shell-guide branch October 6, 2026 11:54
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants