mcpField
N
nlm-cli-skill

nlm-cli-skill

github.com/jacob-bd生产力25761 次安装20 周前更新
代码仓库

关于 nlm-cli-skill

nlm-cli-skill 为使用 nlm 命令行自动化 Google NotebookLM 工作流提供操作指南,面向需要管理笔记本、来源、研究和生成内容的用户。内容涵盖命令选择、认证、输出格式及错误恢复。

主要功能

  1. 01NotebookLM 命令操作指南
  2. 02笔记本与来源管理流程
  3. 03研究和内容生成流程
  4. 04认证与会话注意事项
  5. 05别名、输出格式与错误恢复

适用场景

  1. 01创建笔记本并添加网页或文档
  2. 02搜索资料并导入研究来源
  3. 03生成播客、报告、测验或闪卡
  4. 04排查认证过期或命令错误

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/jacob-bd/notebooklm-cli --skill nlm-cli-skill

安装后在 Claude Code 中输入/nlm-cli-skill确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
command_reference.md
troubleshooting.md
workflows.md

详细介绍

NotebookLM CLI 专家

此技能提供有关如何使用 nlm CLI 自动执行 Google NotebookLM 工作流的全面指南。

快速参考

nlm --help              # List all commands
nlm <command> --help    # Help for specific command
nlm --ai                # Full AI-optimized documentation
nlm --version           # Check installed version

关键规则(请先阅读!)

  1. 始终先进行身份验证:执行任何操作前,先运行 nlm login
  2. 会话约 20 分钟后过期:如果命令开始失败,请重新运行 nlm login
  3. 必须使用 --confirm:所有生成和删除命令都需要 --confirm 或 -y
  4. 研究需要 --notebook-id:此标志是必需的,不能作为位置参数
  5. 从输出中获取 ID:创建/启动命令会返回后续操作所需的 ID
  6. 使用别名:通过 nlm alias set <name> <uuid> 简化较长的 UUID
  7. ⚠️ 删除前务必先询问用户:执行任何删除命令前,必须征求用户的明确确认。删除操作不可撤销。说明将删除的内容,并警告数据将永久丢失。
  8. 创建前检查别名:创建新别名前,运行 nlm alias list,以避免与现有名称冲突。
  9. 不要启动 REPL:绝不要使用 nlm chat start——它会打开 AI 工具无法控制的交互式 REPL。单次问答请改用 nlm notebook query。
  10. 明智地选择输出格式:默认输出(不带标志)简洁且节省令牌,适合检查状态。使用 --quiet 获取 ID 以便通过管道传递。仅在需要以编程方式解析特定字段时使用 --json。

工作流决策树

使用此决策树确定合适的命令顺序:

User wants to...
│
├─► Work with NotebookLM for the first time
│   └─► nlm login → nlm notebook create "Title"
│
├─► Add content to a notebook
│   ├─► From a URL/webpage → nlm source add <nb-id> --url "https://..."
│   ├─► From YouTube → nlm source add <nb-id> --url "https://youtube.com/..."
│   ├─► From pasted text → nlm source add <nb-id> --text "content" --title "Title"
│   ├─► From Google Drive → nlm source add <nb-id> --drive <doc-id> --type doc
│   └─► Discover new sources → nlm research start "query" --notebook-id <nb-id>
│
├─► Generate content from sources
│   ├─► Podcast/Audio → nlm audio create <nb-id> --confirm
│   ├─► Written summary → nlm report create <nb-id> --confirm
│   ├─► Study materials → nlm quiz/flashcards create <nb-id> --confirm
│   ├─► Visual content → nlm mindmap/slides/infographic create <nb-id> --confirm
│   ├─► Video → nlm video create <nb-id> --confirm
│   └─► Extract data → nlm data-table create <nb-id> "description" --confirm
│
├─► Ask questions about sources
│   └─► nlm notebook query <nb-id> "question"
│       (Use --conversation-id for follow-ups)
│       ⚠️ Do NOT use `nlm chat start` - it's a REPL for humans only
│
├─► Check generation status
│   └─► nlm studio status <nb-id>
│
└─► Manage/cleanup
    ├─► List notebooks → nlm notebook list
    ├─► List sources → nlm source list <nb-id>
    ├─► Delete source → nlm source delete <source-id> --confirm
    └─► Delete notebook → nlm notebook delete <nb-id> --confirm

命令类别

