material-ui-nextjs — Next.js skill: MUI, SSR, and router setup
A skill for wiring Material UI into Next.js: SSR, Emotion cache, next/font, CSS layers, Link, and useSearchParams. Use it when setting up or debugging MUI in a Next.js app.
npx skills add mui/material-ui --skill material-ui-nextjs -a claude-codeWhat material-ui-nextjs does
The skill covers the places where Material UI and Next.js disagree: styles landing in body instead of head, CSS order problems, next/font clashing with ThemeProvider, Button with component={Link} hitting the Next.js v16 client boundary. SKILL.md is the entry point, AGENTS.md holds the full guide.
For App Router it walks through AppRouterCacheProvider with @emotion/cache and options, plus useSearchParams wrapped in <Suspense>. Pages Router gets _document, _app, DocumentHeadTags, and AppCacheProvider. Theme CSS variables and their SSR behaviour are documented too.
There is a dedicated section for enableCssLayer when MUI shares a page with Tailwind or CSS Modules. A reference.md lists import paths and the provider shape. If your own styles keep losing to MUI, start there.
What it helps with
- Fix MUI styles injected into body instead of head
- Set up Emotion cache for App Router
- Make next/font work with ThemeProvider
- Resolve the Next.js v16 client boundary error with Button and Link
- Wrap useSearchParams in Suspense for URL-driven MUI views
Example prompts for the agent
- Set up Material UI in my Next.js App Router project
- MUI styles are in body instead of head, how do I fix that?
- Enable CSS layers so MUI stops fighting Tailwind
How to install material-ui-nextjs
1Skills CLI (Vercel)
npx skills add mui/material-ui --skill material-ui-nextjs -a claude-code2Manually: put the files in place
~/.claude/skills/material-ui-nextjs/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/material-ui-nextjs/
1Skills CLI (Vercel)
npx skills add mui/material-ui --skill material-ui-nextjs -a codex2Manually: put the files in place
.agents/skills/material-ui-nextjs/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add mui/material-ui --skill material-ui-nextjs -a cursor2Manually: put the files in place
.cursor/skills/material-ui-nextjs/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install mui/material-ui material-ui-nextjs2Manually: put the files in place
.github/skills/material-ui-nextjs/SKILL.md1Skills CLI (Vercel)
npx skills add mui/material-ui --skill material-ui-nextjs -a gemini-cli2Platform CLI
gemini skills install https://github.com/mui/material-ui --path skills/material-ui-nextjsManually: put the files in place
.devin/skills/material-ui-nextjs/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add mui/material-ui --skill material-ui-nextjs -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set4
The whole set →Similar
Questions about material-ui-nextjs
How do I install material-ui-nextjs in Claude Code?
Run npx skills add mui/material-ui --skill material-ui-nextjs -a claude-code. The skill lands in ~/.claude/skills/material-ui-nextjs/SKILL.md.
What does material-ui-nextjs do?
It sets up Material UI in Next.js: Emotion cache for SSR, providers for App and Pages Router, next/font, CSS layers with Tailwind, the Link component pattern, and Suspense around useSearchParams.
Why would I need enableCssLayer?
When MUI sits next to Tailwind or CSS Modules, layer order decides which styles win. The skill explains how to turn on CSS layers so MUI does not override your layout and does not disappear itself.
Source text
SKILL.md · MIT
---
name: material-ui-nextjs
description: Integrates Material UI with Next.js App and Pages routers using @mui/material-nextjs, Emotion cache providers, next/font, CSS layers with Tailwind/CSS Modules, Link component prop patterns, CSS theme variables SSR notes, and App Router useSearchParams + Suspense. Use when setting up or debugging MUI in a Next.js app.
license: MIT
metadata:
author: mui
version: '1.0.0'
---
# Material UI and Next.js
Agent skill for Next.js + Material UI wiring (SSR/streaming, cache providers, fonts, layers, Link, App Router URL state). SKILL.md is the entry; AGENTS.md is the full guide.
## When to apply
- New App Router or Pages Router app using `@mui/material`
- Styles missing, wrong order, or in `body` instead of `head`
- `next/font` + `ThemeProvider` / `createTheme`
- Tailwind or CSS Modules + MUI (`enableCssLayer`)
- `Button` + `component={Link}` or Next.js v16 client boundary errors
- `useSearchParams` / URL-driven MUI views and Suspense boundaries
## Sections in AGENTS.md
| Area | Topics |
| :------------ | :-------------------------------------------------------------------------------------- |
| App Router | `AppRouterCacheProvider`, `@emotion/cache`, `options`, `useSearchParams` + `<Suspense>` |
| Pages Router | `_document`, `_app`, `DocumentHeadTags`, `AppCacheProvider` |
| Fonts | `'use client'` theme, `next/font`, CSS variables on `html` |
| CSS variables | `cssVariables`, SSR flicker docs |
| CSS layers | `enableCssLayer`, Tailwind / other CSS |
| Link | Client wrapper, routing guide, examples repo |
## Full guide
Read [AGENTS.md](./AGENTS.md) for complete steps and doc links.
[reference.md](./reference.md) lists import paths and provider shape.
© mui · MIT · mui/material-ui