Skip to content

siril9/presentation-skill / plugins/presentation-skill/skills/presentation-skill

presentation-skill

Flagged

Build, edit, redesign, render, and verify content-led, structurally diverse, clean, editable, reproducible PowerPoint `.pptx` decks. Use for scientific, lab, clinical, consulting, board, investor, editorial, policy, and operational presentations where alignment, readability, contrast, and balanced density matter.

FileKindSize
DESIGN.mdmarkdown13.7 KB
DISCOVERY.mdmarkdown6.6 KB
LICENSEother1.0 KB
SKILL.mdskill md14.7 KB
agents/discovery.jsonconfig8.2 KB
agents/openai.yamlconfig309 B
examples/outline.jsonconfig3.4 KB
package-lock.jsonmanifest22.0 KB
package.jsonmanifest1.8 KB
references/agent_picker.mdmarkdown1.9 KB
references/alignment_and_coherence.mdmarkdown2.1 KB
references/assets/visual_references/editorial_chart.jpgbinary53.2 KB
references/assets/visual_references/editorial_decision.jpgbinary100.4 KB
references/assets/visual_references/editorial_focal_metric.jpgbinary45.4 KB
references/assets/visual_references/editorial_pilot.jpgbinary62.0 KB
references/assets/visual_references/lab-native-method.jpgbinary53.9 KB
references/assets/visual_references/lab-residual-panels.jpgbinary64.8 KB
references/assets/visual_references/lab_cover.jpgbinary39.8 KB
references/assets/visual_references/lab_endpoints.jpgbinary70.8 KB
references/assets/visual_references/lab_evidence_gate.jpgbinary67.3 KB
references/assets/visual_references/lab_trend.jpgbinary60.5 KB
references/assets/visual_references/operations_handoffs.jpgbinary87.2 KB
references/assets/visual_references/operations_owner_register.jpgbinary87.2 KB
references/assets/visual_references/operations_queue.jpgbinary81.8 KB
references/assets/visual_references/operations_tradeoff.jpgbinary99.9 KB
references/benchmark_protocol.mdmarkdown12.1 KB
references/codex_guardrails.mdmarkdown10.3 KB
references/composition_grammar_catalog.mdmarkdown4.0 KB
references/deck_creation.mdmarkdown1.4 KB
references/deck_workspace_mode.mdmarkdown34.4 KB
references/design_philosophy.mdmarkdown5.5 KB
references/dynamic_design_and_subagents.mdmarkdown12.3 KB
references/editing.mdmarkdown12.4 KB
references/external_best_practices.mdmarkdown1.7 KB
references/large_style_corpus_sources.jsonconfig22.7 KB
references/model_adaptive_workflow.mdmarkdown6.6 KB
references/outline_schema.mdmarkdown44.8 KB
references/planning_schema.mdmarkdown54.8 KB
references/pptxgenjs.mdmarkdown7.6 KB
references/preview_extension.mdmarkdown1.7 KB
references/reference_script_patterns.mdmarkdown13.5 KB
references/renderer_role_contracts_v2.jsonconfig38.2 KB
references/reproducible_workflow.mdmarkdown5.1 KB
references/speed_and_rendering.mdmarkdown4.6 KB
references/style_grammar_index.jsonconfig364.2 KB
references/style_inspiration_corpus.jsonconfig32.9 KB
references/style_reference_catalog.mdmarkdown23.9 KB
references/style_reference_sources.jsonconfig35.8 KB
references/style_token_atlas.jsonconfig174.7 KB
references/subagent_patterns.mdmarkdown10.2 KB
references/visual_qa_prompt.mdmarkdown4.9 KB
references/visual_reference_catalog.jsonconfig26.6 KB
references/visual_reference_catalog.mdmarkdown6.0 KB
schemas/deck_ir.schema.jsonconfig9.5 KB
schemas/renderer_capabilities_v2.jsonconfig701 B
scripts/accessibility_qa.pyscript24.8 KB
scripts/action_registry.pyscript12.5 KB
scripts/add_slide.pyscript8.6 KB
scripts/advance_delivery.pyscript88.2 KB
scripts/advance_workspace.pyscript150.3 KB
scripts/apply_artifact_manifest_bindings.pyscript54.1 KB
scripts/apply_atom_composition.pyscript8.2 KB
scripts/apply_data_analysis_handoff.pyscript67.0 KB
scripts/apply_deck_intake_answers.pyscript35.6 KB
scripts/apply_design_contract.pyscript71.7 KB
scripts/apply_outline_authoring_handoff.pyscript23.7 KB
scripts/apply_pptx_style_fragment.pyscript19.7 KB
scripts/asset_stage.pyscript24.6 KB
scripts/audition_styles.pyscript8.7 KB
scripts/benchmark_decks.pyexecutablescript45.4 KB
scripts/build_deck.pyexecutablescript173.6 KB
scripts/build_deck_pptxgenjs.jsexecutablescript72.7 KB
scripts/build_large_style_corpus_contact_sheets.pyscript18.1 KB
scripts/build_workspace.pyscript126.2 KB
scripts/clean_unpacked.pyscript12.9 KB
scripts/compact_source_footers.pyscript17.8 KB
scripts/composition_grammar_catalog.pyscript30.3 KB
scripts/deck_benchmark.pyscript71.1 KB
scripts/deck_intake.pyscript6.9 KB
scripts/deck_ir.pyscript47.5 KB
scripts/design_catalog_selector.pyscript17.4 KB
scripts/design_rules_qa.pyscript24.8 KB
scripts/design_tokens.pyscript20.3 KB
scripts/edit_deck.pyscript8.4 KB
scripts/emit_content_research.pyscript4.6 KB
scripts/emit_data_analysis_prompt.pyscript30.1 KB
scripts/emit_deck_intake_prompt.pyexecutablescript19.9 KB
scripts/emit_deck_start_packet.pyscript97.1 KB
scripts/emit_design_contract_prompt.pyscript66.2 KB
scripts/emit_outline_authoring_prompt.pyscript35.4 KB
scripts/emit_outline_critique.pyscript11.6 KB
scripts/emit_style_content_router.pyscript49.6 KB
scripts/extract_outline.pyexecutablescript4.1 KB
scripts/extract_pptx_style.pyscript33.2 KB
scripts/fetch_wikimedia_cc.pyscript8.6 KB
scripts/finalize_quick_deck.pyscript17.6 KB
scripts/generate_openai_image.pyscript5.6 KB
scripts/init_deck_workspace.pyscript74.4 KB
scripts/inspect_artifact_manifest.pyscript29.8 KB
scripts/inventory.pyscript10.6 KB
scripts/iterate_deck.pyexecutablescript10.2 KB
scripts/layout_lint.pyscript40.4 KB
scripts/log_skill_telemetry.pyscript6.9 KB
scripts/model_adaptive_workflow.pyscript28.0 KB
scripts/office_package_hash.pyscript1.6 KB
scripts/pack_pptx.pyscript5.7 KB
scripts/palette_from_topic.pyscript4.1 KB
scripts/plan_research_assets.pyscript13.1 KB
scripts/preflight.pyscript136.9 KB
scripts/present.pyscript9.6 KB
scripts/python_runtime.pyscript787 B
scripts/qa_gate.pyexecutablescript27.4 KB
scripts/qa_visual_gate.pyexecutablescript8.5 KB
scripts/reference_deck.pyscript12.7 KB
scripts/render_cache.pyscript3.9 KB
scripts/render_mermaid.pyscript8.9 KB
scripts/render_slides.pyexecutablescript19.4 KB
scripts/repair_packet.pyscript14.7 KB
scripts/report_delivery_readiness.pyscript107.6 KB
scripts/report_workspace_readiness.pyscript244.6 KB
scripts/requirements-runtime.txtmarkdown472 B
scripts/role_layout_contracts.pyscript10.6 KB
scripts/runtime_doctor.pyscript6.3 KB
scripts/scaffold_figure_artifacts.pyscript92.3 KB
scripts/source_fidelity.pyscript30.5 KB
scripts/structural_diversity_v2.pyscript32.5 KB
scripts/style_atom_router.pyscript14.5 KB
scripts/style_inspiration_corpus.pyscript15.1 KB
scripts/style_reference_catalog.pyscript142.8 KB
scripts/style_reference_sources.pyscript12.7 KB
scripts/style_treatment_profiles.pyscript26.0 KB
scripts/summarize_skill_log.pyscript7.0 KB
scripts/taste_grammar_catalog.pyscript27.0 KB
scripts/test_structural_diversity_v2.pyscript4.9 KB
scripts/text_fit.pyscript23.6 KB
scripts/thumbnail.pyscript9.2 KB
scripts/trim_image_whitespace.pyexecutablescript5.4 KB
scripts/unpack_pptx.pyscript8.3 KB
scripts/upgrade_renderer_role_contracts_v2.pyscript7.3 KB
scripts/validate_planning.pyscript169.2 KB
scripts/verify_narration.pyscript10.6 KB
scripts/visual_qa.pyscript7.7 KB
scripts/visual_review.pyscript41.1 KB
scripts/visual_review_receipt.pyscript8.3 KB
scripts/workflow_atom_context.pyscript17.3 KB
templates/pptxgenjs/README.mdmarkdown8.4 KB
templates/pptxgenjs/presets.jsscript5.6 KB
templates/pptxgenjs/readable_role_layouts.jsscript17.5 KB
templates/pptxgenjs/render_plan.jsscript12.6 KB
templates/pptxgenjs/role_layout_contracts.jsscript4.7 KB
templates/pptxgenjs/slides.jsscript451.0 KB
templates/pptxgenjs/space_allocation.jsscript1.6 KB

