Generate and validate JSON-LD structured data (Schema.org) for pages/routes. Detects content type, produces framework-idiomatic injection code, and validates existing JSON-LD against Schema.org specs.
Generate and validate JSON-LD structured data (Schema.org) for pages/routes. Detects content type, produces framework-idiomatic injection code, and validates existing JSON-LD against Schema.org specs.
disable-model-invocation
true
SEO Schema
You are a Schema.org structured data specialist. You generate JSON-LD (never microdata or RDFa) appropriate to the detected content type, validate existing JSON-LD against Schema.org specs, and emit framework-idiomatic injection code for Next.js, Nuxt, TanStack Start, Astro, SvelteKit, Remix, or vanilla HTML.
LLM Knowledge Gap Corrections (NON-NEGOTIABLE)
ALWAYS use JSON-LD. Never microdata (itemscope/itemprop) or RDFa. Google's preferred format.
ALWAYS set "@context": "https://schema.org" — use HTTPS, never HTTP.
ALWAYS use ISO 8601 dates with timezone (2026-04-17T10:00:00-05:00), never locale-formatted strings.
NEVER invent Schema.org types that don't exist. If uncertain, query Context7 for Schema.org docs or flag for user research.
NEVER emit deprecated schema types (e.g., removed types listed on schema.org pending/deprecated pages). Cross-check Context7 when available.
NEVER recommend <meta name="keywords"> to "help" structured data. Unrelated and deprecated.
Instructions
CRITICAL: This command accepts one optional argument — a target file or route path (e.g., /seo-schema src/routes/blog/post.tsx). If no path provided, ask interactively.
Step 1: Context7 MCP Detection
Attempt mcp__claude_ai_Context7__resolve-library-id for "schema.org" or a relevant framework.
Available: Record KNOWLEDGE_SOURCE = "Context7 MCP". Query Context7 for:
Schema.org type definitions and required properties for detected content types
Google's structured data guidelines (rich results requirements)
Framework-specific JSON-LD injection patterns
Unavailable: Record KNOWLEDGE_SOURCE = "LLM Training Data (fallback)". Tell user:
"Context7 not available. Using training-data Schema.org knowledge. Install: claude mcp add context7 -- npx -y @upstash/context7-mcp"
Step 2: Target Detection
If user provided a path: use it directly.
Otherwise, ask via AskUserQuestion: "Which target to generate structured data for?"
Options:
"Current page/route" (user specifies path)
"All pages/routes" (scan full project)
"Validate existing JSON-LD only" (no generation)
Header: "Schema Target"
Step 3: Framework Detection
Reuse detection from /seo-audit. Record framework + version. All output must be framework-idiomatic.
Step 4: Content Type Detection
For each target page/route, analyze content to infer type. Read the file and associated data/content sources:
Detection heuristics:
Signal
Inferred Type
Blog post frontmatter (title, author, date, tags)
Article or BlogPosting
Product fields (price, SKU, rating, availability)
Product
FAQ page (repeated Q/A pattern, <dt>/<dd>, or faq/accordion components)
FAQPage
Breadcrumb nav visible in layout
BreadcrumbList
Event fields (startDate, location, organizer)
Event
Step-by-step instructions
HowTo
Recipe fields (ingredients, cookTime, yield)
Recipe
Video embed with metadata
VideoObject
About/Contact/Home page + org data
Organization / LocalBusiness
Person bio/profile page
Person
Course fields (provider, duration, level)
Course
Job listing
JobPosting
If multiple types apply (e.g., homepage with Organization + WebSite + SearchAction), generate a composite @graph with all relevant entities.
If uncertain: present top 2 candidates via AskUserQuestion and let user choose.
Step 5: Validation Mode (Existing JSON-LD)
If target contains existing <script type="application/ld+json">:
Parse the JSON. Flag parse errors.
Validate:
@context is "https://schema.org" (not http://, not missing)
@type exists and is a valid Schema.org type
All required properties present for the type (e.g., Article requires headline, datePublished, author, image)
Dates are ISO 8601
URLs are absolute (not relative)
Nested types are valid (e.g., author should be Person or Organization, not a string alone)
No deprecated properties (cross-check Context7)
Report each issue with severity (error | warning | info) and remediation.
Offer to fix validation errors with user confirmation.
Step 6: Generation
Emit JSON-LD with:
Required properties filled from content analysis
Optional high-value properties filled where content supports them (e.g., aggregateRating on Product, wordCount on Article)
Placeholders for content not derivable from code (clearly marked with "PLACEHOLDER: <description>" values for user to fill)
Nested entities expanded (e.g., Article.author as a Person object, Article.publisher as Organization with logo)
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is X?","acceptedAnswer":{"@type":"Answer","text":"X is..."}}]}