Mmcp.market

nextjs-shadcn skill

by laguagu·laguagu/claude-code-nextjs-skills·67 stars·MIT

Creates Next.js frontends with shadcn/ui. Use when building React UIs, components, pages, or applications with shadcn, Tailwind, or modern frontend patterns. Also use when the user asks to create a new Next.js project, add UI components, style pages, or build any web interface — even if they don't mention shadcn explicitly.

A100/100content scan

Is the nextjs-shadcn skill safe?

Clean: nothing in its files matched our rules. We read 6 files in the folder on 2026-09-28.

No findings.

Install the nextjs-shadcn skill

A skill is a folder. Copy it into your agent's skills folder and the agent loads it when the task matches its description.

git clone --depth 1 https://github.com/laguagu/claude-code-nextjs-skills.git /tmp/claude-code-nextjs-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-code-nextjs-skills/skills/nextjs-shadcn ~/.claude/skills/nextjs-shadcn
available in every project

In the Claude apps, zip the folder and upload it from the Skills settings. The folder on GitHub

The instructions your agent would load

SKILL.md as published, without the frontmatter. Read it on GitHub

Next.js + shadcn/ui

Build distinctive, production-grade interfaces that avoid generic "AI slop" aesthetics.

Core Principles

  1. Minimize noise - Icons communicate; excessive labels don't
  2. No generic AI-UI - Avoid purple gradients, excessive shadows, predictable layouts
  3. Context over decoration - Every element serves a purpose
  4. Theme consistency - Use CSS variables from globals.css, never hardcode colors

Those four are the summary, not the method. Load frontend-design before the first component of a new view, not after the result already looks generic: typography, palette and the one element the page spends its boldness on are create-time decisions, and retrofitting them costs more than making them.

Then check the built view in a browser rather than from a screenshot — read tap target sizes, contrast and overflow out of the DOM, because a screenshot cannot tell you a computed style and may not even have rendered.

Quick Start

bunx --bun shadcn@latest init --template next --base base

--base selects the primitive library: base (Base UI, the default since July 2026), radix (projects already on Radix — still fully supported, not deprecated), or aria (React Aria). The same component has different props per base — Base UI composes with render={} where Radix uses asChild — and the docs are base-scoped (/docs/components/base/sidebar vs /docs/components/radix/sidebar).

For a custom design system, generate a preset code in shadcn/create and apply it:

bunx --bun shadcn@latest init --preset <CODE> --template next

Before touching an existing project

bunx --bun shadcn@latest info --json      # base, framework, aliases, installed components
bunx --bun shadcn@latest docs <component> # API reference resolved to THIS project's base

Run these instead of writing component code from memory. See references/shadcn-platform.md for the full CLI surface, typeset, and the shimmer/scroll-fade utilities.

Component Rules

Put shared navigation/layout chrome in layouts; keep route-specific content in pages. A route group named (protected) does not enforce authorization.

Client Boundaries

  • Keep "use client" boundaries as narrow as practical; providers and interactive subtrees may need a higher boundary
  • Props must be serializable (data or Server Actions, no functions/classes)
  • Pass server content via children

Import Aliases

