--- name: seo-optimizer description: > Comprehensive SEO optimization for web applications. Use when asked to improve search rankings, add meta tags, create structured data, generate sitemaps, optimize for Core Web Vitals, or analyze SEO issues. Works with Next.js, Astro, React, and static HTML sites. --- # SEO Optimizer Transform your web application from invisible to discoverable. This skill analyzes your codebase and implements comprehensive SEO optimizations that help search engines and social platforms understand, index, and surface your content. ## Philosophy: SEO as Semantic Communication SEO is not about gaming algorithms—it's about **clearly communicating what your content IS** to machines (search engines, social platforms, AI crawlers) so they can properly understand and surface it. **Before optimizing, ask**: - What is this page actually about? (not what keywords we want to rank for) - Who is the intended audience and what are they searching for? - What unique value does this content provide? - How should machines categorize and understand this content? **Core Principles**: 1. **Accuracy Over Optimization**: Describe what IS, not what you wish would rank 2. **User Intent First**: Match content to what searchers actually want 3. **Semantic Clarity**: Use structured data to make meaning machine-readable 4. **Progressive Enhancement**: Basic SEO for all pages, rich optimization for key pages 5. **Framework-Native**: Use each framework's idioms, not generic hacks **The SEO Hierarchy** (prioritize in order): ``` 1. Content Quality ← Foundation: Valuable, accurate, unique content 2. Technical Access ← Can crawlers find and index your pages? 3. Semantic Structure ← Do machines understand your content's meaning? 4. Meta Optimization ← Are your titles/descriptions compelling? 5. Structured Data ← JSON-LD for rich search results 6. Performance ← Core Web Vitals affect rankings ``` --- ## Codebase Analysis Workflow **ALWAYS analyze before implementing.** Different codebases need different approaches. ### Step 1: Discover Framework and Structure Identify the framework and routing pattern: - **Next.js**: Look for `next.config.js`, `app/` or `pages/` directory - **Astro**: Look for `astro.config.mjs`, `src/pages/` - **React Router**: Look for route configuration, `react-router-dom` - **Gatsby**: Look for `gatsby-config.js`, `gatsby-node.js` - **Static HTML**: Look for `.html` files in root or `public/` ### Step 2: Audit Current SEO State Check for existing implementations: - [ ] Meta tags in `
` (title, description, viewport) - [ ] Open Graph tags (`og:title`, `og:image`, etc.) - [ ] Twitter Card tags (`twitter:card`, `twitter:image`) - [ ] Structured data (` ``` ### Multiple Schemas Per Page Use `@graph` to combine schemas: ```json { "@context": "https://schema.org", "@graph": [ { "@type": "Organization", ... }, { "@type": "WebSite", ... }, { "@type": "BreadcrumbList", ... } ] } ``` See `references/structured-data-schemas.md` for complete schema examples. --- ## Technical SEO ### Sitemap Generation **XML Sitemap Requirements**: - Include all indexable pages - Exclude noindex pages, redirects, error pages - Update `
```
Why bad: Accessibility violation. Missed image search opportunity.
❌ **Blocking Crawlers Unintentionally**
```txt
# Accidentally blocking everything
User-agent: *
Disallow: /
```
Why bad: Complete deindexing. Check robots.txt carefully.
❌ **Ignoring Mobile**
Not having responsive design or mobile-specific considerations.
Why bad: Google uses mobile-first indexing. Most traffic is mobile.
❌ **Over-Optimization**
Adding structured data for content that doesn't exist.
Why bad: Schema violations can result in penalties. Trust erosion.
❌ **Generic Auto-Generated Content**
```html
```
Why bad: Provides no value. Won't rank. Won't get clicks.
---
## Variation Guidance
**IMPORTANT**: SEO implementation should vary based on context.
**Vary based on**:
- **Industry**: E-commerce needs Product schema; SaaS needs Software schema
- **Content type**: Blog posts vs landing pages vs documentation
- **Audience**: B2B vs B2C affects tone and keywords
- **Competition**: Highly competitive niches need more sophisticated optimization
- **Framework**: Use native patterns (Next.js metadata API vs manual tags)
**Avoid converging on**:
- Same title format for all page types
- Generic descriptions that could apply to any site
- Identical structured data without page-specific content
- One-size-fits-all sitemap configuration
---
## Framework Quick Reference
### Next.js (App Router)
```typescript
// app/page.tsx
import { Metadata } from 'next'
export const metadata: Metadata = {
title: 'Page Title | Brand',
description: 'Page description',
openGraph: {
title: 'Page Title',
description: 'Page description',
images: ['/og-image.png'],
},
}
```
### Next.js (Pages Router)
```typescript
// pages/index.tsx
import Head from 'next/head'
export default function Page() {
return (