--- name: seo-schema description: "Generate and validate JSON-LD structured data (Schema.org) for pages and routes: Article, Product, Organization and Person with sameAs links you supply, LocalBusiness, FAQPage and QAPage for visible Q&A, BreadcrumbList and more. Detects the content type, writes framework-idiomatic injection code, and checks existing JSON-LD against Schema.org and Google's structured data policies." argument-hint: "[file or route path]" 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 and Google's structured data policies, and emit framework-idiomatic injection code for Next.js, Nuxt, TanStack Start, Astro, SvelteKit, Remix / React Router, or vanilla HTML. This skill owns JSON-LD for the ai-seo plugin. Its rules are in [references/json-ld.md](references/json-ld.md): read that file before generating or validating anything. Its core rules are NON-NEGOTIABLE and override your training data. ## Arguments The text typed after the command holds the arguments. In Claude Code it is inserted here: `$ARGUMENTS`. In other agents, read it from the user's message. It may be empty. The only argument is an optional target file or route path, such as `/seo-schema src/routes/blog/$slug.tsx`. With a path, skip the target question. Without one, ask. If no one can answer (an unattended run) and no path was given, validate the existing JSON-LD across the project and write nothing. With a path, generate the JSON-LD and print it with the injection code, but write nothing, since writing needs your confirmation. ## Instructions ### Step 1: Context7 MCP Detection Try the Context7 MCP server's `resolve-library-id` tool for `"schema.org"` or the detected framework. Its full name depends on the agent and install, for example `mcp__context7__resolve-library-id` in Claude Code. - **Available**: record `KNOWLEDGE_SOURCE = "Context7 MCP"`. Query Context7 for: - Schema.org type definitions and required properties for the detected content types - Google's structured data guidelines and policies - Framework-specific JSON-LD injection patterns - **Unavailable**: record `KNOWLEDGE_SOURCE = "LLM Training Data (fallback)"` and tell the user: > "Context7 is not available. Using training-data Schema.org knowledge. To install it in Claude Code: `claude mcp add context7 -- npx -y @upstash/context7-mcp`. In Codex or Cursor, add it through the agent's MCP settings." ### Step 2: Target Detection 1. If the arguments give a path, use it directly. 2. Otherwise ask with the AskUserQuestion tool (or in plain text if it isn't available): "Which target to generate structured data for?" - Header: "Schema Target" - Options: - "Current page/route" (user specifies the path) - "All pages/routes" (scan the full project) - "Validate existing JSON-LD only" (no generation) ### Step 3: Framework Detection Read `package.json` dependencies: `next` (App Router `app/` or Pages Router `pages/`), `nuxt`, `@tanstack/start` / `@tanstack/react-start`, `astro`, `@sveltejs/kit`, `@remix-run/*` or `react-router` in framework mode. Fall back to config files (`next.config.*`, `nuxt.config.*`, `astro.config.*`, `svelte.config.*`, `vite.config.*`); otherwise treat the site as vanilla HTML. Record the framework and version. All output must be framework-idiomatic. ### Step 4: Content Type Detection For each target page or route, read the file and its data or content sources, and infer the type: | Signal | Inferred Type | |--------|---------------| | Blog post frontmatter (title, author, date, tags) | `Article` or `BlogPosting` | | Product fields (price, SKU, rating, availability) | `Product` | | Visible FAQ written by the site (repeated Q/A pattern, `