Skip to content
bbelderbosPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

similes

Turn a concept into an original teaching analogy and render it as a 4:5 social carousel (1080×1350 PNG per slide plus a PDF for LinkedIn).

Where it started

A course lesson explained the repository pattern like this:

Think of a repository like a librarian. You don't need to know where books are shelved or how the catalog system works. You simply ask the librarian for a book by title, and they handle all the details. Your business logic asks the repository for data, and the repository handles whether that data comes from SQLite, PostgreSQL, or a simple dictionary in memory.

A student replied:

simile is so helpful! hope there will be more of this in the rest of the course 😉

This tool makes more of them.

Usage

uv sync && uv run playwright install chromium   # or: just setup
uv run similes list
uv run similes render rust-ownership-book --theme noir --cta "Join the Rust cohort"

Create new similes with the /simile Claude Code skill (.claude/skills/simile/) inside this repo, or from any MCP client:

uvx --from git+https://github.com/bbelderbos/similes python -m playwright install chromium   # once
claude mcp add similes -- uvx --from git+https://github.com/bbelderbos/similes similes-mcp

The server offers a simile prompt (the interview, drafting and critic flow) and four tools: list_looks, genre_voice, validate_simile and render_simile. Images in MCP mode must be absolute paths.

To use it:

  1. Start the prompt with a concept. In Claude Code: /similes:simile Rust ownership. In Claude Desktop: pick simile from the + menu.
  2. Answer the interview questions, one at a time.
  3. Approve a draft. Claude validates and renders it; the PNGs and PDF go to ~/Downloads/similes/<slug>/ (created if missing; %USERPROFILE%\Downloads\similes on Windows).
  4. Ask for changes in plain words ("make it noir", "add a CTA: Join the cohort") and Claude re-renders.

Commands

Common tasks are in the Justfile (just lists them: check, render, render-all, gallery, mcp, deploy).

similes list [--library PATH] shows slug, genre and concept for every simile.

similes render SLUG [options] writes <out>/<slug>/<slug>-<look>-NN.png and <slug>-<look>.pdf.

Option Default
--theme the genre's look any of the 16 looks below
--cta none Text for an extra final slide
--library library Folder with <slug>.toml files
--out out Output root

Render exits with an error if any slide's text overflows; shorten the copy.

Simile files

library/<slug>.toml, validated on load. See library/rust-ownership-book.toml for a full example with code.

Field Notes
concept, audience, aha, source_world Required
simile Required, max 20 words
hook Required, max 15 words
breaks_down Required, max 25 words
takeaway Required, max 12 words
genre plain, noir, fable, heist, expedition. Each defaults to the look with the same name
[[mapping]] 3 to 5 rows: source, target (max 4 words each), detail (max 12), optional code
lang en (default) or es for slide labels
code_lang Pygments lexer for code, default python
image Optional photo path relative to library/, shown on the hook and simile slides
tags Optional

Looks

Hook, mapping and takeaway slides of rust-ownership-book in each look. Regenerate with uv run python scripts/gallery.py [slug].

plain

plain

noir

noir

paper

paper

blueprint

blueprint

terminal

terminal

fable

fable

heist

heist

expedition

expedition

chalkboard

chalkboard

newsprint

newsprint

swiss

swiss

riso

riso

bauhaus

bauhaus

neon

neon

brutalist

brutalist

botanical

botanical

Fonts are bundled in src/similes/fonts/ (SIL Open Font License, see LICENSES.txt) and inlined at render time, so rendering works offline. Refetch with uv run python scripts/fetch_fonts.py.

The skill instructions live in src/similes/prompts/simile.md (shared by the skill and the MCP prompt). The rubric, voice rules and cliché list are in src/similes/prompts/rubric.md; genre voices in src/similes/genres/.

Landing page

site/ is a static page served by Cloudflare Pages (project similes, direct upload, no git integration) at similes.belderbos.dev, falling back to similes.pages.dev.

wrangler pages deploy site --project-name similes --branch main

The custom domain is attached to the Pages project and needs a proxied CNAME similes → similes.pages.dev in the belderbos.dev zone. Images in site/img/ are copies: re-copy from docs/looks/ and out/ when the gallery or example carousel changes.

License

MIT. Bundled fonts are under the SIL Open Font License (src/similes/fonts/LICENSES.txt).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages