prerender

Pre-render Rango route segments into Flight payloads at build time.

Updated Nov 7, 2025
One-click install
npx skills add https://github.com/rangojs/rango --skill prerender-rangojs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prerender
Source: https://github.com/rangojs/rango/tree/main/packages/rangojs-router/skills/prerender
Command: npx skills add https://github.com/rangojs/rango --skill prerender-rangojs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @rangojs/router.

What problem does it solve? Routes whose content is mostly static still execute handler code on every request, slowing cold responses and wasting compute. This Skill pre-renders route segments at build time into serialized Flight payloads so the worker serves pre-computed output instead of re-running handlers. ## Core Features & Use Cases - Prerender API: Pre-render static routes or dynamic routes with a getParams function that enumerates which param sets to bake at build time, with configurable concurrency. - Passthrough live fallback: Wrap a Prerender definition with Passthrough() so unknown or skipped params are rendered live at request time, keeping revalidate() and runtime bindings like ctx.env.DB available. - Skip and error control: Throw Skip to exclude individual entries, return ctx.passthrough() for per-param live fallback, and configure prerender.onError to fail or warn on build errors. - Use Case: A blog with hundreds of markdown posts pre-renders each slug at build time from node:fs, while a Passthrough live handler serves newly published posts that were not part of the build. ## Quick Start Pre-render my /blog/:slug route at build time using Prerender with a getParams function that lists all markdown files, and add a Passthrough live handler for unknown slugs.

Frequently Asked Questions about prerender

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I pre-render a dynamic route at build time in Rango?

Use Prerender with two functions: a getParams function returning the param objects to pre-render, and a handler that receives BuildContext at build time. Register the route with path() and a required name option.

What is the difference between Prerender and Passthrough in Rango?

Plain Prerender serves only pre-rendered params and evicts the handler from the production bundle. Passthrough wraps a Prerender definition with a live handler so unknown params render at request time, and revalidate() and loading() remain available.

Do loaders run at build time on pre-rendered routes?

No. Loaders on pre-rendered routes always run live at request time and are bundled normally. Use the cache() DSL on loaders if you need caching, and avoid build-only APIs like node:fs inside loaders.

How do I skip specific params during pre-rendering?

Throw new Skip("reason") inside the Prerender handler to exclude that entry without failing the build, or return ctx.passthrough() on a Passthrough route to defer that param to the live handler at runtime.

Why does revalidate() not work on my pre-rendered route?

revalidate() is not allowed on plain Prerender routes because the handler is evicted from the production bundle, leaving nothing to re-render. Wrap the definition with Passthrough() so the live handler can re-render on revalidation.

When should I use Prerender instead of runtime caching with cache()?

Use Prerender when page content is mostly static and known at build time, since it fills the same segment cache during the build. Use cache() with TTL or SWR when data must refresh at runtime without a redeploy.