apple-books
Read your Apple Books library, highlights, notes, and reading progress directly from the local SQLite databases on macOS.
Best use case
apple-books is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Read your Apple Books library, highlights, notes, and reading progress directly from the local SQLite databases on macOS.
Teams using apple-books should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/apple-books/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How apple-books Compares
| Feature / Agent | apple-books | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Read your Apple Books library, highlights, notes, and reading progress directly from the local SQLite databases on macOS.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
AI Agents for Startups
Explore AI agent skills for startup validation, product research, growth experiments, documentation, and fast execution with small teams.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
SKILL.md Source
# Apple Books
Query your local Apple Books library on macOS. Read-only access to books, highlights, notes, collections, and reading progress.
## Requirements
- **macOS only** — Apple Books stores data in `~/Library/Containers/com.apple.iBooksX/`
- **Full Disk Access** required for the process running queries (System Settings → Privacy & Security → Full Disk Access)
- **sqlite3** (pre-installed on macOS)
- Apple Books must have been opened at least once (databases are created on first launch)
## Database discovery
The database filenames are consistent across macOS installs, but always resolve them dynamically in case Apple changes them in future versions:
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
AEANNOTATION_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/*.sqlite 2>/dev/null | head -1)"
```
If either variable is empty, Apple Books has not been set up on this Mac.
> **Important:** These are read-only queries. Never INSERT, UPDATE, or DELETE rows — doing so may corrupt Apple Books data or cause iCloud sync issues.
## List all books
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$BKLIBRARY_DB" \
"SELECT ZTITLE, ZAUTHOR, ZGENRE, ZPAGECOUNT, ZREADINGPROGRESS, ZISFINISHED, ZASSETID
FROM ZBKLIBRARYASSET
WHERE ZTITLE IS NOT NULL
ORDER BY ZLASTOPENDATE DESC;"
```
## Search books by title or author
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$BKLIBRARY_DB" \
"SELECT ZTITLE, ZAUTHOR, ZGENRE, ZREADINGPROGRESS, ZASSETID
FROM ZBKLIBRARYASSET
WHERE ZTITLE IS NOT NULL AND (ZTITLE LIKE '%SEARCH_TERM%' OR ZAUTHOR LIKE '%SEARCH_TERM%')
ORDER BY ZLASTOPENDATE DESC;"
```
Replace `SEARCH_TERM` with the user's query.
## Currently reading (in progress, not finished)
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$BKLIBRARY_DB" \
"SELECT ZTITLE, ZAUTHOR, ZGENRE,
printf('%.0f%%', ZREADINGPROGRESS * 100) AS progress,
datetime(ZLASTOPENDATE + 978307200, 'unixepoch', 'localtime') AS last_opened
FROM ZBKLIBRARYASSET
WHERE ZTITLE IS NOT NULL
AND ZREADINGPROGRESS > 0.0
AND (ZISFINISHED IS NULL OR ZISFINISHED = 0)
ORDER BY ZLASTOPENDATE DESC;"
```
## Finished books
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$BKLIBRARY_DB" \
"SELECT ZTITLE, ZAUTHOR, ZGENRE,
datetime(ZDATEFINISHED + 978307200, 'unixepoch', 'localtime') AS finished_date
FROM ZBKLIBRARYASSET
WHERE ZISFINISHED = 1
ORDER BY ZDATEFINISHED DESC;"
```
## Get all highlights and notes for a specific book
```bash
AEANNOTATION_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$AEANNOTATION_DB" \
"SELECT ZANNOTATIONSELECTEDTEXT, ZANNOTATIONNOTE, ZANNOTATIONSTYLE,
datetime(ZANNOTATIONCREATIONDATE + 978307200, 'unixepoch', 'localtime') AS created
FROM ZAEANNOTATION
WHERE ZANNOTATIONDELETED = 0
AND ZANNOTATIONASSETID = 'ASSET_ID'
AND length(ZANNOTATIONSELECTEDTEXT) > 0
ORDER BY ZPLLOCATIONRANGESTART ASC;"
```
Replace `ASSET_ID` with the book's `ZASSETID` from the library query.
## Get all highlights across all books (with book titles)
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
AEANNOTATION_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$AEANNOTATION_DB" \
"ATTACH DATABASE '$BKLIBRARY_DB' AS lib;
SELECT lib.ZBKLIBRARYASSET.ZTITLE, lib.ZBKLIBRARYASSET.ZAUTHOR,
ZAEANNOTATION.ZANNOTATIONSELECTEDTEXT, ZAEANNOTATION.ZANNOTATIONNOTE,
datetime(ZAEANNOTATION.ZANNOTATIONCREATIONDATE + 978307200, 'unixepoch', 'localtime') AS created
FROM ZAEANNOTATION
JOIN lib.ZBKLIBRARYASSET ON ZAEANNOTATION.ZANNOTATIONASSETID = lib.ZBKLIBRARYASSET.ZASSETID
WHERE ZAEANNOTATION.ZANNOTATIONDELETED = 0
AND length(ZAEANNOTATION.ZANNOTATIONSELECTEDTEXT) > 0
ORDER BY ZAEANNOTATION.ZANNOTATIONCREATIONDATE DESC
LIMIT 50;"
```
## List collections (shelves)
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$BKLIBRARY_DB" \
"SELECT c.ZTITLE, c.ZCOLLECTIONID, COUNT(m.Z_PK) AS book_count
FROM ZBKCOLLECTION c
LEFT JOIN ZBKCOLLECTIONMEMBER m ON m.Z_PK IN (
SELECT Z_PK FROM ZBKCOLLECTIONMEMBER
)
WHERE c.ZDELETEDFLAG = 0 AND c.ZTITLE IS NOT NULL
GROUP BY c.ZCOLLECTIONID
ORDER BY c.ZTITLE;"
```
## Reading stats
```bash
BKLIBRARY_DB="$(ls ~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/*.sqlite 2>/dev/null | head -1)"
sqlite3 "$BKLIBRARY_DB" \
"SELECT
COUNT(*) AS total_books,
SUM(CASE WHEN ZISFINISHED = 1 THEN 1 ELSE 0 END) AS finished,
SUM(CASE WHEN ZREADINGPROGRESS > 0 AND (ZISFINISHED IS NULL OR ZISFINISHED = 0) THEN 1 ELSE 0 END) AS in_progress,
SUM(CASE WHEN ZREADINGPROGRESS = 0 OR ZREADINGPROGRESS IS NULL THEN 1 ELSE 0 END) AS not_started,
printf('%.0f%%', AVG(ZREADINGPROGRESS) * 100) AS avg_progress
FROM ZBKLIBRARYASSET
WHERE ZTITLE IS NOT NULL;"
```
## Annotation styles
| Style value | Color |
|-------------|-----------|
| 1 | Green |
| 2 | Blue |
| 3 | Yellow |
| 4 | Pink |
| 5 | Purple |
## Annotation types
| Type value | Meaning |
|------------|-------------|
| 2 | Highlight |
| 3 | Bookmark |
## Date handling
Apple Books uses Core Data timestamps (seconds since 2001-01-01). To convert to human-readable:
```sql
datetime(TIMESTAMP_COLUMN + 978307200, 'unixepoch', 'localtime')
```
## Troubleshooting
- **"unable to open database file"** — Grant Full Disk Access to the process (OpenClaw gateway / node) in System Settings → Privacy & Security → Full Disk Access
- **Empty results** — Open Apple Books at least once so macOS creates the databases
- **Stale data** — Apple Books may hold a write lock while open; queries still work in WAL mode but data may lag a few seconds behind the UI
## Notes
- `ZASSETID` is the key that links books to their annotations
- `ZREADINGPROGRESS` is a float from 0.0 to 1.0
- `ZISFINISHED` is 1 when marked as finished, NULL or 0 otherwise
- The `ZLASTOPENDATE` field tracks when the book was last opened
- All queries are **read-only** — never modify these databases
- Audiobooks from Apple Books also appear in this database (`ZISSTOREAUDIOBOOK = 1`)Related Skills
pear-apple
iCloud Calendar, Reminders & Contacts via Pear. Manage events, reminders, contacts, daily briefings, and AI scheduling. 27 tools for Apple iCloud via CalDAV/CardDAV.
apple-photos-cleaner
Analyze, clean up, and organize Apple Photos libraries. Find and report junk photos (screenshots, low-quality, burst leftovers, duplicates), analyze storage usage, generate photo timeline recaps, plan smart exports, analyze Live Photos, check iCloud sync, audit shared libraries, detect similar photos, curate seasonal highlights, and score face quality. All analysis operations are READ-ONLY on the database (safe). macOS only. Requires Python 3.9+ (stdlib only) and access to the Apple Photos SQLite database. Trigger on: Photos cleanup, photo storage, duplicate photos, junk photos, screenshot cleanup, Photos analysis, photo timeline, photo export, Photos library stats, burst cleanup, storage hogs, photo organization, Live Photos, iCloud sync, shared library, similar photos, seasonal highlights, face quality, portraits.
apple-music-dj
Ultimate personalization engine for Apple Music. Analyzes listening history, Apple Music Replay stats, library data, and taste patterns to create intelligent playlists directly in the user's Apple Music library via the MusicKit API. Supports deep cuts discovery, mood/activity playlists, trend scouting, constellation discovery ("surprise me"), playlist refresh/evolution, automated weekly curation via cron, taste DNA cards, compatibility scoring, listening insights, catalog gap analysis, album deep dives, artist rabbit holes, daily song drops, concert prep, and personalized new release radar. Use this skill whenever the user mentions Apple Music, playlists, music recommendations, listening habits, music taste, "what should I listen to", discovering new music, mood playlists, workout playlists, deep cuts, hidden gems, trending music, "surprise me", refreshing a playlist, or anything related to curating their music experience. Also trigger on: "DJ", "mix", "playlist for", "music for", "songs like", "similar to", "what's hot", "new releases for me", "taste DNA", "taste card", "compatibility", "how compatible", "year in review", "listening stats", "what have I missed", "album deep dive", "rabbit hole", "concert prep", "seeing [artist] live", "daily song", "what should I listen to right now", or OpenClaw in the context of music.
apple-developer-toolkit
All-in-one Apple developer skill with three integrated tools shipped as a single unified binary. (1) Documentation search across Apple frameworks, symbols, and 1,267 WWDC sessions from 2014-2025. No credentials needed. (2) App Store Connect CLI with 120+ commands covering builds (find/wait/upload), TestFlight, pre-submission validate, submissions, signing, subscriptions (family-sharable), IAP, analytics, Xcode Cloud, metadata workflows, release pipeline dashboard, insights, win-back offers, promoted purchases, product pages, nominations, accessibility declarations, pre-orders, pricing filters, localizations update, diff, webhooks with local receiver, workflow automation, and more. Requires App Store Connect API key. (3) Multi-platform app builder (iOS/watchOS/tvOS/iPad/macOS/visionOS) that generates complete Swift/SwiftUI apps from natural language with auto-fix, simulator launch, interactive chat mode, and open-in-Xcode. Requires an LLM API key and Xcode. Includes 38 iOS development rules and 12 SwiftUI best practice guides for Liquid Glass, navigation, state management, and modern APIs. All three tools ship as one binary (appledev). USE WHEN: Apple API docs, App Store Connect management, WWDC lookup, or building iOS/watchOS/tvOS/macOS/visionOS apps from scratch. DON'T USE WHEN: non-Apple platforms or general coding.
apple-media
Control Apple TV, HomePod, and AirPlay devices via pyatv (scan, stream, playback, volume, navigation).
value-mining-lengthybooks
Extract actionable insights from books using Four-Layer Methodology: (1) Skeleton - conceptual frameworks and mental models, (2) Flesh - 2-3 detailed case studies including original examples, cross-industry analogies, and real-world applications, (3) Essence - cross-industry migration matrices with specific industry adaptations and 3-5 step executable SOPs, (4) Residue - critical analysis of boundaries, limitations, and failure conditions. Dual processing modes: Quick (5 core points, 10-15 min) for rapid assessment and Deep (10-20 comprehensive points, 30-45 min) for systematic learning. Includes Feynman validation testing with scenario-based problems and scoring rubrics. Generates structured reports in Markdown/PDF/Word formats. Use when user requests systematic knowledge extraction, concept distillation, or implementation guidance from methodology/business/psychology/self-help books with emphasis on practical application and cross-domain transfer.
---
name: article-factory-wechat
humanizer
Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.
find-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
tavily-search
Use Tavily API for real-time web search and content extraction. Use when: user needs real-time web search results, research, or current information from the web. Requires Tavily API key.
baidu-search
Search the web using Baidu AI Search Engine (BDSE). Use for live information, documentation, or research topics.
agent-autonomy-kit
Stop waiting for prompts. Keep working.