assistant-skills/book-list/SKILL.md

160 lines
4.8 KiB
Markdown

---
name: book-list
description: Manage a personal reading list stored in MongoDB. Use this skill whenever the user wants to add a book, query their reading list, update book status, or manage tags.
version: 1.0.0
---
# Book List
Manage a personal reading list stored in MongoDB. Books are stored in the `lists.books` collection with standardized fields.
## Database
- **Database:** `lists`
- **Collection:** `books`
## Book Schema
Each book document should have these fields:
```json
{
"title": "Book Title",
"author": "Author Name",
"genre": "fiction|nonfiction",
"status": "to_read|reading|completed|dropped",
"summary": "Concise description of the book (from jacket/blurb/Goodreads)",
"tags": ["tag1", "tag2", "tag3"]
}
```
### Field Details
- **title** (required): Full book title
- **author** (required): Author name
- **genre** (required): Either `fiction` or `nonfiction`
- **status** (required): One of `to_read`, `reading`, `completed`, `dropped`
- **summary** (required): Concise description, typically from the book jacket, blurb, or Goodreads description. 1-3 sentences.
- **tags** (recommended): Array of relevant tags. See Tag Suggestions below.
## Tag Suggestions
When adding a book, suggest 5-10 relevant tags based on the book's content. Categories to consider:
- **Genre-specific:** e.g., `science-fiction`, `mystery`, `memoir`, `philosophy`
- **Themes:** e.g., `suffering`, `transformation`, `mindfulness`, `redemption`
- **Religious/Spiritual tradition:** e.g., `buddhism`, `christianity`, `vietnamese-zen`, `mysticism`
- **Author** (for frequently-read authors): e.g., `thich-nhat-hanh`, `dostoevsky`, `tolkien`
- **Movement/Period:** e.g., `existentialism`, `stoicism`, `modern-classic`
- **Topics:** e.g., `meditation`, `ethics`, `psychology`, `history`
**Tag formatting:** lowercase, hyphen-separated, no special characters. Examples: `vietnamese-zen` (not `Vietnamese Zen`), `science-fiction` (not `sci-fi`).
## Dependencies
This skill depends on the **mongodb** skill for all database operations. Reference that skill for:
- Connection details and credentials
- How to run Python scripts with `uv run --with pymongo`
- Code patterns for inserting, updating, querying, and deleting documents
Always use the mongodb skill's patterns when interacting with the database.
## Operations
### Add a Book
When the user wants to add a book:
1. If the user provides only the title, search for the book online to get: author, genre, and a summary
2. Ask the user for status (default: `to_read`) if not specified
3. Generate 5-10 relevant tags based on the book's content and author
4. Show the user the tags you've suggested and ask if they want to add, remove, or modify any
5. Insert the document into `lists.books` collection
6. Confirm insertion and show the book's MongoDB document ID
Example insertion:
```python
from pymongo import MongoClient
client = MongoClient("mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563")
db = client["lists"]
books = db["books"]
book = {
"title": "No Mud, No Lotus: The Art of Transforming Suffering",
"author": "Thich Nhat Hanh",
"genre": "nonfiction",
"status": "to_read",
"summary": "The secret to happiness is to acknowledge and transform suffering, not to run away from it.",
"tags": ["buddhism", "mindfulness", "suffering", "transformation", "spirituality", "meditation", "vietnamese-zen", "thich-nhat-hanh"]
}
result = books.insert_one(book)
print(f"Inserted: {result.inserted_id}")
client.close()
```
### Query Books
Common queries:
```python
# Get all books
for book in books.find():
print(f"{book['title']} - {book['status']}")
# Get books by status
for book in books.find({"status": "to_read"}):
print(book['title'])
# Search by tag
for book in books.find({"tags": "buddhism"}):
print(book['title'])
# Get books by author
for book in books.find({"author": "Thich Nhat Hanh"}):
print(book['title'])
```
### Update Book Status
```python
books.update_one(
{"title": "Book Title"},
{"$set": {"status": "reading"}}
)
```
### Update Tags
```python
books.update_one(
{"title": "Book Title"},
{"$set": {"tags": ["new", "tag", "list"]}}
)
```
### Delete a Book
```python
books.delete_one({"title": "Book Title"})
```
## Guidelines
- Always show suggested tags before inserting — let the user confirm or modify
- Keep summaries concise (1-3 sentences) — copy from jacket/Goodreads rather than writing your own
- Use lowercase, hyphen-separated tags
- When querying, use `.limit()` if results might be large
- Always close the MongoDB client after operations
- Clean up temporary Python scripts after running
## Triggers
- "add this to my book list"
- "add [book title] to my books"
- "what's on my reading list"
- "show me my to-read books"
- "mark [book] as reading/completed"
- "update my book list"
- "add tags to [book]"