--- name: "SEO Optimization" description: "Implement Next.js SEO with metadata, structured data, sitemaps, Open Graph tags, and technical SEO. Apply when optimizing pages for search engines, adding social sharing, or improving discoverability." allowed-tools: Read, Write, Edit, Bash version: 1.1.0 compatibility: Claude Opus 4.5, Claude Code v2.x updated: 2026-01-24 --- # SEO Optimization Systematic SEO implementation for Next.js applications ensuring maximum search visibility and social sharing. ## Overview This Skill enforces: - Optimized metadata (titles, descriptions) - Open Graph and Twitter Card tags - JSON-LD structured data - Sitemaps and robots.txt - Canonical tags for duplicate prevention - Image optimization - Core Web Vitals optimization - URL structure best practices Apply when optimizing pages for search engines, adding social sharing, or improving discoverability. ## Metadata Optimization ### Static Metadata ```tsx // app/page.tsx export const metadata: Metadata = { title: 'Home | My App', description: 'Build amazing apps with modern technology', keywords: ['Next.js', 'React', 'TypeScript'], authors: [{ name: 'Your Name' }], viewport: 'width=device-width, initial-scale=1', robots: 'index, follow' }; export default function HomePage() { return
Home
; } ``` ### Dynamic Metadata (generateMetadata) ```tsx // app/blog/[slug]/page.tsx import { Metadata } from 'next'; export async function generateMetadata( { params }: { params: { slug: string } } ): Promise { const post = await getPost(params.slug); return { title: post.title, description: post.excerpt, keywords: post.tags, openGraph: { title: post.title, description: post.excerpt, url: `https://example.com/blog/${post.slug}`, siteName: 'My Blog', images: [ { url: post.image, width: 1200, height: 630, alt: post.title } ], type: 'article', publishedTime: post.publishedAt, authors: [post.author] } }; } export default async function BlogPost( { params }: { params: { slug: string } } ) { const post = await getPost(params.slug); return (

{post.title}

{post.content}

); } ``` ## Open Graph & Social Sharing ### Complete Open Graph Setup ```tsx // app/layout.tsx export const metadata: Metadata = { metadataBase: new URL('https://example.com'), title: 'My App', description: 'The best app ever', openGraph: { type: 'website', locale: 'en_US', url: 'https://example.com', siteName: 'My App', title: 'My App', description: 'The best app ever', images: [ { url: '/og-image.png', width: 1200, height: 630, alt: 'My App' } ] }, twitter: { card: 'summary_large_image', title: 'My App', description: 'The best app ever', images: ['/og-image.png'], creator: '@yourhandle' } }; ``` ### Article Metadata (Blog Post) ```tsx const metadata: Metadata = { openGraph: { type: 'article', publishedTime: '2025-01-15T10:00:00Z', modifiedTime: '2025-01-20T15:30:00Z', authors: ['John Doe'], tags: ['Next.js', 'SEO', 'Performance'] } }; ``` ## JSON-LD Structured Data ### Product Schema ```tsx // app/products/[id]/page.tsx export default function ProductPage({ params }) { const product = getProduct(params.id); const structuredData = { '@context': 'https://schema.org', '@type': 'Product', name: product.name, description: product.description, image: product.image, brand: { '@type': 'Brand', name: 'My Store' }, offers: { '@type': 'Offer', price: product.price, priceCurrency: 'USD', availability: 'https://schema.org/InStock' }, aggregateRating: { '@type': 'AggregateRating', ratingValue: product.rating, reviewCount: product.reviews.length } }; return ( <> // ❌ BAD: No schema markup // Missing rich results opportunity // ❌ BAD: Redirects chain // /old-page → /newer-page → /current-page // Use direct redirect instead ``` ## Integration with Project Standards Enforces discoverability and performance: - Improved search visibility (organic traffic) - Better social sharing (engagement) - Fast page loads (Core Web Vitals) - Structured data (rich results) ## Resources - Next.js SEO: https://nextjs.org/learn/seo/introduction-to-seo - Google Search Central: https://developers.google.com/search - Schema.org: https://schema.org - Lighthouse: https://developers.google.com/web/tools/lighthouse --- **Last Updated:** January 24, 2026 **Compatibility:** Claude Opus 4.5, Claude Code v2.x **Status:** Production Ready > **January 2026 Update:** This skill is compatible with Claude Opus 4.5 and Claude Code v2.x. For complex tasks, use the `effort: high` parameter for thorough analysis.