wsimmonds/claude-nextjs-skills/nextjs-pathname-id-fetch
Claude Code and agent skill by wsimmonds/claude-nextjs-skills
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install wsimmonds/claude-nextjs-skills/nextjs-pathname-id-fetchSKILL.md
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
❌ Pitfall
Complete Implementation Example
File Structure
URL Mapping:
/123→ params ={ id: '123' }/abc→ params ={ id: 'abc' }/product-xyz→ params ={ id: 'product-xyz' }
Key Rules
1. Folder Name MUST Use Brackets
2. This is a Server Component (Default)
3. Params Must Be Awaited (Next.js 15+)
4. Keep It Simple - Don't Over-Nest
Unless requirements explicitly call for /products/[id], keep the structure at the top level (app/[id]/page.tsx).
TypeScript: NEVER Use any Type
This codebase has @typescript-eslint/no-explicit-any enabled. Using any will cause build failures.
Common Variations
Different Parameter Names
Multiple Parameters
Complete Working Example
Quick Checklist
Before shipping a pathname-driven detail page, confirm:
- [ ] The route folder uses brackets (e.g.,
app/[id]/page.tsx) - [ ] The component stays server-side (no
'use client'needed) - [ ] The
paramsprop is typed asPromise<{ id: string }>for Next.js 15+ - [ ] You await the params and read the identifier safely
- [ ] Data fetching logic uses that identifier
- [ ] Rendering handles loading/error states appropriately
- [ ] Types are explicit—never fall back to
any
When to Use the Comprehensive Skill Instead
This micro-skill covers the simple "pathname ID fetch" pattern. Use the comprehensive nextjs-dynamic-routes-params skill for:
- Catch-all routes (
[...slug]) - Optional catch-all routes (
[[...slug]]) - Complex multi-parameter routing
- Advanced routing architectures
- Detailed routing decisions
For the simple case of "fetch data by ID from URL", this skill is all you need.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingnextjs-pathname-id-fetch/SKILL.md
Popularity
- Repository stars
- 108
- Repository forks
- 22
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 12 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/wsimmonds/claude-nextjs-skills/nextjs-pathname-id-fetch)