Skip to content

JimLiu/baoyu-skills / skills/baoyu-comic

baoyu-comic

Flagged

Knowledge comic creator supporting multiple art styles and tones. Creates original educational comics with detailed panel layouts and batch-capable image generation. Use when user asks to create "知识漫画", "教育漫画", "biography comic", "tutorial comic", or "Logicomix-style comic".

FileKindSize
SKILL.mdskill md16.7 KB
references/analysis-framework.mdmarkdown4.9 KB
references/art-styles/chalk.mdmarkdown2.7 KB
references/art-styles/ink-brush.mdmarkdown2.5 KB
references/art-styles/ligne-claire.mdmarkdown2.3 KB
references/art-styles/manga.mdmarkdown2.5 KB
references/art-styles/minimalist.mdmarkdown3.3 KB
references/art-styles/realistic.mdmarkdown2.7 KB
references/auto-selection.mdmarkdown3.5 KB
references/base-prompt.mdmarkdown3.1 KB
references/character-template.mdmarkdown4.4 KB
references/codex-imagegen.mdmarkdown3.6 KB
references/config/first-time-setup.mdmarkdown3.7 KB
references/config/preferences-schema.mdmarkdown4.9 KB
references/config/watermark-guide.mdmarkdown2.4 KB
references/layouts/cinematic.mdmarkdown450 B
references/layouts/dense.mdmarkdown415 B
references/layouts/four-panel.mdmarkdown1.4 KB
references/layouts/mixed.mdmarkdown429 B
references/layouts/splash.mdmarkdown471 B
references/layouts/standard.mdmarkdown440 B
references/layouts/webtoon.mdmarkdown778 B
references/ohmsha-guide.mdmarkdown2.9 KB
references/partial-workflows.mdmarkdown1.8 KB
references/presets/concept-story.mdmarkdown5.5 KB
references/presets/four-panel.mdmarkdown4.6 KB
references/presets/ohmsha.mdmarkdown4.4 KB
references/presets/shoujo.mdmarkdown3.2 KB
references/presets/wuxia.mdmarkdown2.9 KB
references/storyboard-template.mdmarkdown3.9 KB
references/tones/action.mdmarkdown2.2 KB
references/tones/dramatic.mdmarkdown1.9 KB
references/tones/energetic.mdmarkdown2.1 KB
references/tones/neutral.mdmarkdown1.3 KB
references/tones/romantic.mdmarkdown2.1 KB
references/tones/vintage.mdmarkdown2.1 KB
references/tones/warm.mdmarkdown1.8 KB
references/workflow.mdmarkdown16.4 KB
scripts/merge-to-pdf.tsscript3.1 KB

scripts/merge-to-pdf.ts

View on GitHub
import { existsSync, readdirSync, readFileSync } from "fs";
import { join, basename } from "path";
import { PDFDocument } from "pdf-lib";

interface PageInfo {
  filename: string;
  path: string;
  index: number;
  promptPath?: string;
}

function parseArgs(): { dir: string; output?: string } {
  const args = process.argv.slice(2);
  let dir = "";
  let output: string | undefined;

  for (let i = 0; i < args.length; i++) {
    if (args[i] === "--output" || args[i] === "-o") {
      output = args[++i];
    } else if (!args[i].startsWith("-")) {
      dir = args[i];
    }
  }

  if (!dir) {
    console.error("Usage: bun merge-to-pdf.ts <comic-dir> [--output filename.pdf]");
    process.exit(1);
  }

  return { dir, output };
}

function findComicPages(dir: string): PageInfo[] {
  if (!existsSync(dir)) {
    console.error(`Directory not found: ${dir}`);
    process.exit(1);
  }

  const files = readdirSync(dir);
  const pagePattern = /^(\d+)-(cover|page)(-[\w-]+)?\.(png|jpg|jpeg)$/i;
  const promptsDir = join(dir, "prompts");
  const hasPrompts = existsSync(promptsDir);

  const pages: PageInfo[] = files
    .filter((f) => pagePattern.test(f))
    .map((f) => {
      const match = f.match(pagePattern);
      const baseName = f.replace(/\.(png|jpg|jpeg)$/i, "");
      const promptPath = hasPrompts ? join(promptsDir, `${baseName}.md`) : undefined;

      return {
        filename: f,
        path: join(dir, f),
        index: parseInt(match![1], 10),
        promptPath: promptPath && existsSync(promptPath) ? promptPath : undefined,
      };
    })
    .sort((a, b) => a.index - b.index);

  if (pages.length === 0) {
    console.error(`No comic pages found in: ${dir}`);
    console.error("Expected format: 00-cover-slug.png, 01-page-slug.png, etc.");
    process.exit(1);
  }

  return pages;
}

async function createPdf(pages: PageInfo[], outputPath: string) {
  const pdfDoc = await PDFDocument.create();
  pdfDoc.setAuthor("baoyu-comic");
  pdfDoc.setSubject("Generated Comic");

  for (const page of pages) {
    const imageData = readFileSync(page.path);
    const ext = page.filename.toLowerCase();
    const image = ext.endsWith(".png")
      ? await pdfDoc.embedPng(imageData)
      : await pdfDoc.embedJpg(imageData);

    const { width, height } = image;
    const pdfPage = pdfDoc.addPage([width, height]);

    pdfPage.drawImage(image, {
      x: 0,
      y: 0,
      width,
      height,
    });

    console.log(`Added: ${page.filename}${page.promptPath ? " (prompt available)" : ""}`);
  }

  const pdfBytes = await pdfDoc.save();
  await Bun.write(outputPath, pdfBytes);

  console.log(`\nCreated: ${outputPath}`);
  console.log(`Total pages: ${pages.length}`);
}

async function main() {
  const { dir, output } = parseArgs();
  const pages = findComicPages(dir);

  const dirName = basename(dir) === "comic" ? basename(join(dir, "..")) : basename(dir);
  const outputPath = output || join(dir, `${dirName}.pdf`);

  console.log(`Found ${pages.length} pages in: ${dir}\n`);

  await createPdf(pages, outputPath);
}

main().catch((err) => {
  console.error("Error:", err.message);
  process.exit(1);
});
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall