Use when the user asks about a Calibre ebook library or book collection: find books, search metadata or full text in EPUB/AZW3 files, or locate book paths via Calibre databases.
100
Quality
100%
Does it follow best practices?
Impact
100%
1.35xAverage score across 3 eval scenarios
Use this skill when the user wants to search a Calibre library, find books in an ebook collection, look inside EPUB or AZW3 content, or locate a book file on disk.
Access a Calibre ebook library via read-only SQLite queries.
Prefer environment variables so commands stay portable:
CALIBRE_LIBRARY_ROOT - directory containing the Calibre libraryCALIBRE_METADATA_DB - full path to metadata.dbCALIBRE_FTS_DB - full path to full-text-search.dbIf you know the library root, derive the DB paths from it:
export CALIBRE_LIBRARY_ROOT="/path/to/Calibre Library"
export CALIBRE_METADATA_DB="$CALIBRE_LIBRARY_ROOT/metadata.db"
export CALIBRE_FTS_DB="$CALIBRE_LIBRARY_ROOT/full-text-search.db"If you do not know where the DBs are, locate them first:
find "$HOME" -name metadata.db 2>/dev/null
find "$HOME" -name full-text-search.db 2>/dev/nullmetadata.db usually lives in the library root. If you only find metadata.db, use its parent directory as CALIBRE_LIBRARY_ROOT.
"What books do I have about X?" → find_books.py --query "X"
"I only remember part of the title/author" → find_books.py --query "partial phrase"; if it returns [], fall back to list_books.py
"Find a quote/passage in a specific book" → search_content.py --book-id N --query "phrase"
"Search all books for a topic" → search_content.py --query "topic" (slower, 10-20s)
"Get more context around a match" → get_excerpt.py --book-id N --around "keyword" --chars 1000
"Get the file path to read a book" → resolve_book.py --book-id N
"Browse titles when search terms are too vague" → list_books.py --limit 200
See references/scripts.md when you need exact commands, output shapes, fallback behavior, or error cases for a specific script.
# Step 1: Get book ID
python3 scripts/find_books.py --db-path "$CALIBRE_METADATA_DB" --query "Automatic Noodle"
# → book_id: 2525
# Step 2: Search within that book
python3 scripts/search_content.py \
--fts-db "$CALIBRE_FTS_DB" \
--metadata-db "$CALIBRE_METADATA_DB" \
--book-id 2525 \
--query "chef" \
--context 400If step 1 returns multiple books, disambiguate by author before searching content. If it returns [], retry with fewer title words or an author surname, then fall back to list_books.py.
If step 2 returns [], widen the phrase, try a more distinctive term, or search across all books if you may have the wrong title.
python3 scripts/search_content.py \
--fts-db "$CALIBRE_FTS_DB" \
--metadata-db "$CALIBRE_METADATA_DB" \
--query "machine learning" \
--limit 10If this returns [], try a shorter query, search metadata first with find_books.py, or ask for a narrower author/title hint before doing another global scan.
# Get path
python3 scripts/resolve_book.py \
--metadata-db "$CALIBRE_METADATA_DB" \
--library-root "$CALIBRE_LIBRARY_ROOT" \
--book-id 2525
# Then use ebook-convert or similar to extract textIf the returned format is not what you want, re-run with --format EPUB or another value from available_formats.
# Step 1: Find a match and note the book_id plus a nearby word
python3 scripts/search_content.py \
--fts-db "$CALIBRE_FTS_DB" \
--metadata-db "$CALIBRE_METADATA_DB" \
--book-id 2525 \
--query "chef"
# Step 2: Pull a larger excerpt around that word
python3 scripts/get_excerpt.py \
--fts-db "$CALIBRE_FTS_DB" \
--metadata-db "$CALIBRE_METADATA_DB" \
--book-id 2525 \
--around "chef" \
--chars 1200If get_excerpt.py says the keyword is not found, copy a nearby word from the snippet or use --position with a known character offset.
find_books.py returns a JSON array. Empty results are [], not errors.search_content.py returns a JSON array for successful searches and a JSON error object for invalid --book-id, missing text, or empty queries.get_excerpt.py and resolve_book.py return JSON objects and use an "error" field for invalid book IDs, missing text, bad positions, or missing formats.book_id fails unexpectedly, re-run find_books.py first to confirm the title/author mapping before assuming the content index is wrong.--book-id searches whenever possible. Global content searches hit a 4.5 GB database and are much slower.--book-id when possible.Install with Tessl CLI
npx tessl i jobe-skills/ebook-library@1.0.3