1. 身份验证
nlm login                    # Launch Chrome, extract cookies (primary method)
nlm login --check            # Validate current session
nlm login --profile work     # Use named profile for multiple accounts
nlm auth status              # Check if authenticated
nlm auth list                # List all profiles

会话时长:约 20 分钟。命令因身份验证错误而失败时,请重新进行身份验证。

2. Notebook 管理
nlm notebook list                      # List all notebooks
nlm notebook list --json               # JSON output for parsing
nlm notebook list --quiet              # IDs only (for scripting)
nlm notebook create "Title"            # Create notebook, returns ID
nlm notebook get <id>                  # Get notebook details
nlm notebook describe <id>             # AI-generated summary + suggested topics
nlm notebook query <id> "question"     # One-shot Q&A with sources
nlm notebook rename <id> "New Title"   # Rename notebook
nlm notebook delete <id> --confirm     # PERMANENT deletion
3. 来源管理
# Adding sources
nlm source add <nb-id> --url "https://..."           # Web page
nlm source add <nb-id> --url "https://youtube.com/..." # YouTube video
nlm source add <nb-id> --text "content" --title "X"  # Pasted text
nlm source add <nb-id> --drive <doc-id>              # Drive doc (auto-detect type)
nlm source add <nb-id> --drive <doc-id> --type slides # Explicit type

# Listing and viewing
nlm source list <nb-id>                # Table of sources
nlm source list <nb-id> --drive        # Show Drive sources with freshness
nlm source list <nb-id> --drive -S     # Skip freshness checks (faster)
nlm source get <source-id>             # Source metadata
nlm source describe <source-id>        # AI summary + keywords
nlm source content <source-id>         # Raw text content
nlm source content <source-id> -o file.txt  # Export to file

# Drive sync (for stale sources)
nlm source stale <nb-id>               # List outdated Drive sources
nlm source sync <nb-id> --confirm      # Sync all stale sources
nlm source sync <nb-id> --source-ids <ids> --confirm  # Sync specific

# Deletion
nlm source delete <source-id> --confirm

Drive 类型:doc、slides、sheets、pdf

4. 研究(来源发现)

研究会从网络或 Google Drive 中查找新来源:

# Start research (--notebook-id is REQUIRED)
nlm research start "query" --notebook-id <id>              # Fast web (~30s)
nlm research start "query" --notebook-id <id> --mode deep  # Deep web (~5min)
nlm research start "query" --notebook-id <id> --source drive  # Drive search

# Check progress
nlm research status <nb-id>                   # Poll until done (5min max)
nlm research status <nb-id> --max-wait 0      # Single check, no waiting
nlm research status <nb-id> --task-id <tid>   # Check specific task
nlm research status <nb-id> --full            # Full details

# Import discovered sources
nlm research import <nb-id> <task-id>            # Import all
nlm research import <nb-id> <task-id> --indices 0,2,5  # Import specific

模式:fast(约 30 秒,约 10 个来源)| deep(约 5 分钟,40 个以上来源,仅限网络)

5. 内容生成(Studio)

所有生成命令都支持以下标志:

  • --confirm 或 -y:执行操作的必需选项
  • --source-ids <id1,id2>:仅限指定来源
  • --language <code>:BCP-47 代码(en、es、fr、de、ja)
# Audio (Podcast)
nlm audio create <id> --confirm
nlm audio create <id> --format deep_dive --length default --confirm
nlm audio create <id> --format brief --focus "key topic" --confirm
# Formats: deep_dive, brief, critique, debate
# Lengths: short, default, long

# Report
nlm report create <id> --confirm
nlm report create <id> --format "Study Guide" --confirm
nlm report create <id> --format "Create Your Own" --prompt "Custom..." --confirm
# Formats: "Briefing Doc", "Study Guide", "Blog Post", "Create Your Own"

# Quiz
nlm quiz create <id> --confirm
nlm quiz create <id> --count 5 --difficulty 3 --confirm
# Count: number of questions (default: 2)
# Difficulty: 1-5 (1=easy, 5=hard)

# Flashcards
nlm flashcards create <id> --confirm
nlm flashcards create <id> --difficulty hard --confirm
# Difficulty: easy, medium, hard

# Mind Map
nlm mindmap create <id> --confirm
nlm mindmap create <id> --title "Topic Overview" --confirm
nlm mindmap list <id>  # List existing mind maps