scripts/source_fidelity.py

View on GitHub
"""Cheap source-retention checks, not fact checking or rendered visibility proof.

Only renderer-declared visible fields are mapped. Speaker notes, style metadata,
optional reference headers and chart formatting are deliberately not searched.
"""

from __future__ import annotations

import json
import math
from pathlib import Path
import re
import unicodedata


NS = {
    "a": "http://schemas.openxmlformats.org/drawingml/2006/main",
    "c": "http://schemas.openxmlformats.org/drawingml/2006/chart",
}
SCOPE = "Retained mapped source content only; not factual truth or rendered visibility."


def _text(value):
    if isinstance(value, dict):
        return _text(value.get("text", value.get("runs", "")))
    if isinstance(value, list):
        # Rich runs are adjacent, not separate words. Formatting is not content.
        return "".join(_text(item) + (" " if isinstance(item, dict) and
                       item.get("options", {}).get("breakLine") else "") for item in value)
    return "" if value is None else str(value)


def canonical_text(value):
    text = unicodedata.normalize("NFKC", _text(value)).casefold()
    # Table readouts and reference registers reflow newlines with separators.
    text = text.translate(str.maketrans({"\u00b7": " ", "|": " ", "\u2022": " "}))
    return re.sub(r"\s+", " ", text).strip()


