
Router Act
Test prefetch and navigation responses with createRouterAct and LinkAccordion, without flaky timers or request-count coupling.
- skills.sh installs
- 549
- GitHub stars
- 143.6K
- last updated
- May 16, 2026
What it does
- Covers the
actAPI config options,includesmatching, App Shell request handling, and the internal intercept-and-buffer flow - Includes the
LinkAccordionpattern that controls when<Link>components enter the DOM and trigger prefetches - Enforces
'no-requests'as the preferred assertion and discourages retry loops, polling timers, and theblockfeature - Designed for end-to-end tests that control internal Next.js requests or assert on their responses
Install
$ npx -y skills add vercel/next.js --skill router-act -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Router Act Testing
Use this skill when writing or modifying tests that involve prefetch requests, client router navigations, or the segment cache. The createRouterAct utility from test/lib/router-act.ts lets you assert on prefetch and navigation responses in an end-to-end way without coupling to the exact number of requests or the protocol details. This is why most client router-related tests use this pattern.
When NOT to Use act
Don't bother with act if you don't need to instrument the network responses — either to control their timing or to assert on what's included in them. If all you're doing is waiting for some part of the UI to appear after a navigation, regular Playwright helpers like browser.elementById(), browser.elementByCss(), and browser.waitForElementByCss() are sufficient.
Core Principles
Details
- Repository
- github.com/vercel/next.js
- Categories
- Testing & QA, Frontend & UI Code
- First seen
- May 16, 2026
More from vercel/next.js
All 14Similar to Router Act
More Testing & QA
next-cache-components-adoptionvercel/next.js28K installsTurn on Cache Components in a Next.js app and walk its blocking routes to a passing build.
next-cache-components-optimizervercel/next.js21.5K installsOptimize a Next.js route's first paint and client navigation by growing its static shell under Cache Components.
nextjs-advanced-routingwsimmonds/claude-nextjs-skills336 installsGuide to advanced App Router patterns: Route Handlers, parallel and intercepting routes, Server Actions, and Suspense streaming.
react-router-data-moderemix-run/agent-skills931 installsReference-driven React Router data mode guide covering loaders, actions, fetchers, and optimistic UI without the Vite plugin.