# Slides
nlm slides create <id> --confirm
nlm slides create <id> --format presenter --length short --confirm
# Formats: detailed, presenter | Lengths: short, default

# Infographic
nlm infographic create <id> --confirm
nlm infographic create <id> --orientation portrait --detail detailed --confirm
# Orientations: landscape, portrait, square
# Detail: concise, standard, detailed

# Video
nlm video create <id> --confirm
nlm video create <id> --format brief --style whiteboard --confirm
# Formats: explainer, brief
# Styles: auto_select, classic, whiteboard, kawaii, anime, watercolor, retro_print, heritage, paper_craft

# Data Table
nlm data-table create <id> "Extract all dates and events" --confirm
# DESCRIPTION is required as second argument
6. Studio(制品管理)

检查和管理生成的内容:

nlm studio status <nb-id>                          # List all artifacts
nlm studio status <nb-id> --json                   # JSON output
nlm studio delete <nb-id> <artifact-id> --confirm  # Delete artifact

状态值:completed(✓)、in_progress(●)、failed(✗)

7. 交互式聊天(仅限用户)

⚠️ AI 工具:不要使用 nlm chat start——它会启动无法通过编程方式控制的交互式 REPL。单次问答请改用 nlm notebook query。

供在终端中操作的用户使用:

nlm chat start <nb-id>  # Launch interactive REPL

REPL 命令:

  • /sources - 列出可用来源
  • /clear - 重置对话上下文
  • /help - 显示命令
  • /exit - 退出 REPL

配置聊天行为(适用于 REPL 和 query):

nlm chat configure <id> --goal default
nlm chat configure <id> --goal learning_guide
nlm chat configure <id> --goal custom --prompt "Act as a tutor..."
nlm chat configure <id> --response-length longer  # longer, default, shorter
8. 别名(UUID 快捷方式)

简化较长的 UUID:

nlm alias set myproject abc123-def456...  # Create alias (auto-detects type)
nlm alias get myproject                    # Resolve to UUID
nlm alias list                             # List all aliases
nlm alias delete myproject                 # Remove alias

# Use aliases anywhere
nlm notebook get myproject
nlm source list myproject
nlm audio create myproject --confirm
9. 配置
nlm config show              # Show current config
nlm config get <key>         # Get specific setting
nlm config set <key> <value> # Update setting

输出格式

大多数列表命令支持多种格式:

标志说明
(无)丰富表格(便于阅读)
--jsonJSON 输出(用于解析)
--quiet仅输出 ID(用于管道传递)
--title“ID: Title”格式
--url“ID: URL”格式(仅限来源)
--full所有列/详细信息

常见模式

模式 1:研究 → 播客工作流
nlm notebook create "AI Research 2026"   # Capture ID
nlm alias set ai <notebook-id>
nlm research start "agentic AI trends" --notebook-id ai --mode deep
nlm research status ai --max-wait 300    # Wait up to 5 min
nlm research import ai <task-id>         # Import all sources
nlm audio create ai --format deep_dive --confirm
nlm studio status ai                     # Check generation progress
模式 2:快速内容导入
nlm source add <id> --url "https://example1.com"
nlm source add <id> --url "https://example2.com"
nlm source add <id> --text "My notes..." --title "Notes"
nlm source list <id>
模式 3:生成学习材料
nlm report create <id> --format "Study Guide" --confirm
nlm quiz create <id> --count 10 --difficulty 3 --confirm
nlm flashcards create <id> --difficulty medium --confirm
模式 4:Drive 文档工作流
nlm source add <id> --drive 1KQH3eW0hMBp7WK... --type slides
# ... time passes, document is edited ...
nlm source stale <id>                    # Check freshness
nlm source sync <id> --confirm           # Sync if stale

错误恢复

错误原因解决方案
"Cookies have expired"会话超时nlm login
"authentication may have expired"会话超时nlm login
"Notebook not found"ID 无效nlm notebook list
"Source not found"ID 无效nlm source list <nb-id>
"Rate limit exceeded"调用次数过多等待 30s 后重试
"Research already in progress"研究任务待处理使用 --force 或先导入
Chrome 无法启动端口冲突关闭 Chrome 后重试

速率限制

请在操作之间留出间隔,以避免触发速率限制:

  • 资源操作:2 秒
  • 内容生成:5 秒
  • 研究操作:2 秒
  • 查询操作:2 秒

进阶参考

如需详细信息,请参阅:

评论

支持 Markdown