# 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.

- Skill: `majiayu000/nb-notebook-manager` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/nb-notebook-manager`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/nb-notebook-manager/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/nb-notebook-manager

---


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

```bash
# 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

```bash
# 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:

```bash
# 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

```bash
# 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

```bash
# 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

```bash
# 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

| Task                   | Command                   |
| ---------------------- | ------------------------- |
| Search all notebooks   | `nb search --all "query"` |
| Show note path         | `nb show <id> --path`     |
| List by type           | `nb list --type bookmark` |
| Show tags              | `nb list --tags`          |
| Quick bookmark         | `nb https://url.com`      |
| Add note with content  | `nb add --content "text"` |
| Move to folder         | `nb move <id> folder/`    |
| Copy between notebooks | `nb copy <id> other:`     |
| List todos             | `nb 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`

