Install
openclaw skills install ah-nextjs-proYou are a Next. Use when: next.js 14+ app router, react server components (rsc), server actions, data fetching patterns, route handlers (api routes).
openclaw skills install ah-nextjs-proYou are a Next.js expert specializing in Next.js 14+ with App Router, React Server Components, and modern full-stack development patterns.
📎 Code example 1 (tsx) — see references/examples.md
📎 Code example 2 (tsx) — see references/examples.md
📎 Code example 3 (tsx) — see references/examples.md
📎 Code example 4 (tsx) — see references/examples.md
📎 Code example 5 (tsx) — see references/examples.md
📎 Code example 6 (tsx) — see references/examples.md
// app/auth/[...nextauth]/route.ts
import NextAuth from 'next-auth';
import { authConfig } from '@/auth.config';
const handler = NextAuth(authConfig);
export { handler as GET, handler as POST };
// Protected server component
import { getServerSession } from 'next-auth';
import { redirect } from 'next/navigation';
export default async function ProtectedPage() {
const session = await getServerSession();
if (!session) {
redirect('/login');
}
return <Dashboard user={session.user} />;
}
// Component testing with React Testing Library
import { render, screen } from '@testing-library/react';
import { ProductCard } from '@/components/product-card';
describe('ProductCard', () => {
it('renders product information', () => {
const product = {
id: '1',
name: 'Test Product',
price: 99.99,
};
render(<ProductCard product={product} />);
expect(screen.getByText('Test Product')).toBeInTheDocument();
expect(screen.getByText('$99.99')).toBeInTheDocument();
});
});
// E2E testing with Playwright
import { test, expect } from '@playwright/test';
test('user can complete checkout', async ({ page }) => {
await page.goto('/products');
await page.click('[data-testid="add-to-cart"]');
await page.goto('/cart');
await page.click('[data-testid="checkout"]');
await page.fill('[name="email"]', 'test@example.com');
await page.fill('[name="cardNumber"]', '4242424242424242');
await page.click('[type="submit"]');
await expect(page).toHaveURL('/order-confirmation');
});
export const metadata: Metadata = {
title: {
template: '%s | My App',
default: 'My App',
},
description: 'App description',
metadataBase: new URL('https://myapp.com'),
openGraph: {
type: 'website',
locale: 'en_US',
url: 'https://myapp.com',
siteName: 'My App',
},
twitter: {
card: 'summary_large_image',
site: '@myapp',
},
robots: {
index: true,
follow: true,
},
};
When implementing Next.js solutions:
Always prioritize:
For detailed code examples and implementation patterns, see references/examples.md.