Never use relative paths (../../lib/utils). Default to the @/ alias (@/lib/utils) in new projects. In an existing project, read components.json and follow the alias style already configured — shadcn also supports Node package imports (#components/ui/button). Never mix both styles.

Use the project's cn() helper when merging conditional Tailwind classes. Keep route-specific code near its route and shared components in the existing shared directories; do not impose a new folder tree on an established app.

Next.js 16 Features

Async Params

export default async function Page({
  params,
  searchParams,
}: {
  params: Promise<{ id: string }>;
  searchParams: Promise<{ q?: string }>;
}) {
  const { id } = await params;
  const { q } = await searchParams;
}

Data Fetching vs Server Actions

Prefer Server Components or Route Handlers for reads and Server Actions for mutations. Actions can read data, but client dispatch is designed for mutations and can serialize calls; they are not a general read-query transport.

"use cache", cacheTag and cacheLife require cacheComponents: true. updateTag is restricted to Server Actions, but does not itself require that flag; it can invalidate fetch tags too. Choose caching from freshness and authorization requirements, not simply because a function reads data.

Caching

"use cache";

import { cacheTag, cacheLife } from "next/cache";

export async function getProducts() {
  cacheTag("products");
  cacheLife("hours");
  return await db.products.findMany();
}

Server Actions for Mutations

"use server";

import { updateTag, revalidateTag } from "next/cache";
import { z } from "zod";

const schema = z.object({
  title: z.string().min(1),
  content: z.string(),
});

export async function createPost(formData: FormData) {
  // Authenticate and authorize the caller before the write.
  // Validate input as well.
  const parsed = schema.parse({
    title: formData.get("title"),
    content: formData.get("content"),
  });

  await db.insert(posts).values(parsed);
  updateTag("posts"); // Read-your-writes
  // Or SWR-style revalidation: revalidateTag("posts", "max")
}

Proxy API

Use proxy.ts for request interception (replaces middleware). Place at project root:

// proxy.ts (project root, same level as app/)
import { NextResponse } from "next/server"
import type { NextRequest } from "next/server"

export function proxy(request: NextRequest) {
  // Auth checks, redirects, etc.
}

export const config = {
  matcher: ['/dashboard/:path*'],
}

Design-system lint (@shadcn/lint)

Principle 4 is checkable. @shadcn/lint (ESLint or Oxlint plugin, Tailwind v4) flags restyled components (), raw palette colors, arbitrary values, inline styles and classes Tailwind cannot generate — and each error names the variant, size or theme token to use instead, read from components.json, the component files and globals.css.

When the project has it configured, run the lint after UI changes and fix every finding before calling the view done. Suggest adding it to new projects and to existing ones where agent-written UI keeps drifting off the theme; setup and a tested config are in references/shadcn-platform.md.

Dev Tools (next-devtools-mcp)

Next.js 16+ ships an MCP endpoint at /_next/mcp that exposes the dev server's internals to coding agents. When working in a Next.js 16 project, recommend the user add next-devtools-mcp to .mcp.json:

{
  "mcpServers": {
    "next-devtools": {
      "command": "npx",
      "args": ["-y", "next-devtools-mcp@latest"]
    }
  }
}

Tools it provides (when dev server is running):

or compile one route on demand without requesting it (Turbopack only)

  • get_errors — live build/runtime/type errors (esp. helpful for hydration mismatches)
  • get_logs — dev log file path (browser console + server output)
  • get_routes — all entry-point routes grouped by router type
  • getpagemetadata — route, components, rendering details for a specific page
  • getprojectmetadata — project structure + dev server URL
  • getserveractionbyid — locate Server Action source from its hashed ID
  • getcompilationissues / compile_route — bundler warnings for the project,

It also acts as a docs gateway: it points at the version-accurate docs shipped inside node_modules/next/dist/docs/, which beat any remembered API shape.

Use these instead of asking the user to copy-paste error messages. Reference: nextjs.org/docs/app/guides/mcp.

Rendered markdown and loading states

Don't hand-roll CSS for these — shadcn ships them:

variables (--typeset-size, --typeset-leading, --typeset-flow), one preset per context. Streaming-stable: new blocks don't restyle earlier ones.

  • Rendered markdown / LLM output → typeset. One owned CSS file, three
<div className="typeset typeset-chat">{markdown}</div>

Skeleton only for placeholders with a known shape; don't stack both.

  • Indeterminate text state ("Thinking…") → className="shimmer". Use
  • Soft scroll container edges → className="scroll-fade overflow-y-auto".

Details and the full class tables: references/shadcn-platform.md.

References

  • Architecture: references/architecture.md - Components, routing, Suspense, data patterns, AI directory structure
  • Styling: references/styling.md - Themes, fonts, radius, animations, CSS variables
  • shadcn Platform: references/shadcn-platform.md - Base UI vs Radix vs React Aria, CLI verbs, typeset, shimmer, scroll-fade, RTL, package imports, @shadcn/lint
  • Sidebar: references/sidebar.md - shadcn sidebar with nested layouts, blocks, RTL
  • Project Setup: references/project-setup.md - bun commands, presets
  • Official shadcn skill: bunx --bun skills add shadcn/ui - live project config + CLI/registry reference. Install alongside this skill; it covers CLI mechanics, this one covers conventions.
  • shadcn/ui: llms.txt - fallback when the CLI isn't available; prefer shadcn docs

Package Manager

Always use bun in new projects, never npm or npx:

  • bun install (not npm install)
  • bun add (not npm install package)
  • bunx --bun (not npx)

In an existing repo, respect the project's packageManager field and lockfile instead of switching to bun.

More skills from laguagu/claude-code-nextjs-skills

  • Aai-appFull-stack AI application generator with Next.js, AI SDK, and ai-elements. Use when creating chatbots, agent dashboards, or custom AI applications.
  • Aai-elementsBuild AI chat interfaces with pre-built shadcn-style components (Message, Conversation, PromptInput, Reasoning, Sources, Tool, Artifact, CodeBlock, Suggestion, Task, Image, ChainOfThought, InlineCitation, WebPreview, Checkpoint, Plan, Queue, ModelSelector, and more). Use when adding AI chat UI to a Next.js + AI SDK app, installing AI Elements components via the CLI (`bun x ai-elements@latest add message` or `npx shadcn@latest add @ai-elements/message`), composing message displays with markdown, building prompt inputs with attachments, or rendering streaming reasoning and tool output.
  • Aai-sdkAnswer questions about the AI SDK and help build AI-powered features. Use when developers ask about Vercel AI SDK, generateText, streamText, ToolLoopAgent, useChat, providers, tools, structured output, embeddings, streaming, or adding AI to an app. First identify the installed major version and route version-specific work: use ai-sdk-7 for AI SDK 7 features/migrations such as WorkflowAgent, HarnessAgent, reasoning, runtime/tools context, toolApproval, telemetry, realtime, or v6-to-v7 upgrades; use ai-sdk-6 for v6 code.
  • Aai-sdk-6Vercel AI SDK v6 development, for projects already on ai@6. Use when building or maintaining AI agents, chatbots, tool integrations, streaming apps, or structured output in a v6 codebase. New projects and ai@7 code use ai-sdk-7; an unknown version goes through ai-sdk. Covers ToolLoopAgent, useChat, generateText, streamText, tool approval, smoothStream, provider tools, MCP integration, and Output patterns.
  • Aai-sdk-7Vercel AI SDK v7 development and migration. Use when building or upgrading AI SDK 7 apps, especially ToolLoopAgent, WorkflowAgent, HarnessAgent, Claude Code/Codex/Pi harnesses, runtimeContext, toolsContext, toolApproval, telemetry, reasoning, file or skill uploads, realtime, video generation, or v6-to-v7 breaking changes. For AI SDK v6 code use ai-sdk-6; for version discovery and general doc lookup use ai-sdk.
  • Acache-componentsExpert guidance for Next.js Cache Components and Partial Prerendering (PPR). Use when implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, instant navigation validation, 'use cache: private', pass-through/interleaving patterns, GET Route Handler caching, debugging cache issues, and reviewing Cache Component implementations.
  • Achrome-devtoolsTests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance (LCP/CLS/INP), or verify visual output with real runtime data. Complements Playwright — use this for live debugging and performance work, Playwright for stable E2E test suites.
  • Afrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
  • AgoOpens the running app in a browser and verifies that recent UI changes actually work. Use for any quick smoke test of recent work — "go", "test in browser", "check in browser", "make sure it works", "verify it works", "did it work", "works on mobile" — including when the user appends "...and make sure it works" to a UI request. For design critique, use go-ui or web-design-guidelines.
  • AhandoffWrite or update a HANDOFF.md so a fresh agent can continue this work. Use when the user says "handoff", "compact this", "context is full", or "/clear and continue".
  • Chetzner-cloudManage Hetzner Cloud infrastructure with the `hcloud` CLI — servers, networks, firewalls, load balancers, volumes, DNS zones, SSH keys, primary/floating IPs, snapshots, certificates, placement groups, storage boxes. Use whenever the user mentions Hetzner, hcloud, VPS provisioning, or Hetzner location codes (fsn1, hel1, nbg1, ash, hil, sin) — even if they don't say "hcloud". CLI-only; does NOT cover Hetzner Robot (dedicated servers, separate product and API).
  • AiconsFind, fetch, and install the right icon or logo from the right source — brand marks, country flags, file-type icons (PDF, DOCX, ZIP), and UI glyphs — and keep them visually consistent with the app. Use when the project's icon library has no match, when svgl comes up empty, or when the user asks for a flag, a file-type badge, a brand logo, or just "an icon for X". Covers the Iconify search API (200k+ icons across flags, file types, logos and UI sets), the svgl shadcn registry for full-colour brand logos, family and stroke-weight matching so a borrowed icon does not look pasted in, and fallback sources when neither Iconify nor svgl has the mark. Triggers on "add an icon", "country flag", "flag icon", "PDF icon", "file type icon", "brand logo", "sign in with Google/GitHub", "language switcher", "svgl", "iconify", "find an icon". For overall visual direction rather than sourcing one specific mark, use frontend-design; for installing shadcn components generally, use shadcn.

All agent skills → · MCP servers