Skip to content

PlutoLei/paperbanana-skill / plugins/paperbanana-slide-deck

paperbanana-slide-deck

Unverified

Create or revise a complete PaperBanana slide deck, including image slides and native editable PowerPoint text, tables, charts and diagrams. Use for PaperBanana deck requests; preserve the user's selected presentation tool and existing deck mode.

FileKindSize
.claude-plugin/plugin.jsonconfig396 B
.gitignoreother22 B
SKILL.mdskill md6.4 KB
bun.lockother4.5 KB
package.jsonmanifest424 B
references/editable-slide-spec.mdmarkdown9.0 KB
references/outline-format.mdmarkdown927 B
references/style-guide.mdmarkdown1.3 KB
references/styles/3d-model.mdmarkdown2.7 KB
references/styles/abstract.mdmarkdown2.5 KB
references/styles/academia.mdmarkdown2.5 KB
references/styles/adorable-3d-character.mdmarkdown2.5 KB
references/styles/afrofuturism.mdmarkdown2.8 KB
references/styles/alcohol-ink.mdmarkdown2.4 KB
references/styles/analog-film.mdmarkdown2.6 KB
references/styles/architectural.mdmarkdown2.4 KB
references/styles/art-deco.mdmarkdown2.5 KB
references/styles/art-nouveau.mdmarkdown2.5 KB
references/styles/artistic-vision.mdmarkdown2.7 KB
references/styles/avant-garde.mdmarkdown2.6 KB
references/styles/baroque.mdmarkdown2.4 KB
references/styles/bauhaus-style-poster.mdmarkdown2.5 KB
references/styles/bauhaus-style.mdmarkdown2.6 KB
references/styles/blueprint-schematic-drawing.mdmarkdown2.5 KB
references/styles/cel-shaded-art.mdmarkdown2.5 KB
references/styles/chromolithography.mdmarkdown2.4 KB
references/styles/cinematic-dynamic.mdmarkdown2.6 KB
references/styles/cinematic.mdmarkdown2.6 KB
references/styles/classicism-art.mdmarkdown2.5 KB
references/styles/collage.mdmarkdown2.4 KB
references/styles/color-field-painting.mdmarkdown2.6 KB
references/styles/color-sketchnote.mdmarkdown2.4 KB
references/styles/colored-pencil-art.mdmarkdown2.6 KB
references/styles/conceptual-art.mdmarkdown2.5 KB
references/styles/constructivism.mdmarkdown2.5 KB
references/styles/constructivist.mdmarkdown2.5 KB
references/styles/craft-clay.mdmarkdown2.7 KB
references/styles/cubism.mdmarkdown2.6 KB
references/styles/cubist.mdmarkdown2.5 KB
references/styles/cyanotype.mdmarkdown2.5 KB
references/styles/cyberpunk-cityscape.mdmarkdown2.4 KB
references/styles/de-stijl.mdmarkdown2.5 KB
references/styles/digital-art.mdmarkdown2.8 KB
references/styles/double-exposure.mdmarkdown2.6 KB
references/styles/dreamscape.mdmarkdown2.4 KB
references/styles/dynamic-illustration.mdmarkdown2.6 KB
references/styles/embroidery.mdmarkdown2.6 KB
references/styles/encaustic.mdmarkdown2.4 KB
references/styles/expressionism.mdmarkdown2.6 KB
references/styles/expressionist.mdmarkdown2.4 KB
references/styles/fairy-tale.mdmarkdown2.4 KB
references/styles/fashion-editorial.mdmarkdown2.3 KB
references/styles/film-noir.mdmarkdown2.4 KB
references/styles/flat-2d-art.mdmarkdown2.6 KB
references/styles/flat-papercut.mdmarkdown2.4 KB
references/styles/futurism.mdmarkdown2.6 KB
references/styles/futuristic.mdmarkdown2.4 KB
references/styles/glamour.mdmarkdown2.4 KB
references/styles/glitchcore.mdmarkdown2.6 KB
references/styles/gothic.mdmarkdown2.5 KB
references/styles/halftone.mdmarkdown2.4 KB
references/styles/hdr.mdmarkdown2.5 KB
references/styles/high-fashion.mdmarkdown2.6 KB
references/styles/hyperrealism.mdmarkdown2.5 KB
references/styles/idyllic.mdmarkdown2.6 KB
references/styles/illuminated-manuscript.mdmarkdown2.9 KB
references/styles/impressionism.mdmarkdown2.7 KB
references/styles/impressionist.mdmarkdown2.5 KB
references/styles/infographic-drawing.mdmarkdown2.6 KB
references/styles/isometric.mdmarkdown2.6 KB
references/styles/japanese-ink-drawing.mdmarkdown2.7 KB
references/styles/kawaii.mdmarkdown2.5 KB
references/styles/kirigami.mdmarkdown2.5 KB
references/styles/knolling-photography.mdmarkdown2.6 KB
references/styles/light-cheery-atmosphere.mdmarkdown2.5 KB
references/styles/line-art.mdmarkdown2.6 KB
references/styles/logo-design.mdmarkdown2.6 KB
references/styles/long-exposure.mdmarkdown2.4 KB
references/styles/lowpoly.mdmarkdown2.6 KB
references/styles/luxurious-elegance.mdmarkdown2.6 KB
references/styles/luxury.mdmarkdown2.3 KB
references/styles/lyrical-geometry.mdmarkdown2.7 KB
references/styles/macro-photography.mdmarkdown2.8 KB
references/styles/marker-drawing.mdmarkdown2.6 KB
references/styles/minimalism.mdmarkdown2.5 KB
references/styles/minimalist.mdmarkdown2.3 KB
references/styles/monochrome.mdmarkdown2.4 KB
references/styles/mosaic.mdmarkdown2.5 KB
references/styles/nautical.mdmarkdown2.4 KB
references/styles/neo-futurism.mdmarkdown2.3 KB
references/styles/neo-impressionism.mdmarkdown2.3 KB
references/styles/neon-noir.mdmarkdown2.5 KB
references/styles/neonpunk.mdmarkdown2.7 KB
references/styles/one-line-art.mdmarkdown2.5 KB
references/styles/op-art.mdmarkdown2.5 KB
references/styles/origami.mdmarkdown2.7 KB
references/styles/ornate-intricate.mdmarkdown2.4 KB
references/styles/paper-quilling.mdmarkdown2.5 KB
references/styles/pencil-sketch.mdmarkdown2.4 KB
references/styles/pop-art.mdmarkdown2.2 KB
references/styles/real-estate.mdmarkdown2.2 KB
references/styles/renaissance.mdmarkdown2.4 KB
references/styles/retail.mdmarkdown2.3 KB
references/styles/retro-futurism.mdmarkdown2.5 KB
references/styles/sci-fi.mdmarkdown2.4 KB
references/styles/shepard-fairey-style.mdmarkdown2.5 KB
references/styles/silhouette-art.mdmarkdown2.5 KB
references/styles/silhouette.mdmarkdown2.4 KB
references/styles/simple-vector-art.mdmarkdown2.4 KB
references/styles/space-art.mdmarkdown2.8 KB
references/styles/space.mdmarkdown2.4 KB
references/styles/stacked-papercut.mdmarkdown2.5 KB
references/styles/stained-glass.mdmarkdown2.5 KB
references/styles/steampunk.mdmarkdown2.4 KB
references/styles/sumi-e-detailed.mdmarkdown2.7 KB
references/styles/sumi-e-symbolic.mdmarkdown2.7 KB
references/styles/suminagashi.mdmarkdown2.5 KB
references/styles/surrealism.mdmarkdown2.4 KB
references/styles/surrealist.mdmarkdown2.4 KB
references/styles/tilt-shift.mdmarkdown2.5 KB
references/styles/tranquil.mdmarkdown2.4 KB
references/styles/typography.mdmarkdown2.5 KB
references/styles/ukiyo-e.mdmarkdown2.5 KB
references/styles/van-gogh.mdmarkdown2.5 KB
references/styles/vaporwave.mdmarkdown2.5 KB
references/styles/vibrant-rim-light.mdmarkdown2.4 KB
references/styles/vintage-airline-poster.mdmarkdown2.5 KB
references/styles/vintage-travel-poster.mdmarkdown2.6 KB
references/styles/volumetric-lighting.mdmarkdown2.4 KB
references/styles/whimsical.mdmarkdown2.2 KB
references/styles/zentangle.mdmarkdown2.4 KB
scripts/build-deck.tsscript2.5 KB
scripts/editable/render-editable-pptx.tsscript4.6 KB
scripts/editable/render-previews.pyscript6.6 KB
scripts/editable/render_inputs.pyscript2.2 KB
scripts/editable/review-editable.pyscript16.3 KB
scripts/editable/slide-spec.schema.jsonconfig2.6 KB
scripts/editable/validate-slide-spec.tsscript5.5 KB
scripts/merge-to-pptx.tsscript4.0 KB
tests/editable-mode.test.tsscript2.5 KB
tests/fixtures/editable/slide-spec.jsonconfig1.4 KB
tests/image-mode.test.tsscript1.4 KB
tests/mode-router.test.tsscript528 B
tests/test_critic_core_integration.pyscript4.4 KB
tests/test_render_previews.pyscript8.6 KB
tests/test_review_editable.pyscript15.7 KB

