Use this pattern whenever a page needs to load data based on whatever identifier appears in the URL. Common scenarios include:
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionnextjs-pathname-id-fetchExecute the skills CLI command in your project's root directory to begin installation:
Fetches nextjs-pathname-id-fetch from wsimmonds/claude-nextjs-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate nextjs-pathname-id-fetch. Access via /nextjs-pathname-id-fetch in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
82
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
82
stars
Use this pattern whenever a page needs to load data based on whatever identifier appears in the URL. Common scenarios include:
/products/{id}, /blog/{slug})/admin/orders/{orderId})/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]).
✅ 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.
// app/[id]/page.tsx
// IMPORTANT: Server component (NO 'use client' needed!)
export default async function ProductPage({
params,
}: {
params: Promise<{ id: string }>;
}) {
// Next.js 15+: params must be awaited
const { id } = await params;
// Fetch data using the ID from the URL
const response = await fetch(`https://api.example.com/products/${id}`);
const product = await response.json();
// Return JSX with the fetched data
return (
<div>
<h1>{product.name}</h1>
<p>{product.description}</p>
<p>Price: ${product.price}</p>
</div>
);
}
app/
└── [id]/ ← Dynamic route folder with brackets
└── page.tsx ← Server component page
URL Mapping:
/123 → params = { id: '123' }/abc → params = { id: 'abc' }/product-xyz → params = { id: 'product-xyz' }✅ app/[id]/page.tsx
✅ app/[productId]/page.tsx
✅ app/[slug]/page.tsx
❌ app/id/page.tsx (no brackets = static route)
❌ app/page.tsx (can't access params here)
// ✅ CORRECT - No 'use client' needed
export default async function Page({ params }) {
const { id } = await params;
const data = await fetch(`/api/${id}`);
return <div>{data.name}</div>;
}
// ❌ WRONG - Don't add 'use client' for server components
'use client'; // ← Remove this!
export default async function Page({ params }) { ... }
// ✅ CORRECT - Next.js 15+
export default async function Page({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params; // Must await
// ...
}
// ⚠️ OLD (Next.js 14 and earlier - deprecated)
export default async function Page({
params,
}: {
params: { id: string };
}) {
const { id } = params; // No await needed in old versions
// ...
}
✅ app/[id]/page.tsx (simple, clean)
❌ app/products/[id]/page.tsx (only if explicitly required!)
Unless requirements explicitly call for /products/[id], keep the structure at the top level (app/[id]/page.tsx).
any TypeThis codebase has @typescript-eslint/no-explicit-any enabled. Using any will cause build failures.
// ❌ WRONG
function processProduct(product: any) { ... }
// ✅ CORRECT - Define proper types
interface Product {
id: string;
name: string;
price: number;
}
function processProduct(product: Product) { ... }
// ✅ ALSO CORRECT - Use unknown if type truly unknown
function processData(data: unknown) {
// Type guard required before using
if (typeof data === 'object' && data !== null) {
// ...
}
}
// app/[productId]/page.tsx
export default async function Page({
params,
}: {
params: Promise<{ productId: string }>;
}) {
const { productId } = await params;
// ...
}
// app/[slug]/page.tsx
export default async function Page({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
// ...
}
// app/[category]/[id]/page.tsx
export default async function Page({
params,
}: {
params: Promise<{ category: string; id: string }>;
}) {
const { category, id } = await params;
const data = await fetch(`/api/${category}/${id}`);
// ...
}
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
laguagu/claude-code-nextjs-skills
anthropics/claude-code
mblode/agent-skills
github/awesome-copilot
leonxlnx/taste-skill
sickn33/antigravity-awesome-skills
I recommend nextjs-pathname-id-fetch for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
We added nextjs-pathname-id-fetch from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
nextjs-pathname-id-fetch reduced setup friction for our internal harness; good balance of opinion and flexibility.
nextjs-pathname-id-fetch fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
nextjs-pathname-id-fetch fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Registry listing for nextjs-pathname-id-fetch matched our evaluation — installs cleanly and behaves as described in the markdown.
Solid pick for teams standardizing on skills: nextjs-pathname-id-fetch is focused, and the summary matches what you get after install.
nextjs-pathname-id-fetch is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
nextjs-pathname-id-fetch is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Useful defaults in nextjs-pathname-id-fetch — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
showing 1-10 of 73