netlify-frameworks-nextjs

Instructions for deploying Next.js websites on Netlify. Next.js is a web framework, and Netlify uses its Next.js Runtime to configure builds and server features automatically.

In plain words
What is it for?
Use it to check project requirements, configure the build settings, and deploy Next.js 13.5 or newer applications on Netlify.
Why use it?
It clarifies which Next.js versions are supported and prevents unnecessary adapter setup or deployment configuration mistakes.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/netlify/context-and-tools/netlify-frameworks-nextjs
Clone the repo
git clone --depth 1 https://github.com/netlify/context-and-tools
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 950 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00015 $0.00950
Opus 5 $0.00008 $0.00475
Sonnet 5 $0.00003 $0.00190
Haiku 4.5 $0.00002 $0.00095

Measured 2d ago against content hash e6012973d62e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

netlify-frameworks-nextjs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cursor/rules/netlify-frameworks-nextjs.mdc · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Next.js on Netlify

Setup

Check current versions before pinning. Knowledge cutoffs lag behind npm, and guessing a version tends to fail (npm install rejects it, or worse, installs something incompatible). Before pinning next or any other package in package.json, run npm view <pkg> version to get the current latest. Or omit explicit pins and let npm install pick them up. If that check itself fails (no network, registry unreachable), still don't fall back to a guessed exact pin — install without a version (or with @latest) and tell the user live verification wasn't possible so they should confirm the installed versions. Never present an unverified x.y.z as the current release.

Next.js on Netlify uses the @netlify/plugin-nextjs runtime, which is installed automatically. No manual adapter installation is required — Netlify detects Next.js and configures the build automatically.

The current Next.js Runtime (v5) supports Next.js 13.5 and later. A project on an older Next.js version cannot use it — upgrade Next.js to at least 13.5 before deploying.

# netlify.toml
[build]
command = "next build"
publish = ".next"

What the Runtime Does

  • Converts Next.js server-side features (SSR, API routes, middleware, ISR) into Netlify Functions and Edge Functions
  • Handles image optimization via Netlify Image CDN
  • Maps Next.js routing to Netlify's infrastructure
  • Supports App Router and Pages Router

Key Configuration

next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      { protocol: "https", hostname: "example.com" },
    ],
  },
};

module.exports = nextConfig;

Remote image patterns in next.config.js are automatically mapped to Netlify Image CDN's remote_images configuration.

Skew protection

Opt-in. Set NETLIFY_NEXT_SKEW_PROTECTION to true, then redeploy — env values are injected at build time, so the live deploy is unchanged until a new build runs.

Read the full file on GitHub · 119 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 119 lines · 15 tokens per session scan A e6012973d62e

Subscribe to this mod's changes

netlify-frameworks-nextjs is a cursor rule published in the GitHub repository netlify/context-and-tools (36 stars, last pushed 6d ago), licensed MIT. It adds 15 tokens to every session and 950 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.