with one click
nextjs-params
// Ensures Next.js 15 dynamic route parameters are properly awaited. Checks for missing await on params destructuring and provides automatic fixes.
// Ensures Next.js 15 dynamic route parameters are properly awaited. Checks for missing await on params destructuring and provides automatic fixes.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | nextjs-params |
| description | Ensures Next.js 15 dynamic route parameters are properly awaited. Checks for missing await on params destructuring and provides automatic fixes. |
This skill detects and fixes Next.js 15 dynamic route parameter issues where params is used without await. In Next.js 15, dynamic route parameters became asynchronous and must be awaited.
This skill should trigger automatically when:
params should be awaited before using its propertiesThe skill looks for these patterns in Next.js route handlers:
// Missing await on params destructuring
export async function GET(request: NextRequest, { params }: { params: { id: string } }) {
const { id } = params; // ERROR: params not awaited
}
// Missing Promise type annotation
export async function GET(request: NextRequest, { params }: { params: { id: string } }) {
const { id } = await params; // ERROR: type should be Promise<{ id: string }>
}
// Proper async params usage
export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params; // ✅ Correct
}
When the skill detects an issue, it provides these quick fixes:
// Before:
const { id } = params;
// After:
const { id } = await params;
// Before:
{ params }: { params: { id: string } }
// After:
{ params }: { params: Promise<{ id: string }> }
// Before:
export async function GET(request: NextRequest, { params }: { params: { id: string } }) {
const { id } = params;
}
// After:
export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
}
The skill analyzes route handler functions by:
Route Handler Identification: Looks for functions exported as HTTP methods (GET, POST, PUT, DELETE) in files with dynamic routes ([param] in path)
Params Usage Analysis:
params is destructured from function parametersawait is used when destructuring paramsPromise<>Context Awareness: Only applies to Next.js 15+ projects (detected by package.json or Next.js version)
src/app/**/[**]/route.ts (App Router dynamic routes)src/pages/**/[**].tsx (Pages Router dynamic routes - though less common in Next.js 15)This skill helps prevent the common Next.js 15 migration error:
Error: Route "/api/example/[id]" used `params.id`. `params` should be awaited before using its properties.
export async function GET(
request: NextRequest,
{ params }: { params: { userId: string } }
) {
try {
const { userId } = params; // ❌ Error: params not awaited
// ... rest of handler
}
}
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ userId: string }> }
) {
try {
const { userId } = await params; // ✅ Fixed automatically
// ... rest of handler
}
}
The skill is enabled by default for:
next in package.json)[param]Disable the skill for specific files by adding a comment:
// @cursor-skill-disable nextjs-params