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.
fix: reject malformed JSON-LD @type values
惠岩4c2c53e23705
diff --git a/hooks/validate-schema.py b/hooks/validate-schema.pyindex 49b4c74..c008899 100755--- a/hooks/validate-schema.py+++ b/hooks/validate-schema.py@@ -191,7 +191,13 @@ def validate_jsonld(content: str, filepath: str = "") -> List[str]:def _validate_schema_object(obj: dict[str, Any], block_num: int, *, inherited_context: bool = False) -> List[str]:- """Validate one schema node, including members of a top-level ``@graph``."""+ """Validate one schema node, including members of a top-level ``@graph``.++ @param obj: JSON-LD node to validate.+ @param block_num: Script block number used in diagnostics.+ @param inherited_context: Whether the node inherits its context from a graph.+ @returns: Validation errors and warnings for the node and its graph members.+ """errors = []prefix = f"Block {block_num}"@@ -217,10 +223,22 @@ def _validate_schema_object(for placeholder in BARE_PLACEHOLDER_RE.findall(text):errors.append(f"{prefix}: Contains placeholder text: {placeholder}")- # Check for deprecated types. Schema.org permits multiple values in @type.- raw_schema_type = obj.get("@type", "")+ # Schema.org permits multiple string values, but malformed values must not+ # disappear silently before type-specific checks run.+ raw_schema_type = obj.get("@type")schema_types = raw_schema_type if isinstance(raw_schema_type, list) else [raw_schema_type]- schema_types = [schema_type for schema_type in schema_types if isinstance(schema_type, str)]+ if "@type" in obj and (+ not schema_types+ or any(not isinstance(schema_type, str) or not schema_type.strip() for schema_type in schema_types)+ ):+ errors.append(+ f"{prefix}: @type must be a non-empty string or a non-empty list of non-empty strings"+ )+ schema_types = [+ schema_type+ for schema_type in schema_types+ if isinstance(schema_type, str) and schema_type.strip()+ ]deprecated = {"HowTo": "deprecated September 2023","SpecialAnnouncement": "deprecated July 31, 2025",diff --git a/tests/test_schema_hook_policy.py b/tests/test_schema_hook_policy.pyindex 8f4e67d..e173c77 100644--- a/tests/test_schema_hook_policy.py+++ b/tests/test_schema_hook_policy.py@@ -103,6 +103,30 @@ def test_schema_type_array_is_validated_without_crashing(tmp_path: Path) -> Noneassert _clean(result)+def test_schema_type_rejects_malformed_values(tmp_path: Path) -> None:+ """Report malformed @type values instead of silently accepting them.++ @param tmp_path: Pytest-managed directory for temporary HTML fixtures.+ @returns: None.+ """+ invalid_types = [+ 1,+ {"@id": "Organization"},+ [],+ [1],+ ["Organization", 1],+ "",+ ]+ for schema_type in invalid_types:+ payload = {+ "@context": "https://schema.org",+ "@type": schema_type,+ "name": "Example",+ }+ result = _run_payload(tmp_path, payload, capture_output=True, encoding="utf-8")+ assert "@type" in _warnings(result), schema_type++def test_deprecated_type_inside_array_is_still_blocked(tmp_path: Path) -> None:payload = {"@context": "https://schema.org",