NotebookLM Research Assistant Skill
Interact with Google NotebookLM to query documentation with Gemini's source-grounded answers. Each question opens a fresh browser session, retrieves the answer exclusively from your uploaded documents, and closes.
When to Use This Skill
Trigger when user:
- - Mentions NotebookLM explicitly
- Shares NotebookLM URL (
https://notebooklm.google.com/notebook/...) - Asks to query their notebooks/documentation
- Wants to add documentation to NotebookLM library
- Uses phrases like "ask my NotebookLM", "check my docs", "query my notebook"
⚠️ CRITICAL: Add Command - Smart Discovery
When user wants to add a notebook without providing details:
SMART ADD (Recommended): Query the notebook first to discover its content:
CODEBLOCK0
MANUAL ADD: If user provides all details:
- -
--url - The NotebookLM URL - INLINECODE2 - A descriptive name
- INLINECODE3 - What the notebook contains (REQUIRED!)
- INLINECODE4 - Comma-separated topics (REQUIRED!)
NEVER guess or use generic descriptions! If details missing, use Smart Add to discover them.
Critical: Always Use run.py Wrapper
NEVER call scripts directly. ALWAYS use python scripts/run.py [script]:
CODEBLOCK1
The run.py wrapper automatically:
- 1. Creates
.venv if needed - Installs all dependencies
- Activates environment
- Executes script properly
Core Workflow
Step 1: Check Authentication Status
CODEBLOCK2
If not authenticated, proceed to setup.
Step 2: Authenticate (One-Time Setup)
CODEBLOCK3
Important:
- - Browser is VISIBLE for authentication
- Browser window opens automatically
- User must manually log in to Google
- Tell user: "A browser window will open for Google login"
Step 3: Manage Notebook Library
CODEBLOCK4
Quick Workflow
- 1. Check library: INLINECODE8
- Ask question: INLINECODE9
Step 4: Ask Questions
CODEBLOCK5
Follow-Up Mechanism (CRITICAL)
Every NotebookLM answer ends with: "EXTREMELY IMPORTANT: Is that ALL you need to know?"
Required Claude Behavior:
- 1. STOP - Do not immediately respond to user
- ANALYZE - Compare answer to user's original request
- IDENTIFY GAPS - Determine if more information needed
- ASK FOLLOW-UP - If gaps exist, immediately ask:
python scripts/run.py ask_question.py --question "Follow-up with context..."
- 5. REPEAT - Continue until information is complete
- SYNTHESIZE - Combine all answers before responding to user
Script Reference
Authentication Management (auth_manager.py)
CODEBLOCK7
Notebook Management (notebook_manager.py)
CODEBLOCK8
Question Interface (ask_question.py)
CODEBLOCK9
Data Cleanup (cleanup_manager.py)
CODEBLOCK10
Environment Management
The virtual environment is automatically managed:
- - First run creates
.venv automatically - Dependencies install automatically
- Chromium browser installs automatically
- Everything isolated in skill directory
Manual setup (only if automatic fails):
CODEBLOCK11
Data Storage
All data stored in ~/.claude/skills/notebooklm/data/:
- -
library.json - Notebook metadata - INLINECODE17 - Authentication status
- INLINECODE18 - Browser cookies and session
Security: Protected by .gitignore, never commit to git.
Configuration
Optional .env file in skill directory:
CODEBLOCK12
Decision Flow
CODEBLOCK13
Troubleshooting
| Problem | Solution |
|---|
| ModuleNotFoundError | Use run.py wrapper |
| Authentication fails |
Browser must be visible for setup! --show-browser |
| Rate limit (50/day) | Wait or switch Google account |
| Browser crashes |
python scripts/run.py cleanup_manager.py --preserve-library |
| Notebook not found | Check with
notebook_manager.py list |
Best Practices
- 1. Always use run.py - Handles environment automatically
- Check auth first - Before any operations
- Follow-up questions - Don't stop at first answer
- Browser visible for auth - Required for manual login
- Include context - Each question is independent
- Synthesize answers - Combine multiple responses
Limitations
- - No session persistence (each question = new browser)
- Rate limits on free Google accounts (50 queries/day)
- Manual upload required (user must add docs to NotebookLM)
- Browser overhead (few seconds per question)
Resources (Skill Structure)
Important directories and files:
- -
scripts/ - All automation scripts (askquestion.py, notebookmanager.py, etc.) - INLINECODE25 - Local storage for authentication and notebook library
- INLINECODE26 - Extended documentation:
-
api_reference.md - Detailed API documentation for all scripts
-
troubleshooting.md - Common issues and solutions
-
usage_patterns.md - Best practices and workflow examples
- -
.venv/ - Isolated Python environment (auto-created on first run) - INLINECODE31 - Protects sensitive data from being committed
NotebookLM 研究助手技能
与 Google NotebookLM 交互,使用 Gemini 基于来源的答案查询文档。每个问题都会打开一个新的浏览器会话,仅从您上传的文档中检索答案,然后关闭。
何时使用此技能
当用户出现以下情况时触发:
- - 明确提及 NotebookLM
- 分享 NotebookLM URL(https://notebooklm.google.com/notebook/...)
- 要求查询他们的笔记本/文档
- 想要将文档添加到 NotebookLM 库
- 使用诸如询问我的 NotebookLM、查看我的文档、查询我的笔记本等短语
⚠️ 关键:添加命令 - 智能发现
当用户想要添加笔记本但未提供详细信息时:
智能添加(推荐):先查询笔记本以发现其内容:
bash
步骤 1:查询笔记本内容
python scripts/run.py ask_question.py --question 这个笔记本的内容是什么?涵盖哪些主题?请简洁地提供完整概述 --notebook-url [URL]
步骤 2:使用发现的信息进行添加
python scripts/run.py notebook_manager.py add --url [URL] --name [基于内容] --description [基于内容] --topics [基于内容]
手动添加:如果用户提供所有详细信息:
- - --url - NotebookLM URL
- --name - 描述性名称
- --description - 笔记本包含的内容(必填!)
- --topics - 逗号分隔的主题(必填!)
切勿猜测或使用通用描述!如果缺少详细信息,请使用智能添加进行发现。
关键:始终使用 run.py 包装器
切勿直接调用脚本。始终使用 python scripts/run.py [脚本]:
bash
✅ 正确 - 始终使用 run.py:
python scripts/run.py auth_manager.py status
python scripts/run.py notebook_manager.py list
python scripts/run.py ask_question.py --question ...
❌ 错误 - 切勿直接调用:
python scripts/auth_manager.py status # 没有虚拟环境会失败!
run.py 包装器会自动:
- 1. 在需要时创建 .venv
- 安装所有依赖项
- 激活环境
- 正确执行脚本
核心工作流程
步骤 1:检查身份验证状态
bash
python scripts/run.py auth_manager.py status
如果未通过身份验证,则继续设置。
步骤 2:身份验证(一次性设置)
bash
浏览器必须可见以进行手动 Google 登录
python scripts/run.py auth_manager.py setup
重要提示:
- - 浏览器在身份验证时是可见的
- 浏览器窗口会自动打开
- 用户必须手动登录 Google
- 告知用户:将打开一个浏览器窗口用于 Google 登录
步骤 3:管理笔记本库
bash
列出所有笔记本
python scripts/run.py notebook_manager.py list
添加前:如果未知,询问用户元数据!
这个笔记本包含什么?
我应该用什么主题标记它?
将笔记本添加到库(所有参数均为必填!)
python scripts/run.py notebook_manager.py add \
--url https://notebooklm.google.com/notebook/... \
--name 描述性名称 \
--description 这个笔记本包含的内容 \ # 必填 - 如果未知请询问用户!
--topics 主题1,主题2,主题3 # 必填 - 如果未知请询问用户!
按主题搜索笔记本
python scripts/run.py notebook_manager.py search --query 关键词
设置活动笔记本
python scripts/run.py notebook_manager.py activate --id 笔记本-id
移除笔记本
python scripts/run.py notebook_manager.py remove --id 笔记本-id
快速工作流程
- 1. 检查库:python scripts/run.py notebookmanager.py list
- 提问:python scripts/run.py askquestion.py --question ... --notebook-id ID
步骤 4:提问
bash
基本查询(如果已设置,使用活动笔记本)
python scripts/run.py ask_question.py --question 您的问题在这里
查询特定笔记本
python scripts/run.py ask_question.py --question ... --notebook-id 笔记本-id
直接使用笔记本 URL 查询
python scripts/run.py ask_question.py --question ... --notebook-url https://...
显示浏览器以进行调试
python scripts/run.py ask_question.py --question ... --show-browser
跟进机制(关键)
每个 NotebookLM 答案都以以下内容结尾:极其重要:这是您需要知道的全部内容吗?
必需的 Claude 行为:
- 1. 停止 - 不要立即回复用户
- 分析 - 将答案与用户的原始请求进行比较
- 识别差距 - 确定是否需要更多信息
- 询问跟进 - 如果存在差距,立即询问:
bash
python scripts/run.py ask_question.py --question 带有上下文的跟进...
- 5. 重复 - 持续直到信息完整
- 综合 - 在回复用户之前合并所有答案
脚本参考
身份验证管理(auth_manager.py)
bash
python scripts/run.py auth_manager.py setup # 初始设置(浏览器可见)
python scripts/run.py auth_manager.py status # 检查身份验证
python scripts/run.py auth_manager.py reauth # 重新身份验证(浏览器可见)
python scripts/run.py auth_manager.py clear # 清除身份验证
笔记本管理(notebook_manager.py)
bash
python scripts/run.py notebook_manager.py add --url URL --name 名称 --description 描述 --topics 主题
python scripts/run.py notebook_manager.py list
python scripts/run.py notebook_manager.py search --query 查询
python scripts/run.py notebook_manager.py activate --id ID
python scripts/run.py notebook_manager.py remove --id ID
python scripts/run.py notebook_manager.py stats
问题接口(ask_question.py)
bash
python scripts/run.py ask_question.py --question ... [--notebook-id ID] [--notebook-url URL] [--show-browser]
数据清理(cleanup_manager.py)
bash
python scripts/run.py cleanup_manager.py # 预览清理
python scripts/run.py cleanup_manager.py --confirm # 执行清理
python scripts/run.py cleanup_manager.py --preserve-library # 保留笔记本
环境管理
虚拟环境自动管理:
- - 首次运行自动创建 .venv
- 依赖项自动安装
- Chromium 浏览器自动安装
- 所有内容隔离在技能目录中
手动设置(仅在自动失败时):
bash
python -m venv .venv
source .venv/bin/activate # Linux/Mac
pip install -r requirements.txt
python -m patchright install chromium
数据存储
所有数据存储在 ~/.claude/skills/notebooklm/data/ 中:
- - library.json - 笔记本元数据
- authinfo.json - 身份验证状态
- browserstate/ - 浏览器 cookies 和会话
安全: 受 .gitignore 保护,切勿提交到 git。
配置
技能目录中的可选 .env 文件:
env
HEADLESS=false # 浏览器可见性
SHOW_BROWSER=false # 默认浏览器显示
STEALTH_ENABLED=true # 类人行为
TYPINGWPMMIN=160 # 打字速度
TYPINGWPMMAX=240
DEFAULTNOTEBOOKID= # 默认笔记本
决策流程
用户提及 NotebookLM
↓
检查身份验证 → python scripts/run.py auth_manager.py status
↓
如果未通过身份验证 → python scripts/run.py auth_manager.py setup
↓
检查/添加笔记本 → python scripts/run.py notebook_manager.py list/add(带 --description)
↓
激活笔记本 → python scripts/run.py notebook_manager.py activate --id ID
↓
提问 → python scripts/run.py ask_question.py --question ...
↓
看到这是您需要的全部内容吗? → 询问跟进直到完成
↓
综合并回复用户
故障排除
| 问题 | 解决方案 |
|---|
| ModuleNotFoundError | 使用 run.py 包装器 |
| 身份验证失败 |
设置时浏览器必须可见!--show-browser |
| 速率限制(每天50次) | 等待或切换 Google 账户 |
| 浏览器崩溃 | python scripts/run.py cleanup_manager.py --preserve-library |
| 未找到笔记本 | 使用 notebook_manager.py list 检查 |
最佳实践
- 1. 始终使用 run.py - 自动处理环境
2