Skip to content
wsimmonds avatar

Nextjs Pathname Id Fetch

Focused Next.js pattern that loads a page's data from a dynamic URL segment like [id] or [slug].

CCM score
41 of 100
skills.sh installs
298
GitHub stars
116
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers creating dynamic route folders and reading route parameters in server components to fetch data from APIs
  • Includes typed params handling for Next.js 15+, a complete product detail example, and a pre-ship checklist
  • Enforces bracketed folder names, server-side rendering with no use client, and no any types under the lint rule
  • Designed for detail pages such as products, blog posts, and user profiles, and as a simpler companion to nextjs-dynamic-routes-params

Install

$ npx -y skills add wsimmonds/claude-nextjs-skills --skill nextjs-pathname-id-fetch -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Next.js: Pathname ID Fetch Pattern

When This Pattern Applies

Use this pattern whenever a page needs to load data based on whatever identifier appears in the URL. Common scenarios include:

  • Detail pages for products, posts, or users (/products/{id}, /blog/{slug})
  • Admin dashboards that drill into a selected resource (/admin/orders/{orderId})
  • Documentation or knowledge bases with nested paths (/docs/getting-started/installation)

If the requirement says the data should change depending on the current URL path, the route segment must be dynamic (e.g., [id], [slug], [...slug]).

The Pattern

✅ Recommended implementation

1. Create a dynamic folder: app/[id]/page.tsx
2. Access the parameter: const { id } = await params;
3. Fetch data using that identifier
4. Render the requested information

❌ Pitfall

Using app/page.tsx for this scenario prevents access to per-path identifiers.

Complete Implementation Example

// app/[id]/page.tsx

Details

Repository
github.com/wsimmonds/claude-nextjs-skills
Categories
Frontend & UI Code, Backend & APIs
First seen
Jun 3, 2026

Questions

What does the nextjs-pathname-id-fetch skill do?

nextjs-pathname-id-fetch teaches a pattern for fetching data from a URL parameter in Next.js. It covers creating dynamic routes such as [id] and [slug] and reading the route parameter in a server component to call an API.

Who should use the nextjs-pathname-id-fetch skill?

nextjs-pathname-id-fetch suits developers building pages that show one item chosen by the URL, such as product pages, blog posts or user profiles. Its own guidance says it covers the simple common case, while nextjs-dynamic-routes-params covers catch-all and multi-parameter routes.

How do I install the nextjs-pathname-id-fetch skill?

Run npx -y skills add wsimmonds/claude-nextjs-skills --skill nextjs-pathname-id-fetch -y in your project. After installing, nextjs-pathname-id-fetch guides the agent to create app/[id]/page.tsx and await params before fetching data.

Where does nextjs-pathname-id-fetch sit in its category?

nextjs-pathname-id-fetch is listed in the Frontend & UI Code category, next to vercel-react-best-practices and web-design-guidelines. Its focus is narrow, covering only URL-parameter data fetching in Next.js server components.

More from wsimmonds/claude-nextjs-skills

All 9

Similar to Nextjs Pathname Id Fetch

More Frontend & UI Code