schema-json-optimization
Skill7 starsChanged 10 months agoMITView on GitHub
Validates existing JSON-LD structured data and suggests relevant schemas based on auto-detected page type. Does NOT enforce all schema types — only checks what is applicable to the current page context. Use when auditing or generating structured data for search engine rich results.
In this repository10 other files it gives its agents.
- nextjs-seo-auditSkill
- backlink-monitoringSkill
- core-web-vitalsSkill
- international-seoSkill
- meta-data-optimizationSkill
- mobile-optimizationSkill
- onpage-optimizationSkill
- semantic-layoutSkill
- site-speed-optimizationSkill
- technical-seoSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Look for all <script type="application/ld+json"> elements:
- Distinctive: line 55
Check existing Article schema for:
- Distinctive: line 65
If no Article schema exists, suggest generating one:
- Distinctive: line 90
If no LocalBusiness schema exists, suggest generating one:
- Distinctive: line 136
If detection is ambiguous, report what was detected and let the user decide
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Schema JSON Optimization
Validate existing JSON-LD and suggest only relevant schemas based on the detected page type.
Important: Do NOT blindly check for all schema types. First detect what kind of page this is, then only validate/suggest schemas that are applicable.
Step 1: Find and validate existing JSON-LD
Look for all <script type="application/ld+json"> elements:
- None found → ⚠️ WARN "No JSON-LD schema markup found"
- Found → ✅ PASS "Found N JSON-LD block(s)" → validate each:
Validation rules
- Invalid JSON → ❌ FAIL "Could not parse JSON-LD"
- Missing
@context→ ❌ FAIL - Missing
@type→ ❌ FAIL - Valid → ✅ PASS and check type-specific required fields (see Step 3)
Step 2: Auto-detect page type
Scan the HTML for signals to determine what type of page this is. A page may match zero, one, or multiple types:
| Page type | Detection signals |
| Article / Blog | <meta property="article:published_time">, <article> tag, blog-like URL patterns (/blog/, /post/, /news/) |
| LocalBusiness | <address> tag, <a href="tel:...">, [itemprop="telephone"], [itemprop="address"], contact page patterns |
| Product | <meta property="og:type" content="product">, price elements ([itemprop="price"]), add-to-cart buttons |
| FAQ | Multiple <details>/<summary> or FAQ-patterned heading + paragraph pairs |
| Organization | About page with company info, <meta property="og:type" content="website"> on homepage |
| BreadcrumbList | <nav aria-label="breadcrumb">, .breadcrumb class, <ol> with breadcrumb-like links |
| WebSite | Homepage with site-wide search form |
If no type is detected → only validate existing schemas, do not suggest new ones.
Step 3: Validate and suggest ONLY for detected types
Only if Article/Blog detected:
Check existing Article schema for:
| Field | Missing = |
headline | ⚠️ WARN |
datePublished | ⚠️ WARN |
author | ⚠️ WARN |
image | ⚠️ WARN |
description | ⚠️ WARN |
If no Article schema exists, suggest generating one:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "[from og:title, <title>, or <h1>]",
"datePublished": "[from article:published_time or <time datetime>]",
"author": { "@type": "Person", "name": "[from meta author]" },
"image": "[from og:image or first article img]",
"description": "[from meta description]",
"url": "[from canonical or og:url]"
}Only if LocalBusiness detected:
Check for:
| Field | Missing = |
name | ❌ FAIL |
address | ⚠️ WARN |
telephone | ⚠️ WARN |
If no LocalBusiness schema exists, suggest generating one:
{
"@context": "https://schema.org",
"@type": "LocalBusiness",
"name": "[from og:site_name or <title>]",
"address": "[from <address> or itemprop=address]",
"telephone": "[from itemprop=telephone or tel: link]",
"url": "[from canonical or og:url]",
"image": "[from og:image]"
}Only if Product detected:
Check for:
| Field | Missing = |
name | ❌ FAIL |
offers (with price and priceCurrency) | ⚠️ WARN |
image | ⚠️ WARN |
description | ⚠️ WARN |
Only if FAQ detected:
Suggest FAQPage schema with Question/Answer pairs extracted from the page.
Only if BreadcrumbList detected:
Suggest BreadcrumbList schema from the breadcrumb navigation structure.
Key principle
DO: "This page looks like a blog post → checking for Article schema"
DON'T: "Missing LocalBusiness schema" on a blog post pageThe goal is relevance, not completeness. Only flag missing schemas that would actually benefit the detected page type.
Edge cases
- A page may have multiple valid types (e.g. a product page with FAQ section → suggest both Product and FAQPage)
- A page may have existing schemas that are valid but don't match the detected type — that's fine, still validate them
- If detection is ambiguous, report what was detected and let the user decide
- Schema
@typecan be an array (e.g.["Article", "NewsArticle"])
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

