How do I add schema markup (JSON-LD) to my site with Claude Code or Codex?
Ask the agent to generate JSON-LD in your page templates from the same data each page shows, with only types and values a reader can see, rendered on the server. Write that rule in CLAUDE.md or AGENTS.md so every new page gets it. Then test the published URL, not the code, in Google's Rich Results Test.
Facts
- Google recommends JSON-LD among its 3 supported structured data formats, if your site's setup allows it. (Google Search Central: Introduction to structured data markup)
- Google's guidelines say not to mark up content that is not visible to readers, and items missing required properties are not eligible for rich results. (Google Search Central: General structured data guidelines)
- Google says no special schema.org markup is needed to appear in AI Overviews or AI Mode, and structured data should match the visible text. (Google Search Central: AI features and your website)
- Organization markup belongs on the home page or one about page, has no required properties, and its logo must be at least 112x112 pixels. (Google Search Central: Organization structured data)
- Claude Code loads the project CLAUDE.md in every session, next to an auto memory of up to 200 lines or 25KB. (Claude Code docs: How Claude remembers your project)
- Codex reads AGENTS.md before doing any work, and combines instruction files up to 32 KiB by default. (OpenAI Codex docs: Custom instructions with AGENTS.md)
Which schema types should I ask the agent to add?
Ask for the type that matches what each page shows, and nothing else:
| Page | Schema type | Key properties |
|---|---|---|
| Home or about page | Organization (or LocalBusiness) | name, url, logo, sameAs |
| Guide or blog post | Article | headline, author, datePublished, dateModified, publisher |
| Product page | Product | name, offers with the price the page shows |
| Page with visible questions and answers | FAQPage | Only the questions printed on the page |
What prompt should I give Claude Code or Codex?
Give it one rule set it can apply to every template, with a ban on invented values:
Add JSON-LD structured data to this site. - Build it in the page templates from the same data the page renders. Never hardcode a value the page does not show. - Organization (name, url, logo, sameAs) on the home page only. - Article on guides and blog posts: headline, author, datePublished, dateModified (the real last change), publisher = the Organization. - Product, LocalBusiness or FAQPage only where that content is visible. - If a value is unknown, leave the property out. Do not invent it. - Render it on the server, in a <script type="application/ld+json">. - List every page you changed and the types each one now carries.
Where do I put the rule so new pages get schema too?
Put it in the instructions file the agent loads on its own. Claude Code reads ./CLAUDE.md or ./.claude/CLAUDE.md at the start of each session, and /init creates a first version. Codex reads AGENTS.md from the project root before doing any work. A short rule there keeps the next page the agent writes consistent with the last one.
How do I check the agent did not invent anything?
Test the published URL in the Rich Results Test, then compare each value with the page a reader sees. A URL test runs the page's JavaScript, which pasted code does not. Then use URL Inspection in Search Console to confirm Google found the markup. A valid test only proves the syntax; the values are your job to check.
Will schema markup make ChatGPT or Google AI cite my site?
Not by itself. Google says AI Overviews and AI Mode need no special schema, and it does not guarantee rich results for valid markup. Correct JSON-LD helps search engines read who you are and what the page is; the answer on the page is still what gets quoted.
Step by step
- List your page types. Home, about, guides, products: one schema type for each.
- Give the agent the prompt. Ask it to build JSON-LD in the templates from the page's own data, with no invented values.
- Save the rule. Add it to CLAUDE.md or AGENTS.md so future pages follow it.
- Review the diff and deploy. Check that values come from page data, not hardcoded text.
- Test the live URL. Run the Rich Results Test on the published page, then URL Inspection in Search Console.
Common mistakes
- Letting the agent fill in ratings, prices or authors the page does not show.
- Adding FAQPage markup for questions that are not printed on the page.
- Testing pasted code instead of the live URL, which misses what JavaScript renders.
- Setting dateModified on every build instead of when the content changed.
How easyIndex solves it
easyIndex never changes your site: your coding agent writes the pages and the schema, and easyIndex audits each page when submitted and checks it again on the live site after publishing, including whether it carries JSON-LD and a real update date. A step completes on that evidence, not on the agent's report.
Frequently asked questions
JSON-LD, Microdata or RDFa?
JSON-LD. Google supports all three and recommends JSON-LD when your setup allows it.
Can the agent inject JSON-LD with JavaScript?
Google processes JSON-LD present after rendering, but server-rendered markup is safer for crawlers that do not run JavaScript.
Should Organization go on every page?
Google asks for it on the home page or one page about the organization; other pages can reference it as publisher.
Does Cursor or another agent work the same way?
Yes. Any agent that edits your templates can follow the same prompt; only the instructions file name changes.
Continue reading
- Does structured data (schema) help AI cite my site?
- What SEO rules should I put in AGENTS.md or CLAUDE.md?
- How do I run a technical SEO and AI visibility audit with Claude Code?
- Can ChatGPT and Claude see my JavaScript website?
- How do I do GEO with Claude Code or Codex?
- How does easyIndex work, what do I need, and how long until results?
Last verified on .