Making Memes
Making Memes
Generate memes from a curated 20-template registry without bundling copyrighted images. Search or suggest a format, then render locally (SVG/PNG) or via Imgflip's hosted API.
Bash# Find a template by keyword {baseDir}/scripts/meme.mjs search "bad choice" # Don't know the format? Describe the topic instead {baseDir}/scripts/meme.mjs suggest "slow python image scripts" # Render locally as SVG (default, no dependencies) {baseDir}/scripts/meme.mjs render drake --text "Python cold starts" --text "Node sharp cache" --out /tmp/meme.svg # Render locally as PNG (requires sharp) {baseDir}/scripts/meme.mjs render drake --text "Maybe API" --text "Local render" --out /tmp/meme.png # Render via Imgflip and get a hosted URL {baseDir}/scripts/meme.mjs render drake --service imgflip --text "before" --text "after"
Progress:
- Step 1: Understand the joke/topic the user wants to make
- Step 2: If the user names a template,
search; if not,suggesta template - Step 3: Confirm the template's fields (some need 2 lines, some more) via
{baseDir}/references/templates.json - Step 4: Write concise caption text matching the template's tone
- Step 5: Render — default to
localSVG unless the user wants a shareable hosted link or a PNG - Step 6: If PNG render fails (sharp missing), fall back to
.svgoutput and tell the user
- local (default): downloads the template image from its source URL with a browser-like user agent, caches it under the user cache dir, embeds it in an SVG, and writes the file. If
--outends in.png, usessharpwhen available. - imgflip: calls the Imgflip
caption_imageAPI and prints the hosted URL. RequiresIMGFLIP_USERandIMGFLIP_PASSenv vars, or--username/--passwordflags.
list [--json]— list the built-in curated templatessearch <query> [--json]— search template names, aliases, tags, and use casessuggest <topic> [--limit N] [--json]— rank templates for a topicrender <template> --text TEXT ... [--out PATH] [--service local|imgflip]— generate a memerefresh [--limit N] [--json]— fetch current Imgflip top templates for research only; never auto-overwrites the curated registry
Read {baseDir}/references/templates.json for the curated 20-template registry. Each entry includes Imgflip metadata, Know Your Meme link, aliases, tags, fields, and local text placement boxes.
Prefer suggest first when the user describes a joke but doesn't know the format name.
Example 1:
Input: "I need a meme about choosing localhost over deploying to prod"
Output: Run suggest "choosing risky option over safe option" → returns drake (rejects safe, prefers risky/funny option). Render: render drake --text "Deploy to prod" --text "Just test on localhost forever"
Example 2:
Input: "Make a Distracted Boyfriend meme about JS frameworks"
Output: search "distracted boyfriend" confirms the template and its 3-field layout (boyfriend, girlfriend, other woman). Render: render distracted-boyfriend --text "Me" --text "Stable framework" --text "New shiny framework"
- Always
searchorsuggestbefore rendering — don't guess template IDs. - Check the template's expected field count in
templates.jsonbefore writing captions; mismatched--textcounts produce broken layouts. - Keep captions short and punchy; long text overflows fixed text boxes in local SVG rendering.
- Use
localSVG by default — it has zero external dependencies and works everywhere. - Use
imgfliponly when the user explicitly wants a shareable hosted URL. - Cite the Know Your Meme link only for explaining a template's origin/context, not during rendering.
- Don't bundle or commit template image files into the skill directory — images are fetched at render time.
- Don't hardcode or share Imgflip credentials; require the user's own
IMGFLIP_USER/IMGFLIP_PASSor CLI flags. - Don't run
npm installinside the skill directory or the OpenClaw tree to force PNG support — ifsharpisn't available, fall back to.svg. - Don't call
refreshexpecting it to update the curated registry automatically — it's for research only. - Don't skip the KYM/provenance check for ambiguous or offensive-adjacent templates before suggesting them.