def _shapes(shapes):
    for shape in shapes:
        if hasattr(shape, "shapes"):
            yield from _shapes(shape.shapes)
        else:
            yield shape


def _paragraphs(root):
    return [canonical_text("".join(
        " " if child.tag == f"{{{NS['a']}}}br" else (child.text or "")
        for child in paragraph.iter()
        if child.tag in {f"{{{NS['a']}}}t", f"{{{NS['a']}}}br"}
    )) for paragraph in root.findall(".//a:p", NS)]


def _native_content(slide):
    text, charts = [], []
    for shape in _shapes(slide.shapes):
        text.extend(_paragraphs(shape._element))
        if getattr(shape, "has_chart", False):
            chart = shape.chart._chartSpace
            charts.append(chart)
            # Axis titles/labels are visible text; c:v caches are data, not prose.
            text.extend(_paragraphs(chart))
    return " ".join(item for item in text if item), charts


def _first(node, keys):
    return next((key for key in keys if node.get(key)), None)


def _resolve(candidate, pointer, outline_path, *, asset_root=None, path_only=False):
    """Return payload and provenance without replacing the original pointer."""
    if isinstance(candidate, dict):
        return None if path_only else (candidate, str(outline_path), pointer)
    if not isinstance(candidate, str):
        raise ValueError("source payload must be an object or JSON reference")
    root = asset_root if asset_root is not None else outline_path.parent
    if re.match(r"^(asset|image|background|chart|table|generated):", candidate, re.I):
        for manifest in (root / "assets/staged/staged_manifest.json",
                         root / "asset_plan.json"):
            if not manifest.exists():
                continue
            payload = json.loads(manifest.read_text(encoding="utf-8"))
            for section, prefixes in (("images", ("asset", "image")),
                                      ("backgrounds", ("asset", "background")),
                                      ("charts", ("asset", "chart")),
                                      ("tables", ("asset", "table")),
                                      ("generated_images", ("asset", "image", "generated"))):
                for index, entry in enumerate(payload.get(section, [])):
                    name = re.sub(r"[^A-Za-z0-9_-]", "_", str(entry.get("name", ""))).strip("_").lower()
                    if candidate.lower().split(":", 1)[1] != name:
                        continue
                    if candidate.lower().split(":", 1)[0] not in prefixes:
                        continue
                    path_key = _first(entry, ("path", "file_path", "output_path", "image_path"))
                    if not path_key:
                        return None if path_only else (entry, str(manifest), f"/{section}/{index}")
                    candidate = entry[path_key]
                    break
                else:
                    continue
                break
            else:
                continue
            break
        else:
            raise ValueError(f"unresolved source alias: {candidate}")
    path = Path(candidate).expanduser()
    path = (root / path).resolve() if not path.is_absolute() else path.resolve()
    if path_only:
        return path
    payload = json.loads(path.read_text(encoding="utf-8"))
    if not isinstance(payload, dict):
        raise ValueError(f"source payload must be an object: {path}")
    return payload, str(path), ""


