Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.
feat(v2): Checkpoint 4 — schema completeness (Phase D)
Danielbc386381bac2
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 4fa6c1e..c5e38d6 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -66,7 +66,9 @@ jobs:python3 -m py_compile scripts/indexnow_submit.pypython3 -m py_compile scripts/lcp_subparts.pypython3 -m py_compile scripts/unlighthouse_run.py- echo "All 43 scripts passed syntax check"+ python3 -m py_compile scripts/schema_generate.py+ python3 -m py_compile scripts/schema_ecommerce_validate.py+ echo "All 45 scripts passed syntax check"test:name: Test suite (manifests + sync_flow)diff --git a/scripts/schema_ecommerce_validate.py b/scripts/schema_ecommerce_validate.pynew file mode 100644index 0000000..9b4c209--- /dev/null+++ b/scripts/schema_ecommerce_validate.py@@ -0,0 +1,277 @@+#!/usr/bin/env python3+"""+Product schema validator focused on Google merchant-listing fields.++The 2025 Google Search docs for Product structured data list four+property groups that strongly influence merchant listing eligibility:++ - ``hasMerchantReturnPolicy`` (REQUIRED for merchant listings)+ - ``shippingDetails`` (REQUIRED for merchant listings)+ - ``MemberProgram`` (loyalty pricing visibility)+ - ``energyEfficiencyClass`` (REQUIRED in the EU for in-scope+ categories under EPREL)+ - ``ProductGroup`` for size/colour variants++The Rich Results Test catches structural errors. This validator catches+the *policy* errors — fields that parse fine but disqualify the product+from a rich feature. It also flags the deprecated v1.x types+(Vehicle Listing, Claim Review, Estimated Salary, Learning Video,+Course Info, Special Announcement).++Usage::++ cat product.json | python scripts/schema_ecommerce_validate.py+ python scripts/schema_ecommerce_validate.py product.json --eu+ python scripts/schema_ecommerce_validate.py product.json --json++Exit code 0 on PASS, 1 on at least one Critical or High finding.+"""++from __future__ import annotations++import argparse+import json+import sys+from pathlib import Path+++# Types Google retired June 2025 (announced via developers.google.com/search/blog+# /2025/06/simplifying-search-results). Generating any of these in 2026 is a+# Critical finding because the rich result no longer renders.+_DEPRECATED_TYPES: dict[str, str] = {+ "Vehicle": "Vehicle Listing rich result retired June 2025.",+ "VehicleListing": "Vehicle Listing rich result retired June 2025.",+ "ClaimReview": "Claim Review rich result retired June 2025.",+ "EstimatedSalary": "Estimated Salary rich result retired June 2025.",+ "LearningVideo": "Learning Video rich result retired June 2025.",+ "Course": (+ "The Course rich result is still live but the Course Info carousel "+ "variant was retired June 2025. Verify which use-case applies."+ ),+ "SpecialAnnouncement": (+ "Special Announcement rich result deprecated July 2025."+ ),+}+++_REQUIRED_PRODUCT_FIELDS = ("name", "image", "description", "offers")+_REQUIRED_OFFER_FIELDS = ("price", "priceCurrency", "availability")+_REQUIRED_RETURN_POLICY_FIELDS = (+ "applicableCountry",+ "returnPolicyCategory",+)+_REQUIRED_SHIPPING_FIELDS = (+ "shippingDestination",+ "deliveryTime",+)+++def _iter_typed(payload, target_type: str):+ """Yield every dict in ``payload`` whose @type matches ``target_type``."""+ if isinstance(payload, dict):+ kind = payload.get("@type")+ if isinstance(kind, str) and kind == target_type:+ yield payload+ elif isinstance(kind, list) and target_type in kind:+ yield payload+ for v in payload.values():+ yield from _iter_typed(v, target_type)+ elif isinstance(payload, list):+ for v in payload:+ yield from _iter_typed(v, target_type)+++def _all_types(payload) -> list[str]:+ types: list[str] = []+ if isinstance(payload, dict):+ kind = payload.get("@type")+ if isinstance(kind, str):+ types.append(kind)+ elif isinstance(kind, list):+ types.extend(t for t in kind if isinstance(t, str))+ for v in payload.values():+ types.extend(_all_types(v))+ elif isinstance(payload, list):+ for v in payload:+ types.extend(_all_types(v))+ return types+++def validate(payload: dict | list, *, require_eu_energy: bool = False) -> dict:+ findings: list[dict] = []++ # 1. Deprecated rich-result type generation.+ for kind in _all_types(payload):+ if kind in _DEPRECATED_TYPES:+ findings.append({+ "severity": "Critical",+ "rule": "deprecated-type",+ "message": f"@type={kind!r}: {_DEPRECATED_TYPES[kind]}",+ })++ products = list(_iter_typed(payload, "Product"))+ if not products:+ findings.append({+ "severity": "High",+ "rule": "missing-product",+ "message": "No @type=\"Product\" block found in the JSON-LD.",+ })++ for prod in products:+ # 2. Required base Product fields.+ for field in _REQUIRED_PRODUCT_FIELDS:+ if field not in prod or prod[field] in (None, "", []):+ findings.append({+ "severity": "High",+ "rule": f"missing-product-{field}",+ "message": f"Product is missing required {field!r}.",+ })++ # 3. Offers must include price, currency, availability.+ offers = prod.get("offers", [])+ if isinstance(offers, dict):+ offers_list = [offers]+ elif isinstance(offers, list):+ offers_list = offers+ else:+ offers_list = []++ for offer in offers_list:+ if not isinstance(offer, dict):+ continue+ for field in _REQUIRED_OFFER_FIELDS:+ if field not in offer or offer[field] in (None, "", []):+ findings.append({+ "severity": "High",+ "rule": f"missing-offer-{field}",+ "message": f"Offer is missing required {field!r}.",+ })++ # 4. hasMerchantReturnPolicy (required for merchant listings).+ return_policy = prod.get("hasMerchantReturnPolicy") or (+ offers_list[0].get("hasMerchantReturnPolicy") if offers_list else None+ )+ if not return_policy:+ findings.append({+ "severity": "High",+ "rule": "missing-return-policy",+ "message": "Product (or its Offer) is missing "+ "hasMerchantReturnPolicy — required for Google "+ "merchant listing eligibility.",+ })+ elif isinstance(return_policy, dict):+ for field in _REQUIRED_RETURN_POLICY_FIELDS:+ if field not in return_policy:+ findings.append({+ "severity": "Medium",+ "rule": f"return-policy-{field}",+ "message": f"MerchantReturnPolicy is missing {field!r}.",+ })++ # 5. shippingDetails (required for merchant listings).+ shipping = prod.get("shippingDetails") or (+ offers_list[0].get("shippingDetails") if offers_list else None+ )+ if not shipping:+ findings.append({+ "severity": "High",+ "rule": "missing-shipping-details",+ "message": "Product (or its Offer) is missing "+ "shippingDetails — required for Google merchant "+ "listing eligibility.",+ })+ elif isinstance(shipping, dict):+ for field in _REQUIRED_SHIPPING_FIELDS:+ if field not in shipping:+ findings.append({+ "severity": "Medium",+ "rule": f"shipping-{field}",+ "message": f"OfferShippingDetails is missing {field!r}.",+ })++ # 6. Loyalty / MemberProgram visibility (Medium).+ if not prod.get("hasMemberProgram") and not any(+ o.get("priceSpecification", {}).get("@type") == "UnitPriceSpecification"+ and o.get("priceSpecification", {}).get("validForMemberTier")+ for o in offers_list if isinstance(o, dict)+ ):+ findings.append({+ "severity": "Medium",+ "rule": "missing-member-program",+ "message": "No MemberProgram or loyalty-tier pricing declared. "+ "Add hasMemberProgram for visibility of loyalty "+ "pricing in Google Shopping.",+ })++ # 7. EU energy label (only fires if --eu flag is set).+ if require_eu_energy and "energyEfficiencyClass" not in prod:+ findings.append({+ "severity": "High",+ "rule": "missing-eu-energy-class",+ "message": "EU mode: in-scope products require "+ "energyEfficiencyClass per EPREL regulation.",+ })++ # 8. ProductGroup variant guidance — emit as Info if a Product is found+ # without any variant declaration.+ has_product_group = bool(list(_iter_typed(payload, "ProductGroup")))+ if products and not has_product_group:+ findings.append({+ "severity": "Info",+ "rule": "no-product-group",+ "message": "Consider ProductGroup if the product has size/colour "+ "variants — Google increasingly enforces this for "+ "apparel.",+ })++ severities = [f["severity"] for f in findings]+ return {+ "ok": all(s not in ("Critical", "High") for s in severities),+ "findings": findings,+ "summary": {+ "critical": severities.count("Critical"),+ "high": severities.count("High"),+ "medium": severities.count("Medium"),+ "info": severities.count("Info"),+ },+ }+++def main() -> int:+ parser = argparse.ArgumentParser(+ description="Validate Product JSON-LD against Google merchant rules."+ )+ parser.add_argument("source", nargs="?", default="-",+ help="JSON-LD file path or '-' for stdin (default '-').")+ parser.add_argument("--eu", action="store_true",+ help="Require energyEfficiencyClass (EPREL scope).")+ parser.add_argument("--json", action="store_true")+ args = parser.parse_args()++ raw = sys.stdin.read() if args.source == "-" \+ else Path(args.source).read_text(encoding="utf-8")++ try:+ payload = json.loads(raw)+ except json.JSONDecodeError as exc:+ print(f"Error: invalid JSON ({exc})", file=sys.stderr)+ return 2++ result = validate(payload, require_eu_energy=args.eu)++ if args.json:+ json.dump(result, sys.stdout, indent=2)+ sys.stdout.write("\n")+ else:+ status = "PASS" if result["ok"] else "FAIL"+ s = result["summary"]+ print(f"Status: {status} ({s['critical']} critical, {s['high']} high, "+ f"{s['medium']} medium, {s['info']} info)")+ for f in result["findings"]:+ print(f" [{f['severity']:<8}] {f['rule']}: {f['message']}")++ return 0 if result["ok"] else 1+++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/schema_generate.py b/scripts/schema_generate.pynew file mode 100644index 0000000..dcd87d9--- /dev/null+++ b/scripts/schema_generate.py@@ -0,0 +1,349 @@+#!/usr/bin/env python3+"""+JSON-LD generators for the four high-leverage v2 Schema.org types:++ - Reservation (FoodEstablishmentReservation, etc.)+ - OrderAction (an "Order this" potentialAction)+ - DiscussionForumPosting (community/forum content — promoted to+ first-class rich result in 2024)+ - ProfilePage (author/entity pages with sameAs + knowsAbout+ for AI citation entity graphs)++Per the v2 gap analysis (May 2026):+ - AI Mode now executes restaurant reservations (Robby Stein, Google,+ 2025-08-21). Reservation + potentialAction markup matters more+ than it did in 2024.+ - The "Discussions and forums" SERP feature is live; sites that mark+ up community content with DiscussionForumPosting are eligible.+ - ProfilePage with sameAs / knowsAbout is the cheapest entity-graph+ builder for AI citation correlation.++Usage::++ python scripts/schema_generate.py reservation \\+ --provider "Marea NYC" --start 2026-06-04T19:30:00-04:00 \\+ --party-size 4 --reservation-id RX-12345++ python scripts/schema_generate.py order \\+ --merchant "Acme Pizza" --order-url https://acme.example/order++ python scripts/schema_generate.py discussion \\+ --headline "How do you score INP correctly?" \\+ --author "Sara Park" \\+ --url https://forum.example.com/t/123 \\+ --date 2026-05-12T14:00:00Z++ python scripts/schema_generate.py profile \\+ --name "Daniel Agrici" \\+ --url https://agricidaniel.com/about \\+ --same-as https://github.com/AgriciDaniel \\+ https://twitter.com/agricidaniel \\+ --knows-about "SEO" "Schema markup" "Core Web Vitals"++All generators emit JSON-LD with ``@context: https://schema.org`` and+absolute URLs, the same conventions Google's Rich Results Test enforces.+"""++from __future__ import annotations++import argparse+import json+import sys+from typing import Optional+++def reservation(+ provider: str,+ start: str,+ *,+ end: Optional[str] = None,+ party_size: Optional[int] = None,+ reservation_id: Optional[str] = None,+ reservation_for_name: Optional[str] = None,+ customer_name: Optional[str] = None,+ customer_email: Optional[str] = None,+ kind: str = "FoodEstablishmentReservation",+) -> dict:+ """Build a Reservation JSON-LD block. Defaults to FoodEstablishment."""+ payload: dict = {+ "@context": "https://schema.org",+ "@type": kind,+ "reservationStatus": "https://schema.org/ReservationConfirmed",+ "provider": {"@type": "Organization", "name": provider},+ "reservationFor": {+ "@type": "FoodEstablishment" if kind == "FoodEstablishmentReservation"+ else "Place",+ "name": reservation_for_name or provider,+ },+ "startTime": start,+ }+ if end:+ payload["endTime"] = end+ if party_size is not None:+ payload["partySize"] = int(party_size)+ if reservation_id:+ payload["reservationId"] = reservation_id+ if customer_name or customer_email:+ person: dict = {"@type": "Person"}+ if customer_name:+ person["name"] = customer_name+ if customer_email:+ person["email"] = customer_email+ payload["underName"] = person+ return payload+++def order_action(+ merchant: str,+ *,+ order_url: str,+ name: str = "Order online",+ accepted_payment_method: Optional[list[str]] = None,+ delivery_method: Optional[list[str]] = None,+) -> dict:+ """Build an OrderAction potentialAction block.++ Attach the result to a Product or Service via:++ {"@type": "Product", "potentialAction": <this dict>}+ """+ payload: dict = {+ "@context": "https://schema.org",+ "@type": "OrderAction",+ "name": name,+ "target": {+ "@type": "EntryPoint",+ "urlTemplate": order_url,+ "inLanguage": "en-US",+ "actionPlatform": [+ "https://schema.org/DesktopWebPlatform",+ "https://schema.org/MobileWebPlatform",+ ],+ },+ "deliveryMethod": delivery_method or [+ "https://schema.org/OnSitePickup",+ "https://schema.org/ParcelService",+ ],+ "priceSpecification": {+ "@type": "PriceSpecification",+ "eligibleTransactionVolume": {+ "@type": "PriceSpecification",+ "minPrice": 0,+ "priceCurrency": "USD",+ },+ },+ "merchant": {"@type": "Organization", "name": merchant},+ }+ if accepted_payment_method:+ payload["acceptedPaymentMethod"] = [+ {"@type": "PaymentMethod", "name": m}+ for m in accepted_payment_method+ ]+ return payload+++def discussion(+ headline: str,+ author: str,+ *,+ url: str,+ date_published: str,+ text: Optional[str] = None,+ date_modified: Optional[str] = None,+ interaction_count: Optional[dict] = None,+ comment_count: Optional[int] = None,+) -> dict:+ """Build a DiscussionForumPosting JSON-LD block."""+ payload: dict = {+ "@context": "https://schema.org",+ "@type": "DiscussionForumPosting",+ "headline": headline,+ "author": {"@type": "Person", "name": author},+ "datePublished": date_published,+ "url": url,+ "mainEntityOfPage": {"@type": "WebPage", "@id": url},+ }+ if text:+ payload["text"] = text+ if date_modified:+ payload["dateModified"] = date_modified+ if comment_count is not None:+ payload["commentCount"] = int(comment_count)+ if interaction_count:+ payload["interactionStatistic"] = [+ {+ "@type": "InteractionCounter",+ "interactionType": f"https://schema.org/{k}",+ "userInteractionCount": int(v),+ }+ for k, v in interaction_count.items()+ ]+ return payload+++def profile(+ name: str,+ *,+ url: str,+ description: Optional[str] = None,+ same_as: Optional[list[str]] = None,+ knows_about: Optional[list[str]] = None,+ works_for: Optional[str] = None,+ image: Optional[str] = None,+ job_title: Optional[str] = None,+) -> dict:+ """Build a ProfilePage JSON-LD block.++ sameAs + knowsAbout is the entity-graph helper recommended by the+ v2 gap analysis for AI citation correlation. Wikipedia, GitHub,+ LinkedIn, and ORCID URLs in sameAs disambiguate the person across+ knowledge graphs.+ """+ person: dict = {"@type": "Person", "name": name, "url": url}+ if description:+ person["description"] = description+ if same_as:+ person["sameAs"] = list(same_as)+ if knows_about:+ person["knowsAbout"] = list(knows_about)+ if works_for:+ person["worksFor"] = {"@type": "Organization", "name": works_for}+ if image:+ person["image"] = image+ if job_title:+ person["jobTitle"] = job_title++ return {+ "@context": "https://schema.org",+ "@type": "ProfilePage",+ "mainEntity": person,+ "url": url,+ }+++def _strip_nones(payload: dict) -> dict:+ """Recursively remove keys with value None — keeps the JSON-LD output+ tight without us writing manual ``if x is not None`` guards above."""+ if isinstance(payload, dict):+ return {k: _strip_nones(v) for k, v in payload.items() if v is not None}+ if isinstance(payload, list):+ return [_strip_nones(v) for v in payload]+ return payload+++def _print(payload: dict, args) -> int:+ cleaned = _strip_nones(payload)+ output = json.dumps(cleaned, indent=args.indent, ensure_ascii=False)+ if args.script_tag:+ print('<script type="application/ld+json">')+ print(output)+ print("</script>")+ else:+ print(output)+ return 0+++def main() -> int:+ parser = argparse.ArgumentParser(+ description="Schema.org JSON-LD generators for v2 high-leverage types."+ )+ parser.add_argument(+ "--indent", type=int, default=2,+ help="JSON indentation (default 2).",+ )+ parser.add_argument(+ "--script-tag", action="store_true",+ help="Wrap output in <script type=application/ld+json> for pasting.",+ )+ sub = parser.add_subparsers(dest="kind", required=True)++ res = sub.add_parser("reservation",+ help="FoodEstablishmentReservation et al.")+ res.add_argument("--provider", required=True)+ res.add_argument("--start", required=True, help="ISO 8601 startTime.")+ res.add_argument("--end")+ res.add_argument("--party-size", type=int)+ res.add_argument("--reservation-id")+ res.add_argument("--reservation-for-name")+ res.add_argument("--customer-name")+ res.add_argument("--customer-email")+ res.add_argument(+ "--reservation-kind", dest="reservation_kind",+ default="FoodEstablishmentReservation",+ choices=(+ "FoodEstablishmentReservation", "LodgingReservation",+ "RentalCarReservation", "TaxiReservation", "EventReservation",+ "TrainReservation", "FlightReservation",+ ),+ )++ ord_p = sub.add_parser("order", help="OrderAction (potentialAction).")+ ord_p.add_argument("--merchant", required=True)+ ord_p.add_argument("--order-url", required=True)+ ord_p.add_argument("--name", default="Order online")+ ord_p.add_argument("--accepted-payment-method", nargs="*", default=None)+ ord_p.add_argument("--delivery-method", nargs="*", default=None)++ disc = sub.add_parser("discussion", help="DiscussionForumPosting.")+ disc.add_argument("--headline", required=True)+ disc.add_argument("--author", required=True)+ disc.add_argument("--url", required=True)+ disc.add_argument("--date", dest="date_published", required=True)+ disc.add_argument("--text")+ disc.add_argument("--date-modified")+ disc.add_argument("--comment-count", type=int)+ disc.add_argument(+ "--likes", type=int, dest="likes", default=None,+ help="LikeAction count (interactionStatistic).",+ )++ prof = sub.add_parser("profile", help="ProfilePage with sameAs / knowsAbout.")+ prof.add_argument("--name", required=True)+ prof.add_argument("--url", required=True)+ prof.add_argument("--description")+ prof.add_argument("--same-as", nargs="*", default=None)+ prof.add_argument("--knows-about", nargs="*", default=None)+ prof.add_argument("--works-for")+ prof.add_argument("--image")+ prof.add_argument("--job-title")++ args = parser.parse_args()++ if args.kind == "reservation":+ payload = reservation(+ args.provider, args.start, end=args.end, party_size=args.party_size,+ reservation_id=args.reservation_id,+ reservation_for_name=args.reservation_for_name,+ customer_name=args.customer_name, customer_email=args.customer_email,+ kind=args.reservation_kind,+ )+ elif args.kind == "order":+ payload = order_action(+ args.merchant, order_url=args.order_url, name=args.name,+ accepted_payment_method=args.accepted_payment_method,+ delivery_method=args.delivery_method,+ )+ elif args.kind == "discussion":+ ic: dict | None = {"LikeAction": args.likes} if args.likes else None+ payload = discussion(+ args.headline, args.author, url=args.url,+ date_published=args.date_published,+ text=args.text, date_modified=args.date_modified,+ interaction_count=ic, comment_count=args.comment_count,+ )+ elif args.kind == "profile":+ payload = profile(+ args.name, url=args.url, description=args.description,+ same_as=args.same_as, knows_about=args.knows_about,+ works_for=args.works_for, image=args.image,+ job_title=args.job_title,+ )+ else: # pragma: no cover — argparse rejects unknown sub-commands+ parser.error(f"Unknown kind {args.kind!r}")+ return 2++ return _print(payload, args)+++if __name__ == "__main__":+ sys.exit(main())diff --git a/skills/seo-schema/references/deprecated-types-2024-2026.md b/skills/seo-schema/references/deprecated-types-2024-2026.mdnew file mode 100644index 0000000..9ed6fc5--- /dev/null+++ b/skills/seo-schema/references/deprecated-types-2024-2026.md@@ -0,0 +1,58 @@+# Deprecated Schema.org rich result types (2024–2026)++Authoritative reference for every rich result Google retired during the+2024–2025 cleanup. Whenever a user asks for one of these, the+`seo-schema` skill must explain that the type is deprecated and either+redirect to an active alternative or note that no replacement exists.++## Retired June 19, 2025++Announced at+[Simplifying our Search rich results](https://developers.google.com/search/blog/2025/06/simplifying-search-results)+(developers.google.com/search/blog).++| Type | Retired | Notes |+|---|---|---|+| **Vehicle Listing** (`@type: VehicleListing` / `Vehicle`) | June 2025 | No replacement. Google no longer renders dealer inventory rich cards. Use regular `Product` schema if the listing is sold online. |+| **Claim Review** (`@type: ClaimReview`) | June 2025 | No replacement. The fact-check rich result was the main consumer of ClaimReview; without it, the markup has no SERP effect. ClaimReview *the vocabulary* is still in schema.org, but Google ignores it. |+| **Estimated Salary** (`@type: EstimatedSalary` / `OccupationalAggregateRating`) | June 2025 | No replacement. `JobPosting` remains live for individual jobs. |+| **Learning Video** | June 2025 | No replacement. The generic `VideoObject` rich result still renders. |+| **Course Info carousel** | June 2025 | The carousel variant retired. The single-result `Course` rich card is still live. When asked for "Course Info", verify whether the user wants the carousel (dead) or the live single-result variant. |++## Retired July 31, 2025++| Type | Retired | Notes |+|---|---|---|+| **Special Announcement** (`@type: SpecialAnnouncement`) | July 2025 | The COVID-era emergency-info card was deprecated. No replacement. |++## Earlier (pre-v2 baseline) retirements++These are listed for completeness so the LLM doesn't suggest them.++| Type | Retired | Notes |+|---|---|---|+| **HowTo** (`@type: HowTo`) | September 2023 | Rich result removed from desktop and mobile. The vocabulary remains but produces no SERP feature. Some sites still use HowTo for AI citation legibility — that's a defensible reason to keep it, but flag it as "no SERP effect". |+| **FAQ** (`@type: FAQPage`) | August 2023 | Restricted to government and healthcare sites. For commercial sites: flag existing FAQPage as Info (not Critical) because it still helps AI/LLM citations; do **not** recommend adding new FAQPage for SERP benefit. |++## Replacement decision table++When generating schema, prefer these alternatives:++| Asked for | Replacement |+|---|---|+| `ClaimReview` | None — explain rich result is dead; suggest `Article` with `dateline` if news context. |+| `EstimatedSalary` | `JobPosting` with `baseSalary` for specific roles. |+| `LearningVideo` | `VideoObject` (still live). |+| `Course Info` carousel | Single `Course` rich card (still live). |+| `SpecialAnnouncement` | `Event` if time-bounded; otherwise `Article` or `WebPage`. |+| `VehicleListing` | `Product` with vehicle-specific properties. |+| `HowTo` (for SERP) | None — explain the rich result is dead. Suggest article structure with clear `<h2>` step headings if the goal is comprehension; ranking benefit is no longer schema-driven. |++## Primary sources++- Google retirement announcement (June 2025): https://developers.google.com/search/blog/2025/06/simplifying-search-results+- Special Announcement deprecation (July 2025): https://developers.google.com/search/blog+- HowTo retirement (September 2023): https://developers.google.com/search/blog/2023/09/structured-data-changes+- FAQ restriction (August 2023): https://developers.google.com/search/blog/2023/08/howto-faq-changes++Last verified against developers.google.com: 2026-05-17.diff --git a/tests/test_schema_v2.py b/tests/test_schema_v2.pynew file mode 100644index 0000000..d51f3a5--- /dev/null+++ b/tests/test_schema_v2.py@@ -0,0 +1,244 @@+"""+Tests for the v2 Checkpoint 4 schema scripts:+ scripts/schema_generate.py+ scripts/schema_ecommerce_validate.py++The deprecated-types reference file (skills/seo-schema/references/+deprecated-types-2024-2026.md) is documentation only and is exercised+indirectly: any retired type generated through schema_generate.py is+caught by the ecommerce validator's deprecated-type rule.+"""++from __future__ import annotations++import json+import os+import sys++import pytest++_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")+if _SCRIPTS not in sys.path:+ sys.path.insert(0, _SCRIPTS)++import schema_generate # noqa: E402+import schema_ecommerce_validate as ev # noqa: E402+++# ---------------------------------------------------------------------------+# schema_generate+# ---------------------------------------------------------------------------+++def test_reservation_default_is_food_establishment() -> None:+ r = schema_generate.reservation("Marea", "2026-06-04T19:30:00Z", party_size=4)+ assert r["@type"] == "FoodEstablishmentReservation"+ assert r["@context"] == "https://schema.org"+ assert r["provider"]["name"] == "Marea"+ assert r["partySize"] == 4+ assert r["reservationFor"]["@type"] == "FoodEstablishment"+++def test_reservation_kind_override() -> None:+ r = schema_generate.reservation(+ "Hilton NYC", "2026-08-12T15:00:00Z",+ kind="LodgingReservation",+ )+ assert r["@type"] == "LodgingReservation"+ assert r["reservationFor"]["@type"] == "Place"+++def test_reservation_includes_under_name_when_customer_provided() -> None:+ r = schema_generate.reservation(+ "Marea", "2026-06-04T19:30:00Z",+ customer_name="Daniel A", customer_email="[email protected]",+ )+ assert r["underName"]["@type"] == "Person"+ assert r["underName"]["name"] == "Daniel A"+ assert r["underName"]["email"] == "[email protected]"+++def test_order_action_includes_required_target() -> None:+ r = schema_generate.order_action("Acme Pizza",+ order_url="https://acme.example/order")+ assert r["@type"] == "OrderAction"+ assert r["target"]["@type"] == "EntryPoint"+ assert r["target"]["urlTemplate"] == "https://acme.example/order"+ assert "DesktopWebPlatform" in r["target"]["actionPlatform"][0]+++def test_discussion_includes_interaction_statistic_when_likes_set() -> None:+ r = schema_generate.discussion(+ "How do you score INP correctly?",+ "Sara Park",+ url="https://forum.example.com/t/123",+ date_published="2026-05-12T14:00:00Z",+ interaction_count={"LikeAction": 47},+ )+ assert r["@type"] == "DiscussionForumPosting"+ stats = r["interactionStatistic"]+ assert stats[0]["userInteractionCount"] == 47+ assert "LikeAction" in stats[0]["interactionType"]+++def test_profile_includes_same_as_and_knows_about() -> None:+ r = schema_generate.profile(+ "Daniel Agrici",+ url="https://agricidaniel.com/about",+ same_as=["https://github.com/AgriciDaniel", "https://orcid.org/0000-0000-0000-0000"],+ knows_about=["SEO", "Schema markup", "Core Web Vitals"],+ )+ assert r["@type"] == "ProfilePage"+ person = r["mainEntity"]+ assert person["sameAs"][0].startswith("https://github.com/")+ assert "SEO" in person["knowsAbout"]+++def test_strip_nones_removes_optional_missing_fields() -> None:+ r = schema_generate.profile(+ "X", url="https://x.example/",+ same_as=None, knows_about=None,+ )+ cleaned = schema_generate._strip_nones(r)+ assert "sameAs" not in cleaned["mainEntity"]+ assert "knowsAbout" not in cleaned["mainEntity"]+++def test_strip_nones_recurses_into_lists() -> None:+ payload = {"a": [{"b": None, "c": 1}, {"b": 2}]}+ cleaned = schema_generate._strip_nones(payload)+ assert cleaned == {"a": [{"c": 1}, {"b": 2}]}+++# ---------------------------------------------------------------------------+# schema_ecommerce_validate+# ---------------------------------------------------------------------------+++def _minimal_product() -> dict:+ return {+ "@context": "https://schema.org",+ "@type": "Product",+ "name": "Example",+ "image": "https://example.com/i.jpg",+ "description": "An example product.",+ "offers": [{+ "@type": "Offer",+ "price": 99.99,+ "priceCurrency": "USD",+ "availability": "https://schema.org/InStock",+ }],+ }+++def test_validate_flags_missing_return_policy() -> None:+ result = ev.validate(_minimal_product())+ rules = [f["rule"] for f in result["findings"]]+ assert "missing-return-policy" in rules+ assert "missing-shipping-details" in rules+ assert result["ok"] is False+++def test_validate_passes_when_return_policy_and_shipping_present() -> None:+ product = _minimal_product()+ product["offers"][0]["hasMerchantReturnPolicy"] = {+ "@type": "MerchantReturnPolicy",+ "applicableCountry": "US",+ "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",+ "merchantReturnDays": 30,+ }+ product["offers"][0]["shippingDetails"] = {+ "@type": "OfferShippingDetails",+ "shippingDestination": {"@type": "DefinedRegion", "addressCountry": "US"},+ "deliveryTime": {"@type": "ShippingDeliveryTime"},+ }+ product["hasMemberProgram"] = {"@type": "MemberProgram", "name": "Acme Rewards"}+ result = ev.validate(product)+ high = [f for f in result["findings"] if f["severity"] == "High"]+ assert high == []+ assert result["ok"] is True+++def test_validate_flags_deprecated_types() -> None:+ payload = {+ "@context": "https://schema.org",+ "@type": "ClaimReview",+ "claimReviewed": "x",+ }+ result = ev.validate(payload)+ rules = [f["rule"] for f in result["findings"]]+ assert "deprecated-type" in rules+++def test_validate_eu_mode_requires_energy_class() -> None:+ product = _minimal_product()+ product["offers"][0]["hasMerchantReturnPolicy"] = {"@type": "MerchantReturnPolicy"}+ product["offers"][0]["shippingDetails"] = {"@type": "OfferShippingDetails"}++ result = ev.validate(product, require_eu_energy=True)+ rules = [f["rule"] for f in result["findings"]]+ assert "missing-eu-energy-class" in rules++ product["energyEfficiencyClass"] = "A"+ result = ev.validate(product, require_eu_energy=True)+ rules = [f["rule"] for f in result["findings"]]+ assert "missing-eu-energy-class" not in rules+++def test_validate_emits_info_when_no_product_group() -> None:+ result = ev.validate(_minimal_product())+ info = [f for f in result["findings"] if f["severity"] == "Info"]+ assert any("ProductGroup" in f["message"] for f in info)+++def test_validate_finds_offers_when_offers_is_single_dict() -> None:+ product = _minimal_product()+ product["offers"] = product["offers"][0] # single dict, not list+ result = ev.validate(product)+ # Should still find the inner offer for return-policy / shipping checks.+ rules = [f["rule"] for f in result["findings"]]+ assert "missing-product-offers" not in rules+++def test_validate_no_product_block_at_all_fails_loudly() -> None:+ result = ev.validate({"@type": "Article", "headline": "x"})+ rules = [f["rule"] for f in result["findings"]]+ assert "missing-product" in rules+++def test_validate_summary_counts_severities() -> None:+ result = ev.validate(_minimal_product())+ s = result["summary"]+ assert s["high"] >= 2 # missing return policy + shipping+ assert s["critical"] >= 0+ assert sum(s.values()) == len(result["findings"])+++# ---------------------------------------------------------------------------+# deprecated-types reference file+# ---------------------------------------------------------------------------+++def test_deprecated_types_reference_exists_and_lists_retired_kinds() -> None:+ from pathlib import Path++ ref = (+ Path(__file__).resolve().parents[1]+ / "skills" / "seo-schema" / "references"+ / "deprecated-types-2024-2026.md"+ )+ assert ref.is_file(), f"reference file missing: {ref}"+ text = ref.read_text(encoding="utf-8")+ for retired in (+ "Vehicle Listing",+ "Claim Review",+ "Estimated Salary",+ "Learning Video",+ "Course Info",+ "Special Announcement",+ "HowTo",+ "FAQ",+ ):+ assert retired in text, f"reference must mention {retired!r}"+ # Primary source must be linked.+ assert "developers.google.com/search/blog/2025/06/simplifying-search-results" in text