Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Query Google NotebookLM notebooks from Claude Code for source-grounded, citation-backed answers from Gemini.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/usage_patterns.md
1# NotebookLM Skill Usage Patterns23Advanced patterns for using the NotebookLM skill effectively.45## Critical: Always Use run.py67**Every command must use the run.py wrapper:**8```bash9# ✅ CORRECT:10python scripts/run.py auth_manager.py status11python scripts/run.py ask_question.py --question "..."1213# ❌ WRONG:14python scripts/auth_manager.py status # Will fail!15```1617## Pattern 1: Initial Setup1819```bash20# 1. Check authentication (using run.py!)21python scripts/run.py auth_manager.py status2223# 2. If not authenticated, setup (Browser MUST be visible!)24python scripts/run.py auth_manager.py setup25# Tell user: "Please log in to Google in the browser window"2627# 3. Add first notebook - ASK USER FOR DETAILS FIRST!28# Ask: "What does this notebook contain?"29# Ask: "What topics should I tag it with?"30python scripts/run.py notebook_manager.py add \31--url "https://notebooklm.google.com/notebook/..." \32--name "User provided name" \33--description "User provided description" \ # NEVER GUESS!34--topics "user,provided,topics" # NEVER GUESS!35```3637**Critical Notes:**38- Virtual environment created automatically by run.py39- Browser MUST be visible for authentication40- ALWAYS discover content via query OR ask user for notebook metadata4142## Pattern 2: Adding Notebooks (Smart Discovery!)4344**When user shares a NotebookLM URL:**4546**OPTION A: Smart Discovery (Recommended)**47```bash48# 1. Query the notebook to discover its content49python scripts/run.py ask_question.py \50--question "What is the content of this notebook? What topics are covered? Provide a complete overview briefly and concisely" \51--notebook-url "[URL]"5253# 2. Use discovered info to add it54python scripts/run.py notebook_manager.py add \55--url "[URL]" \56--name "[Based on content]" \57--description "[From discovery]" \58--topics "[Extracted topics]"59```6061**OPTION B: Ask User (Fallback)**62```bash63# If discovery fails, ask user:64"What does this notebook contain?"65"What topics does it cover?"6667# Then add with user-provided info:68python scripts/run.py notebook_manager.py add \69--url "[URL]" \70--name "[User's answer]" \71--description "[User's description]" \72--topics "[User's topics]"73```7475**NEVER:**76- Guess what's in a notebook77- Use generic descriptions78- Skip discovering content7980## Pattern 3: Daily Research Workflow8182```bash83# Check library84python scripts/run.py notebook_manager.py list8586# Research with comprehensive questions87python scripts/run.py ask_question.py \88--question "Detailed question with all context" \89--notebook-id notebook-id9091# Follow-up when you see "Is that ALL you need to know?"92python scripts/run.py ask_question.py \93--question "Follow-up question with previous context"94```9596## Pattern 4: Follow-Up Questions (CRITICAL!)9798When NotebookLM responds with "EXTREMELY IMPORTANT: Is that ALL you need to know?":99100```python101# 1. STOP - Don't respond to user yet102# 2. ANALYZE - Is answer complete?103# 3. If gaps exist, ask follow-up:104python scripts/run.py ask_question.py \105--question "Specific follow-up with context from previous answer"106107# 4. Repeat until complete108# 5. Only then synthesize and respond to user109```110111## Pattern 5: Multi-Notebook Research112113```python114# Query different notebooks for comparison115python scripts/run.py notebook_manager.py activate --id notebook-1116python scripts/run.py ask_question.py --question "Question"117118python scripts/run.py notebook_manager.py activate --id notebook-2119python scripts/run.py ask_question.py --question "Same question"120121# Compare and synthesize answers122```123124## Pattern 6: Error Recovery125126```bash127# If authentication fails128python scripts/run.py auth_manager.py status129python scripts/run.py auth_manager.py reauth # Browser visible!130131# If browser crashes132python scripts/run.py cleanup_manager.py --preserve-library133python scripts/run.py auth_manager.py setup # Browser visible!134135# If rate limited136# Wait or switch accounts137python scripts/run.py auth_manager.py reauth # Login with different account138```139140## Pattern 7: Batch Processing141142```bash143#!/bin/bash144NOTEBOOK_ID="notebook-id"145QUESTIONS=(146"First comprehensive question"147"Second comprehensive question"148"Third comprehensive question"149)150151for question in "${QUESTIONS[@]}"; do152echo "Asking: $question"153python scripts/run.py ask_question.py \154--question "$question" \155--notebook-id "$NOTEBOOK_ID"156sleep 2 # Avoid rate limits157done158```159160## Pattern 8: Automated Research Script161162```python163#!/usr/bin/env python164import subprocess165166def research_topic(topic, notebook_id):167# Comprehensive question168question = f"""169Explain {topic} in detail:1701. Core concepts1712. Implementation details1723. Best practices1734. Common pitfalls1745. Examples175"""176177result = subprocess.run([178"python", "scripts/run.py", "ask_question.py",179"--question", question,180"--notebook-id", notebook_id181], capture_output=True, text=True)182183return result.stdout184```185186## Pattern 9: Notebook Organization187188```python189# Organize by domain - with proper metadata190# ALWAYS ask user for descriptions!191192# Backend notebooks193add_notebook("Backend API", "Complete API documentation", "api,rest,backend")194add_notebook("Database", "Schema and queries", "database,sql,backend")195196# Frontend notebooks197add_notebook("React Docs", "React framework documentation", "react,frontend")198add_notebook("CSS Framework", "Styling documentation", "css,styling,frontend")199200# Search by domain201python scripts/run.py notebook_manager.py search --query "backend"202python scripts/run.py notebook_manager.py search --query "frontend"203```204205## Pattern 10: Integration with Development206207```python208# Query documentation during development209def check_api_usage(api_endpoint):210result = subprocess.run([211"python", "scripts/run.py", "ask_question.py",212"--question", f"Parameters and response format for {api_endpoint}",213"--notebook-id", "api-docs"214], capture_output=True, text=True)215216# If follow-up needed217if "Is that ALL you need" in result.stdout:218# Ask for examples219follow_up = subprocess.run([220"python", "scripts/run.py", "ask_question.py",221"--question", f"Show code examples for {api_endpoint}",222"--notebook-id", "api-docs"223], capture_output=True, text=True)224225return combine_answers(result.stdout, follow_up.stdout)226```227228## Best Practices229230### 1. Question Formulation231- Be specific and comprehensive232- Include all context in each question233- Request structured responses234- Ask for examples when needed235236### 2. Notebook Management237- **ALWAYS ask user for metadata**238- Use descriptive names239- Add comprehensive topics240- Keep URLs current241242### 3. Performance243- Batch related questions244- Use parallel processing for different notebooks245- Monitor rate limits (50/day)246- Switch accounts if needed247248### 4. Error Handling249- Always use run.py to prevent venv issues250- Check auth before operations251- Implement retry logic252- Have fallback notebooks ready253254### 5. Security255- Use dedicated Google account256- Never commit data/ directory257- Regularly refresh auth258- Track all access259260## Common Workflows for Claude261262### Workflow 1: User Sends NotebookLM URL263264```python265# 1. Detect URL in message266if "notebooklm.google.com" in user_message:267url = extract_url(user_message)268269# 2. Check if in library270notebooks = run("notebook_manager.py list")271272if url not in notebooks:273# 3. ASK USER FOR METADATA (CRITICAL!)274name = ask_user("What should I call this notebook?")275description = ask_user("What does this notebook contain?")276topics = ask_user("What topics does it cover?")277278# 4. Add with user-provided info279run(f"notebook_manager.py add --url {url} --name '{name}' --description '{description}' --topics '{topics}'")280281# 5. Use the notebook282answer = run(f"ask_question.py --question '{user_question}'")283```284285### Workflow 2: Research Task286287```python288# 1. Understand task289task = "Implement feature X"290291# 2. Formulate comprehensive questions292questions = [293"Complete implementation guide for X",294"Error handling for X",295"Performance considerations for X"296]297298# 3. Query with follow-ups299for q in questions:300answer = run(f"ask_question.py --question '{q}'")301302# Check if follow-up needed303if "Is that ALL you need" in answer:304# Ask more specific question305follow_up = run(f"ask_question.py --question 'Specific detail about {q}'")306307# 4. Synthesize and implement308```309310## Tips and Tricks3113121. **Always use run.py** - Prevents all venv issues3132. **Ask for metadata** - Never guess notebook contents3143. **Use verbose questions** - Include all context3154. **Follow up automatically** - When you see the prompt3165. **Monitor rate limits** - 50 queries per day3176. **Batch operations** - Group related queries3187. **Export important answers** - Save locally3198. **Version control notebooks** - Track changes3209. **Test auth regularly** - Before important tasks32110. **Document everything** - Keep notes on notebooks322323## Quick Reference324325```bash326# Always use run.py!327python scripts/run.py [script].py [args]328329# Common operations330run.py auth_manager.py status # Check auth331run.py auth_manager.py setup # Login (browser visible!)332run.py notebook_manager.py list # List notebooks333run.py notebook_manager.py add ... # Add (ask user for metadata!)334run.py ask_question.py --question ... # Query335run.py cleanup_manager.py ... # Clean up336```337338**Remember:** When in doubt, use run.py and ask the user for notebook details!