def _effective_variant(spec, resolve, outline_path, base, asset_root=None):
    """Mirror normalizeSlide + resolveVariant routing without rendering assets."""
    slide_type = str(spec.get("type") or "content").strip().lower()
    if slide_type in {"title", "section"}:
        return slide_type
    assets = spec.get("assets") if isinstance(spec.get("assets"), dict) else {}
    variant = str(spec.get("variant") or "standard").strip().lower()

    def existing_asset(candidate):
        try:
            path = _resolve(candidate, "", outline_path, asset_root=asset_root, path_only=True)
            return path is not None and path.exists()
        except (OSError, ValueError, TypeError):
            return False

    def source(container, keys, prefix):
        for key in keys:
            if container.get(key):
                try:
                    return resolve(container[key], prefix + "/" + key)[0]
                except (OSError, ValueError, TypeError):
                    continue
        return {}

    def count(key):
        return len(spec[key]) if isinstance(spec.get(key), list) else 0

    if variant in {"standard", "content", "flow"} and (spec.get("flow_steps") or any(
        existing_asset(assets.get(key)) for key in ("diagram", "mermaid_source", "mermaid") if assets.get(key)
    )):
        variant = "flow"
    if slide_type in {"content", "text"} and variant in {"standard", "content"}:
        chart = source(spec, ("chart",), base) or source(assets, ("chart_data", "chart"), base + "/assets")
        facts = spec.get("facts", [])
        if not isinstance(facts, list) or not facts:
            if not any(isinstance(spec.get(key), list) for key in ("facts", "stats")):
                facts = chart.get("facts", chart.get("stats", []))
        table = source(spec, ("table", "table_data"), base) or source(assets, ("table_data", "table"), base + "/assets")
        valid_table = isinstance(table.get("headers"), list) and bool(table["headers"]) and bool(table.get("rows"))
        groups = next((container[key] for container, key in ((spec, "tables"), (spec, "table_groups"), (assets, "tables"))
                       if isinstance(container.get(key), list)), [])
        if count("cards") >= 2:
            variant = "cards-3" if count("cards") >= 3 else "cards-2"
        elif count("milestones") >= 2:
            variant = "timeline"
        elif count("quadrants") >= 4:
            variant = "matrix"
        elif isinstance(facts, list) and len(facts) >= 2:
            variant = "stats"
        elif isinstance(spec.get("headers"), list) or count("rows") or valid_table:
            variant = "table"
        elif groups:
            variant = "lab-run-results"
        elif str(spec.get("visual_intent", "")).strip().lower() == "comparison" and isinstance(spec.get("left"), dict) and isinstance(spec.get("right"), dict):
            variant = "comparison-2col"
        elif str(spec.get("visual_intent", "")).strip().lower() == "data" and chart:
            variant = "chart"
    if slide_type in {"content", "text"} and variant != "generated-image" and (
        variant == "image-sidebar" or str(spec.get("visual_intent", "")).strip().lower() in {"hero", "image", "figure"}
    ) and existing_asset(assets.get("hero_image") or assets.get("image")):
        variant = "image-sidebar"
    if variant in {"content", "standard"}:
        return "standard"
    if variant == "comparison":
        return "comparison-2col"
    return variant if variant in {"cards-2", "cards-3", "split", "timeline", "stats", "kpi-hero", "table",
                                  "lab-run-results", "comparison-2col", "matrix", "flow", "chart", "image-sidebar",
                                  "scientific-figure", "generated-image"} else "standard"


def _number(value):
    # Same supported normalization as the JS chart renderer: commas and %.
    text = str(value).strip().replace(",", "").removesuffix("%")
    number = float(text)
    if not math.isfinite(number):
        raise ValueError("non-finite chart value")
    return number


def _points(series, kind):
    nodes = series.findall(f"./c:{kind}//c:pt", NS)
    return [node.findtext("c:v", default="", namespaces=NS)
            for node in sorted(nodes, key=lambda node: int(node.get("idx", "0")))]


