# Programmatic SEO Architecture and Refactor Prompt

> System prompt to refactor web apps for 100k+ programmatic SEO pages

A detailed system prompt designed for large language models to audit and refactor web codebases for programmatic SEO. It instructs the AI to design scalable page templates, dynamic metadata, structured schema markup, and internal linking while preventing keyword cannibalization and thin content.

## The prompt

Audit and refactor the entire codebase as a senior full-stack engineer and SEO architect with the explicit goal of safely scaling to 100,000+ programmatic SEO pages. Design a programmatic SEO system built on structured data that enables scalable page templates, dynamic routing, and unique intent-matched content per page, including titles, headings, descriptions, and FAQs, while avoiding thin content, duplication, and keyword cannibalization. Implement advanced SEO foundations such as fully dynamic metadata (title, description, canonical, Open Graph, Twitter), appropriate schema markup (Article, FAQ, Breadcrumb, Product, or context-specific types), and intelligent internal linking using hub-and-spoke structures, related pages, and breadcrumbs. Optimize the application for performance and scalability by prioritizing Core Web Vitals, leveraging static generation or incremental regeneration where possible, minimizing bundle size, and ensuring fast builds and effective caching even at very large page counts. Refactor the codebase for clarity, modularity, and long-term maintainability by introducing clean abstractions for SEO logic, data fetching, and page templates, with safeguards and conventions that allow future pages to be added at scale without regressions.

Resulting file structure (from quoted tweet image): src/ — lib/seo/ (index.ts, metadata.ts, schema.ts, linking.ts), lib/pseo/ (index.ts, types.ts, data.ts, uniqueness.ts, validation.ts, cannibalization.ts), data/ (keyword-matrix.ts, pseo/\[category\]/\[slug\].json), templates/ (ToolLandingTemplate.tsx, ComparisonTemplate.tsx, GuideTemplate.tsx, CategoryHubTemplate.tsx), components/seo/ (RelatedPages.tsx, Breadcrumbs.tsx, HubLinks.tsx), app/ (tools/\[category\]/\[slug\]/page.tsx, guides/\[topic\]/page.tsx, sitemap/\[category\]/route.ts).

## What it is for

- Refactor a Next.js or React codebase to support large-scale programmatic page generation
- Establish automated schema markup, dynamic metadata, and canonical tag structures
- Design hub-and-spoke internal linking architectures to avoid orphan pages and cannibalization
- Structure data fetching and caching for scalable static or incremental builds

## Key points

- Instructs LLM to act as a senior full-stack engineer and technical SEO architect
- Specifies requirements for dynamic metadata, Open Graph, and context-specific schema markup
- Enforces uniqueness rules to prevent thin content, duplication, and keyword cannibalization
- Guides the creation of modular templates (tool landings, comparisons, category hubs)
- Includes architectural guidelines for hub-and-spoke internal linking and breadcrumbs
- Focuses on build performance, caching strategies, and Core Web Vitals optimization

## Pricing

Free

## Details

- Type: Prompt
- Category: [Development](https://xiry.app/topics/development.md)
- Open source: no
- Platforms: Web
- For: Full-stack developers, technical SEOs, and indie hackers building programmatic sites
- Tags: seo, programmatic seo, prompts, claude, nextjs, architecture

## Why it was saved

- [@kalashvasaniya, 15 January 2026](https://x.com/kalashvasaniya/status/2011775098395771101): A battle-tested prompt with 850 likes / 2k bookmarks; its outcome (100k pages ranking) is visible in the quoted tweet.

## Related

- [Website Pre-Launch Checklist for AI Assistants](https://xiry.app/resources/website-pre-launch-checklist-for-ai-assistants): A 20-item checklist to delegate to AI before launching a website. (Tip, Free)
- [Hide Next.js Pages with Metadata Robots](https://xiry.app/resources/hide-next-js-pages-with-metadata-robots): Prevent search engines from indexing specific Next.js pages using metadata robots (Tip, Free)
- [Pair Programming with gpt-5, Claude, & Cursor (Unfiltered Live Build)](https://xiry.app/resources/pair-programming-with-gpt-5-claude-and-cursor-unfiltered-liv): Unfiltered live coding stream building a Next.js AI app with Cursor (Article or course, Free)
- [shadcn/ui](https://xiry.app/resources/shadcn-ui-1902): Copy-paste React UI components built with Tailwind CSS and Radix primitives. (Website, Open source)
- [Efferd](https://xiry.app/resources/efferd): Pre-built, responsive shadcn/ui blocks and layouts for React applications (Web app, Freemium)
- [Sales CRM](https://xiry.app/resources/sales-crm): Open-source dark-mode sales CRM dashboard built with Next.js and Claude (Web app, Free)

Updated 11 October 2026. Page: https://xiry.app/resources/programmatic-seo-architecture-and-refactor-prompt

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
