Nextjs Dynamic Routes Params

Guide for Next.js App Router dynamic routes and pathname parameters. Use when building pages that depend on URL segments (IDs, slugs, nested paths), accessing the `params` prop, or fetching resources by identifier. Helps avoid over-nesting by defaulting to the simplest route structure (e.g., `app/[id]` instead of `app/products/[id]` unless the URL calls for it).

115 stars 22 forksFrontend & Design

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add wsimmonds/claude-nextjs-skills --skill nextjs-dynamic-routes-params
Manual install
git clone --depth 1 https://github.com/wsimmonds/claude-nextjs-skills.git /tmp/claude-nextjs-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-nextjs-skills/nextjs-dynamic-routes-params ~/.claude/skills/nextjs-dynamic-routes-params

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Next.js Dynamic Routes and Pathname Parameters

## When to Use This Skill

Use this skill when:
- Creating dynamic route segments (e.g., blog/[slug], users/[id])
- Accessing URL pathname parameters in Server or Client Components
- Building pages that fetch data based on route parameters
- Implementing catch-all or optional catch-all routes
- Working with the `params` prop in page.tsx, layout.tsx, or route.ts

## ⚠️ RECOGNIZING WHEN YOU NEED DYNAMIC ROUTES

**Look for requirements that tie data to the URL path.**

Create a dynamic segment (`[param]`) whenever the UI depends on part of the pathname. Typical signals include:
- Details pages that reference “the item’s ID/slug from the URL”
- Copy that calls out path segments (e.g., `/products/{id}`, `/blog/{slug}`)
- Requirements to fetch data “based on whichever resource is being visited”
- Navigation flows where one page links to `/something/{identifier}`

**✅ Dynamic route response**
```
Requirement: display product information based on whichever ID appears in the URL
Implementation: app/[id]/page.tsx
Access parameter with: const { id } = await params;
```

**❌ Static-page response**
```
Implementation: app/page.tsx  ← cannot access per-path identifiers
```

**Example requirements that lead to dynamic routes**
1. “Show a product page that loads whichever product ID appears in the URL” → `app/[id]/page.tsx` or `app/products/[id]/page.tsx`
Read the full skill on GitHub

Details

Skill name
nextjs-dynamic-routes-params
Path
nextjs-dynamic-routes-params/SKILL.md
License
MIT
Repo updated
24 October 2025

FAQ

What does the Nextjs Dynamic Routes Params skill do?

Guide for Next.js App Router dynamic routes and pathname parameters. Use when building pages that depend on URL segments (IDs, slugs, nested paths), accessing the `params` prop, or fetching resources by identifier. Helps avoid over-nesting by defaulting to the simplest route structure (e.g., `app/[id]` instead of `app/products/[id]` unless the URL calls for it).

How do I install the Nextjs Dynamic Routes Params skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add wsimmonds/claude-nextjs-skills --skill nextjs-dynamic-routes-params. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Nextjs Dynamic Routes Params popular?

It lives in wsimmonds/claude-nextjs-skills, which has 115 GitHub stars and 22 forks.

Related skills

Nextjs Advanced Routing

115

wsimmonds/claude-nextjs-skills

Guide for advanced Next.js App Router patterns including Route Handlers, Parallel Routes, Intercepting Routes, Server Actions, error boundaries, draft mode, and streaming with Suspense. CRITICAL for server actions (action.ts, actions.ts files, 'use server' directive), setting cookies from client components, and form handling. Use when requirements involve server actions, form submissions, cookies, mutations, API routes, `route.ts`, parallel routes, intercepting routes, or streaming. Essential for separating server actions from client components.

Frontend & Design22

Nextjs Anti Patterns

115

wsimmonds/claude-nextjs-skills

Identify and fix common Next.js App Router anti-patterns and mistakes. Use when reviewing code for Next.js best practices, debugging performance issues, migrating from Pages Router patterns, or preventing common pitfalls. Activates for code review, performance optimization, or detecting inappropriate useEffect/useState usage. CRITICAL: For browser detection, keep the logic in the user-facing component (or a composed helper that it renders) rather than isolating it in unused files.

Frontend & Design22

Nextjs App Router Fundamentals

115

wsimmonds/claude-nextjs-skills

Guide for working with Next.js App Router (Next.js 13+). Use when migrating from Pages Router to App Router, creating layouts, implementing routing, handling metadata, or building Next.js 13+ applications. Activates for App Router migration, layout creation, routing patterns, or Next.js 13+ development tasks.

Frontend & Design22

Nextjs Pathname Id Fetch

115

wsimmonds/claude-nextjs-skills

Focused pattern for fetching data using URL parameters in Next.js. Covers creating dynamic routes ([id], [slug]) and accessing route parameters in server components to fetch data from APIs. Use when building pages that display individual items (product pages, blog posts, user profiles) based on a URL parameter. Complements nextjs-dynamic-routes-params with a simplified, common-case pattern.

Frontend & Design22

Nextjs Client Cookie Pattern

115

wsimmonds/claude-nextjs-skills

Pattern for client components calling server actions to set cookies in Next.js. Covers the two-file pattern of a client component with user interaction (onClick, form submission) that calls a server action to modify cookies. Use when building features like authentication, preferences, or session management where client-side triggers need to set/modify server-side cookies.

Frontend & Design22

Nextjs Server Client Components

115

wsimmonds/claude-nextjs-skills

Guide for choosing between Server Components and Client Components in Next.js App Router. CRITICAL for useSearchParams (requires Suspense + 'use client'), navigation (Link, redirect, useRouter), cookies/headers access, and 'use client' directive. Activates when prompt mentions useSearchParams, Suspense, navigation, routing, Link component, redirect, pathname, searchParams, cookies, headers, async components, or 'use client'. Essential for avoiding mixing server/client APIs.

Frontend & Design22

Browse the most popular Claude skills, all frontend & design skills, or write your own with the skills generator.