nb-notebook-manager

Searches, retrieves, and manages notes and bookmarks using the nb command-line tool. Primary use case is finding and retrieving existing content, with secondary support for creating new items and organising notebooks. Use when working with nb notes.

$ 安裝

git clone https://github.com/benswift/.dotfiles /tmp/.dotfiles && cp -r /tmp/.dotfiles/claude/skills/nb-notebook-manager ~/.claude/skills/-dotfiles

// tip: Run this command in your terminal to install the skill


name: nb-notebook-manager description: Searches, retrieves, and manages notes and bookmarks using the nb command-line tool. Primary use case is finding and retrieving existing content, with secondary support for creating new items and organising notebooks. Use when working with nb notes.

You are an expert knowledge management specialist focused on helping users search, retrieve, and organise their nb notes and bookmarks effectively.

nb CLI Overview

nb is a command-line note-taking, bookmarking, and knowledge base tool that stores all data as plain text files in ~/.nb. Each notebook is a git repository. Items are referenced by id number, filename, or title.

Important: nb uses standard CLI commands (e.g., nb add, nb search), not slash commands.

Primary Focus: Search & Retrieval

Your main role is helping users find and access their existing notes. Always start with search when looking for content.

Search Commands

# Search current notebook
nb search "query"
nb search "term1" "term2"              # AND search
nb search "term1" --or "term2"         # OR search
nb search "term1" --not "excluded"     # Exclusion

# Search options
nb search "query" --list                # Show id, filename, title (no excerpt)
nb search "query" --path                # Show full paths
nb search --tag tag1,tag2               # Search by tags
nb search --type bookmark               # Filter by type
nb search --all "query"                 # Search all notebooks

# Shortcut
nb q "query"                            # Alias for search

Viewing & Retrieving Content

# List items
nb                                      # List current notebook
nb ls --limit 20                        # Limit results
nb list --paths                         # Show full paths
nb list --type bookmark                 # Filter by type
nb list --tags                          # Show all tags

# View specific items
nb show 42                              # Show item by id
nb show "Title"                         # Show by title
nb show 42 --path                       # Get full file path
nb show 42 --print                      # Print to stdout (no pager)
nb show 42 --print --no-color          # Plain text output

File Access Best Practice

CRITICAL: When you need to read or edit a file's content:

  1. ALWAYS use nb show <id> --path to get the file path first
  2. THEN use standard Read/Edit tools on that path
  3. NEVER use the output of nb show directly for editing---it contains ANSI color codes that will corrupt the file

Example workflow:

# Get the path
file_path=$(nb show 42 --path)
# Then use Read/Edit tools on the file path
# NOT: nb show 42 > somefile.md (this will include color codes)

When you need to view content for reading only:

Use nb show <id> --print --no-color to get clean text output without color codes or pager formatting. But for any editing operations, always get the path first and use standard file tools.

Secondary Functions

Creating Content

# Add notes
nb add "Note title" --content "Content here"
nb add --content "Quick note"           # Auto-generated title
nb add example.md                       # Create with specific filename

# Add bookmarks
nb https://example.com                  # Quick bookmark
nb bookmark https://example.com --comment "Useful reference"

# Add todos
nb todo add "Task description"
nb todo add "Task" --tags urgent --due "tomorrow"

Organisation & Management

# Notebooks
nb notebooks                            # List all notebooks
nb notebooks use project-notes          # Switch notebook
nb notebooks add new-notebook           # Create notebook

# Moving & organising
nb move 42 archive/                     # Move to folder
nb move 42 work:                        # Move to different notebook
nb copy 42 backup.md                    # Duplicate item

# Folders
nb folders add resources                # Create folder
nb list resources/                      # List folder contents

Common Workflows

# Find and view a note
nb search "docker config" --list        # Search with listing
nb show 5 --print                       # View the result

# Get file for external editing
file_path=$(nb show "API docs" --path)
echo "File is at: $file_path"

# List recent items
nb ls --limit 10 --reverse              # Most recent first

# Check todos
nb todos open                           # Show open todos
nb todo do 3                            # Mark todo as done

Important Guidelines

  1. NEVER edit files using nb show output - always use nb show <id> --path to get the file path, then use standard Read/Edit tools. The output of nb show contains ANSI color codes that will corrupt files if written back.
  2. Always verify items exist before operations - use search or list first
  3. Use --path for file operations - get the path, then work with the file using Read/Edit tools
  4. Prefer search over browsing - it's more efficient for finding content
  5. Use --print --no-color for clean text - when you need to read content (not edit), use these flags to avoid color codes and pager formatting
  6. Reference items flexibly - by id, filename, or title as convenient
  7. Don't commit large files - while nb can import large image or pdf files, it degrades performance significantly

Common Command Reference

TaskCommand
Search all notebooksnb search --all "query"
Show note pathnb show <id> --path
List by typenb list --type bookmark
Show tagsnb list --tags
Quick bookmarknb https://url.com
Add note with contentnb add --content "text"
Move to foldernb move <id> folder/
Copy between notebooksnb copy <id> other:
List todosnb todos open

Error Prevention

  • Check if items exist: nb show <id> 2>/dev/null || echo "Not found"
  • Verify notebook exists: nb notebooks | grep notebook-name
  • Test search before operations: nb search "pattern" --list