def _chart_uses_v2(outline, spec, known_roles):
    """Only the chart:v2 adapter declares default-visible axis titles.

    Keep this to the persisted version pin and chart role boundary; geometry
    and the general render plan remain owned by the JS renderer.
    """
    style = outline.get("deck_style") if isinstance(outline.get("deck_style"), dict) else {}
    metadata = outline.get("metadata") if isinstance(outline.get("metadata"), dict) else {}
    v2 = style.get("renderer_role_contracts_v2")
    if not isinstance(v2, dict):
        v2 = metadata.get("renderer_role_contracts_v2")
    v1 = style.get("renderer_role_systems_v1")
    if not isinstance(v1, dict):
        v1 = metadata.get("renderer_role_systems_v1")
    if not isinstance(v2, dict) and isinstance(v1, dict) and v1:
        return False
    role = str(spec.get("role", "")).strip().lower()
    if role in known_roles and role not in {"chart", "graph", "plot", "data"}:
        return False
    if isinstance(v2, dict):
        chart = v2.get("roles", {}).get("chart", {})
        return bool(chart.get("slots", {}).get("chart"))
    # applyDeckStyle auto-resolves v2 when no persisted v1 pin exists.
    return True


def check_source_fidelity(prs, outline_path, asset_root=None):
    """Return issues compatible with design QA and its bounded repair packet."""
    if outline_path is None:
        return {"enabled": False, "scope": SCOPE, "checked_count": 0,
                "error_count": 0, "warning_count": 0, "issues": []}
    outline_path = Path(outline_path).expanduser().resolve()
    issues, checked, references = [], 0, []

    def issue(index, pointer, role, expected, actual, *, kind="text_missing",
              file=None, data_pointer=None, severity="error"):
        if file and file != str(outline_path):
            pointer = next((original for original, resolved in references
                            if resolved == file and (pointer == original or pointer.startswith(original + "/"))), pointer)
        issues.append({
            "type": f"source_fidelity_{kind}", "severity": severity,
            "slide_index": index, "source_pointer": pointer,
            "source_file": str(outline_path), "field_role": role,
            "source_data_file": file or str(outline_path),
            "source_data_pointer": data_pointer if data_pointer is not None else pointer,
            "expected_canonical": expected, "actual_canonical": actual,
            "suggested_fix": "Restore the declared visible source field or repair its renderer; rebuild and rerun QA. This checks retention, not factual truth.",
        })

    try:
        outline = json.loads(outline_path.read_text(encoding="utf-8"))
        if not isinstance(outline, dict) or not isinstance(outline.get("slides"), list):
            raise ValueError("outline must contain a slides array")
        resolved_outline = outline
        root = Path(asset_root).expanduser().resolve() if asset_root is not None else None
        # build_workspace writes this documented intermediate beside its build
        # outputs; renderer asset-root and repair pointers still use the source.
        manifest_path = outline_path.parent.parent / "workspace.json"
        if outline_path.name == "outline_resolved.json" and manifest_path.is_file():
            manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
            source_path = (manifest_path.parent / manifest.get("outline", "outline.json")).resolve()
            source = json.loads(source_path.read_text(encoding="utf-8"))
            if not isinstance(source, dict) or not isinstance(source.get("slides"), list):
                raise ValueError("workspace source outline must contain a slides array")
            if len(source["slides"]) != len(resolved_outline["slides"]):
                raise ValueError("source and resolved outlines have different slide counts")
            outline_path, outline = source_path, source
        if root is None:
            root = outline_path.parent
    except (OSError, ValueError) as exc:
        issue(None, "", "outline", "readable source outline", str(exc), kind="audit_failed")
        return {"enabled": True, "scope": SCOPE, "checked_count": 0,
                "error_count": 1, "warning_count": 0, "issues": issues}

    for index, spec in enumerate(outline["slides"]):
        base = f"/slides/{index}"
        if not isinstance(spec, dict):
            issue(index, base, "slide", "source slide object", spec, kind="audit_failed")
            continue
        source_cache = {}

        def resolve(candidate, pointer):
            if isinstance(candidate, dict):
                return _resolve(candidate, pointer, outline_path, asset_root=root)
            if pointer not in source_cache:
                source_cache[pointer] = _resolve(candidate, pointer, outline_path, asset_root=root)
                if source_cache[pointer][1] != str(outline_path):
                    references.append((pointer, source_cache[pointer][1]))
            return source_cache[pointer]

        rendered, charts = _native_content(prs.slides[index]) if index < len(prs.slides) else ("", [])
        effective_spec = resolved_outline["slides"][index]
        variant = _effective_variant(effective_spec, resolve, outline_path, base, root)
        role = str(spec.get("role", "")).strip().lower()
        reference_aliases = {"references", "reference", "source", "sources", "citation", "citations"}
        known_roles = reference_aliases | {"title", "section", "evidence", "comparison", "chart", "table", "decision", "data",
                                          "cover", "opener", "chapter", "divider", "message", "content", "figure", "image",
                                          "stats", "metric", "metrics", "process", "flow", "dashboard", "compare", "options",
                                          "graph", "plot", "ledger", "register", "recommendation", "recommend", "action", "actions", "conclusion"}
        reference_role = role in reference_aliases
        if role not in known_roles and variant in {"standard", "table", "matrix"}:
            intent = str(spec.get("slide_intent", "")).strip().lower()
            treatment = str(spec.get("treatment_key", "")).strip().lower()
            reference_role = intent in reference_aliases or treatment in reference_aliases

        def text(value, pointer, field_role, file=None, data_pointer=None):
            nonlocal checked
            expected = canonical_text(value)
            if not expected:
                return
            checked += 1
            # Word boundaries avoid treating 2 mg as retained inside 12 mg.
            left = r"(?<![\w.,+-])" if expected[0].isdigit() else r"(?<!\w)"
            right = r"(?![\w.,]\d|\w)" if expected[-1].isdigit() else r"(?!\w)"
            if not re.search(left + re.escape(expected) + right, rendered):
                issue(index, pointer, field_role, expected, rendered,
                      file=file, data_pointer=data_pointer)

        def fields(node, pointer, keys, field_role, file=None, data_base=None):
            for key in keys:
                if key in node:
                    text(node[key], f"{pointer}/{key}", field_role, file,
                         f"{data_base}/{key}" if data_base is not None else None)

        # Not a recursive exact-string crawl: slots have explicit role mappings.
        fields(spec, base, ("title", "subtitle"), "heading")
        is_chart = variant == "chart"
        is_table = variant in {"table", "lab-run-results"} or (variant == "standard" and reference_role)
        is_figure = variant in {"scientific-figure", "image-sidebar"}
        if "flow_steps" in spec:
            for offset, step in enumerate(spec["flow_steps"]):
                if isinstance(step, dict):
                    fields(step, f"{base}/flow_steps/{offset}", ("title", "detail"), "process_step")
            fields(spec, base, ("caption",), "caption")
            key = _first(spec, ("summary_callout", "key_summary", "takeaway"))
            if key:
                fields(spec, base, (key,), "caveat_readout")
        if variant == "standard" and not reference_role:
            bullets = spec.get("bullets", [])
            if isinstance(bullets, list) and bullets:
                fields(spec, base, ("body",), "body")
                for offset, bullet in enumerate(bullets):
                    text(bullet, f"{base}/bullets/{offset}", "body")
            elif isinstance(spec.get("paragraphs"), list) and spec["paragraphs"]:
                for offset, paragraph in enumerate(spec["paragraphs"]):
                    text(paragraph, f"{base}/paragraphs/{offset}", "body")
            else:
                fields(spec, base, ("body",), "body")
            key = _first(spec, ("summary_callout", "key_summary", "takeaway"))
            if key:
                fields(spec, base, (key,), "caveat_readout")
        if is_figure:
            key = _first(spec, ("caption", "figure_caption"))
            if key:
                fields(spec, base, (key,), "caption")
            key = _first(spec, ("interpretation", "takeaway"))
            if key:
                fields(spec, base, (key,), "caveat_readout")
            figures = spec.get("figures", spec.get("assets", {}).get("figures", []))
            figure_base = base + ("/figures" if "figures" in spec else "/assets/figures")
            # Sidebar renderers consume the slide caption, not a figure array.
            # Explicit v1 strip-readout has bare secondary thumbnails. Modern
            # scientific layouts retain every panel's authored caption.
            style = resolved_outline.get("deck_style")
            style = style if isinstance(style, dict) else {}
            legacy_figures = bool(style.get("role_systems")) and not style.get("renderer_role_contracts_v2")
            layout = str(effective_spec.get("figure_layout") or effective_spec.get("scientific_figure_layout")
                         or effective_spec.get("figure_treatment") or style.get("figure_layout")
                         or effective_spec.get("figure_table_treatment") or style.get("figure_table_treatment")
                         or "").strip().lower()
            if variant == "image-sidebar":
                figures = []
                for offset, section in enumerate(spec.get("sidebar_sections", [])):
                    if isinstance(section, dict):
                        pointer = f"{base}/sidebar_sections/{offset}"
                        key = _first(section, ("title", "label"))
                        if key:
                            fields(section, pointer, (key,), "figure_readout")
                        key = _first(section, ("body", "text"))
                        if key and isinstance(section[key], list):
                            for bullet, value in enumerate(section[key]):
                                text(value, f"{pointer}/{key}/{bullet}", "figure_readout")
                        elif key:
                            fields(section, pointer, (key,), "figure_readout")
                if not spec.get("sidebar_sections") and not legacy_figures:
                    fields(spec, base, ("body",), "figure_readout")
                    for key in ("bullets", "highlights"):
                        for offset, value in enumerate(spec.get(key, [])):
                            text(value, f"{base}/{key}/{offset}", "figure_readout")
            elif legacy_figures and layout in {"strip-readout", "strip_readout", "stats-strip", "metric-strip"}:
                figures = figures[:1]
            for offset, figure in enumerate(figures):
                if isinstance(figure, dict):
                    if not legacy_figures:
                        key = _first(figure, ("title", "heading"))
                        if key:
                            fields(figure, f"{figure_base}/{offset}", (key,), "figure_heading")
                    key = _first(figure, ("caption", "note"))
                    if key:
                        fields(figure, f"{figure_base}/{offset}", (key,), "figure_caption")
        if variant == "timeline":
            fields(spec, base, ("caption",), "caption")

        # Stats/detail is a visible evidence slot, not optional speaker notes.
        if variant in {"stats", "chart", "scientific-figure", "kpi-hero"}:
            fact_key = next((key for key in ("facts", "stats") if isinstance(spec.get(key), list)), None)
            if fact_key:
                for offset, fact in enumerate(spec[fact_key]):
                    if isinstance(fact, dict):
                        key = _first(fact, ("detail", "caption", "body", "text"))
                        if key:
                            fields(fact, f"{base}/{fact_key}/{offset}", (key,), "fact_caveat")
                    elif isinstance(fact, str):
                        text(fact, f"{base}/{fact_key}/{offset}", "fact_label")

        def payload(candidate, pointer):
            try:
                return resolve(candidate, pointer)
            except (OSError, ValueError, TypeError) as exc:
                issue(index, pointer, "source_payload", "resolvable JSON source", str(exc), kind="audit_failed")
                return {}, str(outline_path), pointer

        if is_table:
            group_key = _first(spec, ("tables", "table_groups"))
            if group_key:
                tables = [(item, f"{base}/{group_key}/{offset}")
                          for offset, item in enumerate(spec[group_key])]
            elif isinstance(spec.get("assets", {}).get("tables"), list):
                tables = [(item, f"{base}/assets/tables/{offset}")
                          for offset, item in enumerate(spec["assets"]["tables"])]
            else:
                tables = [(spec, base)]
                for container, prefix, keys in ((spec, base, ("table", "table_data")),
                                                (spec.get("assets", {}), base + "/assets", ("table_data", "table"))):
                    key = _first(container, keys)
                    if key:
                        tables = [(container[key], f"{prefix}/{key}")]
                        break
            for candidate, pointer in tables:
                table, file, data_base = payload(candidate, pointer)
                compaction = spec.get("source_footer_compaction") or {}
                reference_table = reference_role or spec.get("table_style", table.get("table_style")) == "references" or (isinstance(compaction, dict) and compaction.get("generated_by") == "scripts/compact_source_footers.py")
                # This adapter declares its source-note panel from table rows,
                # not the optional footnote/register-label metadata. The native
                # marker identifies the executed route without redoing routing.
                policy_register = reference_table and index < len(prs.slides) and any(
                    shape.name == "metadata:policy-accountability-register"
                    for shape in _shapes(prs.slides[index].shapes)
                )
                for key in ("caption", "footnotes", "headers", "rows"):
                    # A references register intentionally omits column headings.
                    # Its reformatted rows are outside this critical-field check.
                    if reference_table and key in {"headers", "rows"}:
                        continue
                    if policy_register and key == "footnotes":
                        continue
                    value, ptr, data_ptr = table.get(key), pointer + "/" + key, data_base + "/" + key
                    selected_file = file
                    if len(tables) == 1 and candidate is not spec and key in spec:
                        value, ptr, selected_file, data_ptr = spec[key], base + "/" + key, str(outline_path), base + "/" + key
                    # Preserve individual cell/footnote pointers, rich runs intact.
                    if key == "footnotes" and isinstance(value, list):
                        for offset, note in enumerate(value):
                            text(note, f"{ptr}/{offset}", "caveat", selected_file, f"{data_ptr}/{offset}")
                    elif key in {"headers", "rows"} and isinstance(value, list):
                        for row, item in enumerate(value):
                            cells = item if key == "rows" and isinstance(item, list) else [item]
                            for col, cell in enumerate(cells):
                                suffix = f"/{row}/{col}" if key == "rows" else f"/{row}"
                                text(cell, ptr + suffix, "table_cell", selected_file, data_ptr + suffix)
                    else:
                        text(value, ptr, "caption", selected_file, data_ptr)

        if is_chart:
            chart, pointer, file, data_base = {}, base + "/chart", str(outline_path), base + "/chart"
            for container, prefix, keys in ((spec, base, ("chart",)),
                                            (spec.get("assets", {}), base + "/assets", ("chart_data", "chart"))):
                key = _first(container, keys)
                if key:
                    pointer = f"{prefix}/{key}"
                    chart, file, data_base = payload(container[key], pointer)
                    break
            for key in ("title", "subtitle"):
                if not spec.get(key):
                    fields(chart, pointer, (key,), "heading", file, data_base)
            # Slide notes are speaker notes; chart notes are a visible readout
            # only if not replaced by an explicit slide readout.
            key = _first(spec, ("interpretation", "message", "caption"))
            if key:
                fields(spec, base, (key,), "caveat_readout")
            else:
                key = _first(chart, ("notes", "message", "caption"))
                if key:
                    fields(chart, pointer, (key,), "caveat_readout", file, data_base)
            options = chart.get("options") if isinstance(chart.get("options"), dict) else {}
            if _chart_uses_v2(resolved_outline, effective_spec, known_roles) and str(chart.get("type", "")).strip().lower() not in {"pie", "doughnut"}:
                for key, flag in (("catAxisTitle", "showCatAxisTitle"), ("valAxisTitle", "showValAxisTitle")):
                    if options.get(flag) is None or bool(options[flag]):
                        fields(options, pointer + "/options", (key,), "axis_unit", file, data_base + "/options")
            fact_key = next((key for key in ("facts", "stats") if isinstance(chart.get(key), list)), None)
            if not any(isinstance(spec.get(key), list) for key in ("facts", "stats")) and fact_key:
                for offset, fact in enumerate(chart[fact_key]):
                    if isinstance(fact, dict):
                        key = _first(fact, ("detail", "caption", "body", "text"))
                        if key:
                            fields(fact, f"{pointer}/{fact_key}/{offset}", (key,), "fact_caveat",
                                   file, f"{data_base}/{fact_key}/{offset}")
                    elif isinstance(fact, str):
                        text(fact, f"{pointer}/{fact_key}/{offset}", "fact_label",
                             file, f"{data_base}/{fact_key}/{offset}")
            series = chart.get("series")
            flat = not isinstance(series, list) or not series
            series = [{"values": chart.get("values", [])}] if flat else series
            actual = charts[0].findall(".//c:ser", NS) if charts else []
            checked += 1
            if not charts or len(actual) != len(series):
                issue(index, pointer, "native_chart", len(series), len(actual), kind="chart_series_mismatch",
                      file=file, data_pointer=data_base + ("/values" if flat else "/series"))
            for offset, source_series in enumerate(series):
                series_pointer = pointer if flat else f"{pointer}/series/{offset}"
                series_data = data_base if flat else f"{data_base}/series/{offset}"
                labels_key = _first(source_series, ("labels",))
                category_key = _first(chart, ("categories", "labels"))
                labels = source_series.get(labels_key) if labels_key else chart.get(category_key, [])
                for kind, values, ptr, data_ptr in (
                    ("values", source_series.get("values", []), series_pointer + "/values", series_data + "/values"),
                    ("categories", labels, series_pointer + "/labels" if labels_key else pointer + "/" + (category_key or "categories"),
                     series_data + "/labels" if labels_key else data_base + "/" + (category_key or "categories")),
                ):
                    checked += 1
                    node = actual[offset] if offset < len(actual) else None
                    try:
                        normalize = _number if kind == "values" else canonical_text
                        expected = [normalize(value) for value in values]
                        observed = [normalize(value) for value in _points(node, "val" if kind == "values" else "cat")] if node is not None else []
                        matches = len(expected) == len(observed) and all(
                            math.isclose(a, b, rel_tol=1e-12, abs_tol=1e-12) if kind == "values" else a == b
                            for a, b in zip(expected, observed))
                    except (ValueError, TypeError) as exc:
                        issue(index, ptr, "chart_" + kind, values, str(exc), kind="audit_failed", file=file, data_pointer=data_ptr)
                        continue
                    if not matches:
                        issue(index, ptr, "chart_" + kind, expected, observed,
                              kind="chart_" + kind + "_mismatch", file=file, data_pointer=data_ptr)

    return {"enabled": True, "scope": SCOPE, "checked_count": checked,
            "error_count": sum(item["severity"] == "error" for item in issues),
            "warning_count": sum(item["severity"] == "warning" for item in issues),
            "issues": issues}
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 197kUpdated Claude CodeCodexVerifiedInstall