tests/test_render_previews.py

View on GitHub
import hashlib
import importlib.util
import json
import pathlib
import subprocess
import tempfile
import unittest
from unittest.mock import patch

MODULE = pathlib.Path(__file__).parents[1] / "scripts/editable/render-previews.py"


class RenderPreviewTest(unittest.TestCase):
    def setUp(self):
        self.assertTrue(MODULE.exists(), "render-previews.py must produce verifiable preview inputs")
        spec = importlib.util.spec_from_file_location("render_previews", MODULE)
        self.render = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(self.render)
        self.temp = tempfile.TemporaryDirectory()
        self.addCleanup(self.temp.cleanup)
        self.root = pathlib.Path(self.temp.name)
        self.spec = self.root / "slide-spec.json"
        self.spec.write_text(json.dumps({"slides": [{"id": "intro"}, {"id": "results"}]}))
        self.output = self.root / "rendered"
        self.argv = ["--spec", str(self.spec), "--output-dir", str(self.output)]
        self.fail_conversion = False
        self.page_count = 2
        self.deck_bytes = b"current PPTX"
        self.during_render = None

    def external_command(self, command, **kwargs):
        tool = pathlib.Path(command[0]).name
        if tool == "bun":
            pathlib.Path(command[-1]).write_bytes(self.deck_bytes)
        elif tool == "soffice":
            profile = next(arg for arg in command if arg.startswith("-env:UserInstallation="))
            self.assertIn("file:", profile)
            if self.fail_conversion:
                raise subprocess.CalledProcessError(1, command)
            output_dir = pathlib.Path(command[command.index("--outdir") + 1])
            (output_dir / "deck.pdf").write_bytes(b"current PDF")
        elif tool == "pdftoppm":
            for number in range(1, self.page_count + 1):
                pathlib.Path(f"{command[-1]}-{number}.png").write_bytes(f"page {number}".encode())
            if self.during_render:
                self.during_render()
        else:
            raise AssertionError(f"Unexpected executable {tool}")
        return subprocess.CompletedProcess(command, 0, stdout="", stderr="")

    def run_render(self):
        with patch.object(self.render.subprocess, "run", side_effect=self.external_command):
            return self.render.main(self.argv)

    def test_builds_and_normalizes_pages_with_matching_manifest(self):
        self.assertEqual(self.run_render(), 0)
        manifest = json.loads((self.output / "render-manifest.json").read_text())
        self.assertEqual(manifest["spec_sha256"], hashlib.sha256(self.spec.read_bytes()).hexdigest())
        self.assertEqual([page["slide_id"] for page in manifest["slides"]], ["intro", "results"])
        self.assertEqual([page["file"] for page in manifest["slides"]], ["slide-01.png", "slide-02.png"])
        for entry in [manifest["pptx"], *manifest["slides"]]:
            self.assertEqual(entry["sha256"], hashlib.sha256((self.output / entry["file"]).read_bytes()).hexdigest())

    def test_failed_rebuild_keeps_previous_successful_output(self):
        self.assertEqual(self.run_render(), 0)
        original = {p.name: p.read_bytes() for p in self.output.iterdir()}
        self.fail_conversion = True
        self.assertEqual(self.run_render(), 1)
        self.assertEqual({p.name: p.read_bytes() for p in self.output.iterdir()}, original)

    def test_failure_during_publication_restores_previous_complete_generation(self):
        self.assertEqual(self.run_render(), 0)
        original = {p.name: p.read_bytes() for p in self.output.iterdir()}
        real_replace = self.render.os.replace
        calls = 0

        def fail_second_replace(source, destination):
            nonlocal calls
            calls += 1
            if calls == 2:
                raise OSError("simulated publication failure")
            return real_replace(source, destination)

        self.deck_bytes = b"new PPTX generation"
        with patch.object(self.render.os, "replace", side_effect=fail_second_replace):
            self.assertEqual(self.run_render(), 1)
        self.assertEqual({p.name: p.read_bytes() for p in self.output.iterdir()}, original)

    def test_rollback_io_failure_retains_recoverable_previous_generation(self):
        self.assertEqual(self.run_render(), 0)
        original = {p.name: p.read_bytes() for p in self.output.iterdir()}
        real_replace = self.render.os.replace
        calls = 0

        def fail_publication_and_restore(source, destination):
            nonlocal calls
            calls += 1
            if calls in (2, 3):
                raise OSError("simulated persistent I/O failure")
            return real_replace(source, destination)

        with patch.object(self.render.os, "replace", side_effect=fail_publication_and_restore):
            self.assertEqual(self.run_render(), 1)
        backups = list(self.root.glob(".rendered.backup-*"))
        self.assertEqual(len(backups), 1)
        self.assertEqual({p.name: p.read_bytes() for p in backups[0].iterdir()}, original)
        self.assertFalse(self.output.exists())

    def test_wrong_page_count_is_not_published(self):
        self.page_count = 1
        self.assertEqual(self.run_render(), 1)
        self.assertFalse((self.output / "render-manifest.json").exists())

    def test_unknown_destination_file_is_preserved(self):
        self.output.mkdir()
        note = self.output / "my-notes.txt"
        note.write_text("keep me")
        self.assertEqual(self.run_render(), 1)
        self.assertEqual(note.read_text(), "keep me")
        self.assertFalse((self.output / "render-manifest.json").exists())

    def add_nested_asset(self):
        asset = self.root / "figure.png"
        asset.write_bytes(b"source figure")
        spec = json.loads(self.spec.read_text())
        spec["slides"][0]["elements"] = [{"id": "group", "type": "group", "children": [
            {"id": "figure", "type": "image", "path": "figure.png",
             "sha256": hashlib.sha256(asset.read_bytes()).hexdigest()}]}]
        self.spec.write_text(json.dumps(spec))
        return asset

    def test_manifest_binds_nested_image_source_assets(self):
        asset = self.add_nested_asset()
        self.assertEqual(self.run_render(), 0)
        manifest = json.loads((self.output / "render-manifest.json").read_text())
        self.assertEqual(manifest.get("assets"), [{"slide_id": "intro", "element_id": "figure",
                          "path": "figure.png", "sha256": hashlib.sha256(asset.read_bytes()).hexdigest()}])

    def test_asset_changed_during_render_does_not_replace_previous_generation(self):
        asset = self.add_nested_asset()
        self.assertEqual(self.run_render(), 0)
        original = {p.name: p.read_bytes() for p in self.output.iterdir()}
        self.during_render = lambda: asset.write_bytes(b"changed during render")
        self.assertEqual(self.run_render(), 1)
        self.assertEqual({p.name: p.read_bytes() for p in self.output.iterdir()}, original)

    def test_output_cannot_contain_a_source_asset_even_through_directory_alias(self):
        self.output.mkdir()
        asset = self.output / "slide-01.png"
        asset.write_bytes(b"source figure must be preserved")
        alias = self.root / "alias"
        alias.symlink_to(self.root, target_is_directory=True)
        spec = json.loads(self.spec.read_text())
        spec["slides"][0]["elements"] = [{"id": "group", "type": "group", "children": [
            {"id": "figure", "type": "image", "path": "rendered/slide-01.png",
             "sha256": hashlib.sha256(asset.read_bytes()).hexdigest()}]}]
        self.spec.write_text(json.dumps(spec))
        for output in [self.output, alias / "rendered"]:
            with self.subTest(output=output):
                asset.write_bytes(b"source figure must be preserved")
                before = asset.read_bytes()
                with patch.object(self.render.subprocess, "run", side_effect=self.external_command) as run:
                    code = self.render.main(self.argv[:-1] + [str(output)])
                self.assertEqual(asset.read_bytes(), before)
                self.assertEqual(code, 1)
                run.assert_not_called()

    def test_output_cannot_contain_the_spec_even_with_a_generated_filename(self):
        self.output.mkdir()
        spec = self.output / "render-manifest.json"
        spec.write_bytes(self.spec.read_bytes())
        before = spec.read_bytes()
        with patch.object(self.render.subprocess, "run", side_effect=self.external_command) as run:
            code = self.render.main(["--spec", str(spec), "--output-dir", str(self.output)])
        self.assertEqual(spec.read_bytes(), before)
        self.assertEqual(code, 1)
        run.assert_not_called()


if __name__ == "__main__":
    unittest.main()
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: 198kUpdated 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: 198kUpdated 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: 198kUpdated 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: 198kUpdated Claude CodeCodexVerifiedInstall