Back to list
kensleDev

nextjs-dynamic-routes-params

by kensleDev

0🍴 0📅 Jan 16, 2026

SKILL.md


name: nextjs-dynamic-routes-params

IMPORTANT: Keep description on ONE line for Claude Code compatibility

prettier-ignore

description: Next.js dynamic routes with [param] folders. Access via params prop (Server) or useParams() (Client). Next.js 15+: await params. Default to app/[id]/ not app/products/[id]/. allowed-tools: Read, Write, Edit, Glob, Grep, Bash

Next.js Dynamic Routes and Parameters

Quick Start

Dynamic folder: app/[id]/page.tsx → URL segment becomes params

Key rule: Default to app/[id]/page.tsx unless URL structure explicitly requires nesting like app/products/[id]/page.tsx

// app/[id]/page.tsx
export default async function ProductPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;  // Next.js 15+: must await
  const product = await fetch(`https://api.example.com/products/${id}`)
    .then(r => r.json());
  return <div><h1>{product.name}</h1></div>;
}

Route Syntax

SyntaxMatchesExample
[id]/value/123
[...slug]/a/b/c/docs/getting-started/install
[[...slug]]/ or /a/b/c/shop or /shop/electronics/phones

Reference Files

Notes

  • Server Components: Use params prop (await in Next.js 15+)
  • Client Components: Use useParams() hook
  • Keep structure simple: Use app/[id]/ unless explicitly told otherwise
  • Last verified: 2025-01-11

Score

Total Score

40/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon