agentleFS
fortunto2fortunto2/solo-factory/skills/kindle/SKILL.md

solo-kindle

Skill18 starsChanged 4 months agoMITView on GitHub

Make, convert, find and e-mail books to a Kindle (Send to Kindle by e-mail). Use when user says "на киндл", "отправь на Kindle", "сконвертируй книгу", "epub", "сделай книгу", "найди книгу", "send to Kindle", "make an ebook", "convert to epub", or hands a file, URL or outline that should end up as a book on a Kindle. Do NOT use for printable PDFs (use /pdf-print) or for audio and video transcripts (use /transcribe).

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Write one file per chapter: book/01-name.md, 02-..., each starting with # Chapter title.

    line 28
  2. Distinctive:

    No shadow libraries, no DRM removal, no paywalled content.

    line 58
  3. Very specific:

    Test hooks: KINDLE_STATE_DIR (audit log, default ~/.config/kindle), KINDLE_WORK (work dir).

    line 67
  4. Distinctive:

    Put recipient addresses in the repo.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

kindle: build a book, find a book, mail it to a Kindle

One CLI, four verbs. uv run scripts/kindle.py <verb> (deps are inline; needs pandoc).

VerbDoes
convert <file|url>md, txt, html, docx, fb2, epub, a URL → Kindle-ready EPUB. PDF passes through untouched. Prints a JSON check (title, author, lang, TOC, size)
make <folder|outline.md>chapters → one EPUB with title page, TOC, chapter breaks, optional cover; images resized and greyscaled for e-ink
send <file> --to <slug>mails the file to that recipient's Send-to-Kindle address
find <query> / find --get Nsearches legal free catalogs, downloads result N

Generating a book (the agent writes the text, the script assembles)

  1. Outline first: title, reader, language, 5-15 chapters with one line each.
  2. Write one file per chapter: book/01-name.md, 02-..., each starting with # Chapter title. Keep one language, one voice, and write the chapters one at a time so each stays coherent with the outline.
  3. book/book.yaml: title, author, lang (ru/en), optional cover: cover.jpg, publisher. Metadata lives here once, not per chapter.
  4. kindle.py make book/ → read the JSON: chapters matches your count, problems is empty.
  5. Images: reference them relatively (![caption](fig/a.png)); they are resized to 1200x1600 and greyscaled. --color keeps colour.
  6. Then send, after a --dry-run.

Text somebody else wrote: --untrusted

When the input comes from another person (a file a chat member sent, a URL, a book composed from such text) run convert / make with --untrusted (or KINDLE_UNTRUSTED=1). Raw HTML, images, metadata blocks and non-http links are stripped, pandoc runs with --sandbox under macOS sandbox-exec (no network, reads only the work dir; refuses where sandbox-exec is missing), --cover is refused and the file type is decided by its bytes, never by its name. Without the flag, ![](/abs/path) or <img src=…> in the text embeds that local file into the EPUB.

Sending: the one setup step per Kindle owner

Amazon accepts mail only from addresses on the owner's Approved Personal Document E-mail List. Each Kindle owner adds the sender address once: amazon.com → Manage Your Content and Devices → Preferences → Personal Document Settings (the same page shows their …@kindle.com address). Without it Amazon drops the mail silently. Limits and sources: references/amazon-limits.md.

export KINDLE_CONFIG=path/to/config.yaml      # or --config; shape: references/config.example.yaml
kindle.py send book.epub --to reader --dry-run # To/From/file/size, sends nothing
kindle.py send book.epub --to reader

Guards, all enforced by the script: recipient must exist and be enabled with a real address; one file per mail; only types Amazon accepts (epub, pdf, docx, txt, html, rtf, images; not mobi/azw3/fb2: convert first); size under the limit; the same file to the same slug is refused for 24 h unless --again; per-recipient daily cap (default 10); every send is a line in ~/.config/kindle/sends.jsonl (time, slug, file, bytes, sha256, result). The subject is empty: Amazon says none is needed.

Sender is a Gmail CLI wrapper named gws-* on PATH (messages.send through its upload path), or SMTP via KINDLE_SMTP_HOST/USER/PASS[/PORT/FROM]. Never a wrapper that is read-only, and never a bare gws that points at another account.

Exit codes: 0 ok, 1 error, 2 config or recipient, 3 file refused (type, size), 4 duplicate, 5 daily cap, 6 send failed.

Finding books (legal sources only)

find queries Project Gutenberg (Gutendex), Standard Ebooks (OPDS), Internet Archive (only items marked public domain) and Wikisource (ru/en, exported to EPUB). One request per second. Output: title, author, language, source, licence note, page link. find --get N saves to the work dir; then convert/send.

No shadow libraries, no DRM removal, no paywalled content. If the book is not in these catalogs: the user supplies a file they own, or buys it in the Kindle store.

Gotchas

  • Russian: lang is guessed from the text, or set --lang ru; hyphenation comes from that. docx input has no language signal, pass --lang.
  • PDF: Kindle shows it fixed-layout; reflow is poor. Convert from the source text when there is one.
  • mobi, azw3, djvu input needs Calibre's ebook-convert (not required otherwise; the script uses it only when present).
  • Gutendex answers 503 now and then; the script retries once, then reports the source and still shows the others.
  • Wikisource EPUB comes from the Wikimedia export service and can be slow; it can include a whole multi-page work.
  • Test hooks: KINDLE_STATE_DIR (audit log, default ~/.config/kindle), KINDLE_WORK (work dir).

Don't

  • Send without --dry-run first on a new recipient or a new file kind.
  • Put recipient addresses in the repo; they live in the private config.
  • Pull books from sources not listed above.

More: references/sources.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.