Claude Skill

notion

Operate Notion from a terminal or agent: retrieve pages, query databases, search pages and databases, and update page properties — with a bundled notion-cli script that is read-only by default and gates every create or update behind a --dry-run/--yes confirmation. Use when an age

LLM Mart · 0 points · 13 views 0 listing impressions 0 install-command copies
Download magnus919-agent-skills-notion-06ca706.zip · 21 KB

Install

skills CLI npx skills add https://github.com/magnus919/agent-skills/tree/main/notion
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart
Git git clone https://github.com/magnus919/agent-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole magnus919/agent-skills collection as a plugin from our marketplace. Git is the plain clone.

README

Notion — Read and Edit Notion from the Terminal

Operate Notion without leaving your terminal or your agent's tool loop: retrieve pages, query databases, search across the workspace, and make confirmed property updates.

Why Install This Skill

Teams run their operational memory in Notion — runbooks, on-call docs, product trackers, decision logs — and agents have had no bounded way to read it. This skill gives your agent a real read path (page retrieval, database queries, search) and a safe write path: creating a page or updating a property is a guarded mutation that requires a preview and an explicit confirmation, so the agent can answer questions from Notion without ever silently editing shared content.

It ships notion-cli, a small Python script that speaks the Notion API with no third-party dependencies. Reads are capped (--limit), output is clean JSON for the agent or readable text for you, and --help works with no token and no network. The script sends the standard Notion-Version header and summarizes pages as title + ID + URL instead of dumping raw block trees.

Page reads also include compact, typed property values so you can check a status, checkbox, number, or text before and after an update. Use repeatable --property flags to read only the fields you need; missing, truncated, and paginated incomplete values are visibly marked, including in human-readable output.

What You Get

Directory Purpose
SKILL.md Agent-facing operating contract, mutation gates, and verification boundaries
references/ Dated source index and an API operations reference (endpoints, pagination, property types, filters, errors)
scripts/notion-cli Bounded, stdlib-only CLI: pages get/create/update, databases query, search; --json, --limit, mutations gated by --dry-run/--yes
tests/ 21 deterministic tests against a stub Notion API, including typed property read-back and the mutation gate
evals/evals.json Six output-quality evaluation cases for agent runs

Quick Start

# Help works with no token and no network
notion/scripts/notion-cli --help

# Find a page by text (bounded)
NOTION_TOKEN=secret_... notion/scripts/notion-cli --json search query --query "on-call runbook"

# Retrieve one page
NOTION_TOKEN=secret_... notion/scripts/notion-cli --json pages get --page-id <page-id>

# Read back selected properties after an update
NOTION_TOKEN=secret_... notion/scripts/notion-cli --json pages get --page-id <page-id> --property Status --property Reviewer

# Query a database, capped at 10 rows
NOTION_TOKEN=secret_... notion/scripts/notion-cli --json --limit 10 databases query --database-id <db-id>

# Update a page property: preview first, then confirm
printf '{"Status": {"select": {"name": "Done"}}}' > props.json
NOTION_TOKEN=secret_... notion/scripts/notion-cli pages update --page-id <page-id> --properties props.json --dry-run
NOTION_TOKEN=secret_... notion/scripts/notion-cli pages update --page-id <page-id> --properties props.json --yes

Triggers

Load this skill for notion operations: "what does the runbook say", reading pages, querying a Notion database (rows, filters), searching pages and databases, creating a page row, or updating a page property with confirmation. Do not load it for building Notion integrations or apps, workspace administration, or other knowledge bases like Confluence.

Requirements

  • Python 3.9+ for notion-cli (stdlib only; --help needs nothing else).
  • A Notion integration token (NOTION_TOKEN, secret_...) with the workspace pages/databases you need shared with the integration. Search and database access require the corresponding capabilities in the integration settings.
  • Network access to api.notion.com for live reads and writes. Optionally set NOTION_VERSION to pin the API version (default 2022-06-28).

Skill manifest

Notion Operations

Use this skill to read and, with explicit confirmation, write Notion content through the Notion API: pages, database queries, search, and page property updates. This is a tool skill for the Notion platform. Building Notion integrations, writing complex block compositions, or building an app on the Notion API is application development; this skill owns the everyday agent workflow: finding the right page, answering from a database, and making a confirmed edit.

Operating contract

  1. Read-only discovery before any mutation. Retrieve pages, query databases, and search freely. The bundled notion-cli script makes reads without writing anything.
  2. Confirm the target, scope, and rollback path before acting. Creating a page or updating properties changes a shared workspace that teammates read. Both require an explicit human directive plus --dry-run preview and --yes confirmation through notion-cli. Property updates overwrite existing values — state the current value and the replacement before confirming.
  3. Respect bounded reads. Notion paginates with page_size and has_more; never page past what the task needs. notion-cli --limit caps every search and query.
  4. Keep evidence bounded. Quote short page titles, property values, and IDs; never paste full pages, tokens, or raw API payloads into chat.
  5. Know the API version. The Notion-Version header pins the API contract; reads that work today can change with a version bump. notion-cli sends 2022-06-28 by default and honors NOTION_VERSION.

The notion-cli script

scripts/notion-cli is an agent-first, stdlib-only CLI over the Notion API. It covers the full issue scope: pages, databases (query), search, and updates.

notion/scripts/notion-cli --help                           # no token or network needed
notion/scripts/notion-cli --json pages get --page-id <page>
# Read only properties you plan to change; absent names are marked explicitly
notion/scripts/notion-cli --json pages get --page-id <page> --property Status --property Reviewer
notion/scripts/notion-cli --json --limit 10 databases query --database-id <db>
notion/scripts/notion-cli --json search query --query "on-call runbook"
notion/scripts/notion-cli pages update --page-id <page> --properties props.json --dry-run
notion/scripts/notion-cli pages update --page-id <page> --properties props.json --yes
notion/scripts/notion-cli pages create --parent-database <db> --title "New row" --yes

Exit codes: 0 success, 1 API error or failed check, 2 usage error. Creates and updates are guarded: without --dry-run or --yes the script refuses with exit 1 and never calls the API. Reads are bounded by --limit (default 20, max 100).

Operating loop

  1. Locate the content: search query to find pages and databases by text, or a known ID directly.
  2. Read with bounds: pages get for a single page, databases query for rows in a database (optionally with a JSON --filter), always capped by --limit.
  3. Triage the answer: map the question to evidence (page title + properties, database rows, search results with has_more state).
  4. Act with confirmation: only a human directive to change, previewed with --dry-run and confirmed with --yes.
  5. Verify: re-read the page (pages get) and confirm the property values landed.

Pages, databases, search

  • Pages (GET /pages/{id}): a page is an ID, a title (extracted from the title or Name property), a URL, timestamps, and typed property summaries. JSON output includes each property's type, value, and completeness; --property NAME may be repeated to select properties and marks a requested absent property as present: false. Human output marks incomplete properties as <incomplete: reason>. Long text also includes a truncation marker and original character count, so it cannot be mistaken for a verified full value.
  • Databases (POST /databases/{id}/query): query rows as pages with a page_size cap and an optional structured --filter JSON file (e.g. {"property": "Status", "select": {"equals": "Done"}}). has_more tells you whether the cap hid further rows.
  • Search (POST /search): finds pages and databases by text across the integration's accessible workspace; results are bounded by --limit.
  • Updates (PATCH /pages/{id}): property updates overwrite values (select, status, checkbox, rich text, etc.). Preview the exact properties payload with --dry-run and confirm with --yes; verify with a follow-up pages get.

Integration access model

  • Notion integrations authenticate with a bot-style token (secret_...) and can only see the pages and databases explicitly shared with the integration. A page that exists in the workspace but is not shared returns 404/object_not_found — that is an access-model result, not a missing page.
  • The Notion-Version header selects the API contract. The CLI defaults to 2022-06-28; set NOTION_VERSION when a workspace or application pins a different version.
  • Tokens are workspace-scoped credentials. Store them in the environment (NOTION_TOKEN), never in code, chat, or commits. Revoke a leaked integration token in the Notion integration settings.

Reference routing

Load when Reference
Sources, version notes, refresh procedure references/00-source-index.md
API endpoints, pagination, property types, filters, and error handling references/01-api-operations.md

Included artifacts

  • scripts/notion-cli: bounded, stdlib-only CLI (pages get/create/update, databases query, search; --json; --limit; mutations gated by --dry-run/--yes).
  • tests/test_notion_cli.py: 21 deterministic tests against a stub Notion API, including typed property read-back, explicit absent/truncated states, pagination failures, the mutation gate, and the read-only contract.
  • references/: dated source index + API operations reference.
  • evals/evals.json: six output-quality evaluation cases for agent runs.

Verification boundary

Claim Minimum evidence
A page exists and its title notion-cli pages get --page-id ... --json returns the title and ID
A database query answered the question notion-cli databases query --json returns bounded rows with has_more state
Search found the content notion-cli search query --json returns the matching page/database with ID and title
An update landed notion-cli pages update --yes exits 0 and a follow-up pages get --property NAME shows each changed property's typed value; compare it with the requested value
A mutation is safe to run notion-cli ... --dry-run prints the exact payload that would be sent

Hard boundaries

  • Never create or update a page without a human directive, --dry-run preview, and --yes confirmation — Notion edits are visible to everyone with access to the page.
  • Never claim a page is missing when it may simply not be shared with the integration; verify the access model first.
  • Never page reads past --limit; never dump full pages, tokens, or raw payloads into chat.
  • This skill operates the Notion API. It does not build Notion integrations (application development) or cover other knowledge-base products.

When not to use

  • Building Notion integrations or apps (OAuth flows, custom blocks, public API products, block-tree composition beyond property updates) — that is application development; see backend-engineering for service design.
  • Other knowledge bases and document tools (Confluence, Google Docs, wikis) — each has its own tooling; this skill covers Notion only.
  • Workspace administration (user management, workspace settings, integration approval) — that is the Notion admin console.
Files (agent-skills)
  • evals
    • evals.json 6.4 KB
      Loading…
  • references
    • 00-source-index.md 1.5 KB
      Loading…
    • 01-api-operations.md 4.9 KB
      Loading…
  • scripts
    • notion-cli 22.8 KB · in bundle
  • tests
    • test_notion_cli.py 20.8 KB
      Loading…
  • README.md 3.8 KB
    # Notion — Read and Edit Notion from the Terminal
    
    Operate Notion without leaving your terminal or your agent's tool loop: retrieve pages, query databases, search across the workspace, and make confirmed property updates.
    
    ## Why Install This Skill
    
    Teams run their operational memory in Notion — runbooks, on-call docs, product trackers, decision logs — and agents have had no bounded way to read it. This skill gives your agent a real read path (page retrieval, database queries, search) and a safe write path: creating a page or updating a property is a guarded mutation that requires a preview and an explicit confirmation, so the agent can answer questions from Notion without ever silently editing shared content.
    
    It ships `notion-cli`, a small Python script that speaks the Notion API with no third-party dependencies. Reads are capped (`--limit`), output is clean JSON for the agent or readable text for you, and `--help` works with no token and no network. The script sends the standard `Notion-Version` header and summarizes pages as title + ID + URL instead of dumping raw block trees.
    
    Page reads also include compact, typed property values so you can check a status, checkbox, number, or text before and after an update. Use repeatable `--property` flags to read only the fields you need; missing, truncated, and paginated incomplete values are visibly marked, including in human-readable output.
    
    ## What You Get
    
    | Directory | Purpose |
    |---|---|
    | `SKILL.md` | Agent-facing operating contract, mutation gates, and verification boundaries |
    | `references/` | Dated source index and an API operations reference (endpoints, pagination, property types, filters, errors) |
    | `scripts/notion-cli` | Bounded, stdlib-only CLI: pages get/create/update, databases query, search; `--json`, `--limit`, mutations gated by `--dry-run`/`--yes` |
    | `tests/` | 21 deterministic tests against a stub Notion API, including typed property read-back and the mutation gate |
    | `evals/evals.json` | Six output-quality evaluation cases for agent runs |
    
    ## Quick Start
    
    ```bash
    # Help works with no token and no network
    notion/scripts/notion-cli --help
    
    # Find a page by text (bounded)
    NOTION_TOKEN=secret_... notion/scripts/notion-cli --json search query --query "on-call runbook"
    
    # Retrieve one page
    NOTION_TOKEN=secret_... notion/scripts/notion-cli --json pages get --page-id <page-id>
    
    # Read back selected properties after an update
    NOTION_TOKEN=secret_... notion/scripts/notion-cli --json pages get --page-id <page-id> --property Status --property Reviewer
    
    # Query a database, capped at 10 rows
    NOTION_TOKEN=secret_... notion/scripts/notion-cli --json --limit 10 databases query --database-id <db-id>
    
    # Update a page property: preview first, then confirm
    printf '{"Status": {"select": {"name": "Done"}}}' > props.json
    NOTION_TOKEN=secret_... notion/scripts/notion-cli pages update --page-id <page-id> --properties props.json --dry-run
    NOTION_TOKEN=secret_... notion/scripts/notion-cli pages update --page-id <page-id> --properties props.json --yes
    ```
    
    ## Triggers
    
    Load this skill for `notion` operations: "what does the runbook say", reading pages, querying a Notion database (rows, filters), searching pages and databases, creating a page row, or updating a page property with confirmation. Do not load it for building Notion integrations or apps, workspace administration, or other knowledge bases like Confluence.
    
    ## Requirements
    
    - Python 3.9+ for `notion-cli` (stdlib only; `--help` needs nothing else).
    - A Notion integration token (`NOTION_TOKEN`, `secret_...`) with the workspace pages/databases you need **shared with the integration**. Search and database access require the corresponding capabilities in the integration settings.
    - Network access to `api.notion.com` for live reads and writes. Optionally set `NOTION_VERSION` to pin the API version (default `2022-06-28`).
    
  • SKILL.md 8.7 KB
    ---
    name: notion
    description: >-
      Operate Notion from a terminal or agent: retrieve pages, query databases,
      search pages and databases, and update page properties — with a bundled
      notion-cli script that is read-only by default and gates every create or
      update behind a --dry-run/--yes confirmation. Use when an agent needs to
      read Notion content, answer questions from a team wiki or database, or make
      a confirmed edit. Do not use for building Notion integrations or
      block-level page composition beyond property updates (that is Notion API
      application development), or for other knowledge bases (that is their own
      tooling).
    license: MIT
    compatibility: >-
      The bundled notion-cli script runs on Python 3.9+ with only the standard
      library. --help and page/database/search reads need no network; live reads
      require a Notion integration token (secret_...) with the right workspace
      capabilities and network access to api.notion.com.
    metadata:
      source: https://developers.notion.com/reference
      source_index: references/00-source-index.md
      research_checked: "2026-08-03"
    ---
    
    # Notion Operations
    
    Use this skill to read and, with explicit confirmation, write Notion content through the Notion API: pages, database queries, search, and page property updates. This is a **tool skill** for the Notion platform. Building Notion integrations, writing complex block compositions, or building an app on the Notion API is application development; this skill owns the everyday agent workflow: finding the right page, answering from a database, and making a confirmed edit.
    
    ## Operating contract
    
    1. **Read-only discovery before any mutation.** Retrieve pages, query databases, and search freely. The bundled `notion-cli` script makes reads without writing anything.
    2. **Confirm the target, scope, and rollback path before acting.** Creating a page or updating properties changes a shared workspace that teammates read. Both require an explicit human directive plus `--dry-run` preview and `--yes` confirmation through `notion-cli`. Property updates overwrite existing values — state the current value and the replacement before confirming.
    3. **Respect bounded reads.** Notion paginates with `page_size` and `has_more`; never page past what the task needs. `notion-cli --limit` caps every search and query.
    4. **Keep evidence bounded.** Quote short page titles, property values, and IDs; never paste full pages, tokens, or raw API payloads into chat.
    5. **Know the API version.** The `Notion-Version` header pins the API contract; reads that work today can change with a version bump. `notion-cli` sends `2022-06-28` by default and honors `NOTION_VERSION`.
    
    ## The notion-cli script
    
    `scripts/notion-cli` is an agent-first, stdlib-only CLI over the Notion API. It covers the full issue scope: pages, databases (query), search, and updates.
    
    ```bash
    notion/scripts/notion-cli --help                           # no token or network needed
    notion/scripts/notion-cli --json pages get --page-id <page>
    # Read only properties you plan to change; absent names are marked explicitly
    notion/scripts/notion-cli --json pages get --page-id <page> --property Status --property Reviewer
    notion/scripts/notion-cli --json --limit 10 databases query --database-id <db>
    notion/scripts/notion-cli --json search query --query "on-call runbook"
    notion/scripts/notion-cli pages update --page-id <page> --properties props.json --dry-run
    notion/scripts/notion-cli pages update --page-id <page> --properties props.json --yes
    notion/scripts/notion-cli pages create --parent-database <db> --title "New row" --yes
    ```
    
    Exit codes: 0 success, 1 API error or failed check, 2 usage error. Creates and updates are guarded: without `--dry-run` or `--yes` the script refuses with exit 1 and never calls the API. Reads are bounded by `--limit` (default 20, max 100).
    
    ## Operating loop
    
    1. **Locate the content**: `search query` to find pages and databases by text, or a known ID directly.
    2. **Read with bounds**: `pages get` for a single page, `databases query` for rows in a database (optionally with a JSON `--filter`), always capped by `--limit`.
    3. **Triage the answer**: map the question to evidence (page title + properties, database rows, search results with `has_more` state).
    4. **Act with confirmation**: only a human directive to change, previewed with `--dry-run` and confirmed with `--yes`.
    5. **Verify**: re-read the page (`pages get`) and confirm the property values landed.
    
    ## Pages, databases, search
    
    - **Pages** (`GET /pages/{id}`): a page is an ID, a title (extracted from the `title` or `Name` property), a URL, timestamps, and typed property summaries. JSON output includes each property's type, value, and completeness; `--property NAME` may be repeated to select properties and marks a requested absent property as `present: false`. Human output marks incomplete properties as `<incomplete: reason>`. Long text also includes a truncation marker and original character count, so it cannot be mistaken for a verified full value.
    - **Databases** (`POST /databases/{id}/query`): query rows as pages with a `page_size` cap and an optional structured `--filter` JSON file (e.g. `{"property": "Status", "select": {"equals": "Done"}}`). `has_more` tells you whether the cap hid further rows.
    - **Search** (`POST /search`): finds pages and databases by text across the integration's accessible workspace; results are bounded by `--limit`.
    - **Updates** (`PATCH /pages/{id}`): property updates overwrite values (select, status, checkbox, rich text, etc.). Preview the exact properties payload with `--dry-run` and confirm with `--yes`; verify with a follow-up `pages get`.
    
    ## Integration access model
    
    - Notion integrations authenticate with a bot-style token (`secret_...`) and can only see the pages and databases explicitly **shared with the integration**. A page that exists in the workspace but is not shared returns 404/`object_not_found` — that is an access-model result, not a missing page.
    - The `Notion-Version` header selects the API contract. The CLI defaults to `2022-06-28`; set `NOTION_VERSION` when a workspace or application pins a different version.
    - Tokens are workspace-scoped credentials. Store them in the environment (`NOTION_TOKEN`), never in code, chat, or commits. Revoke a leaked integration token in the Notion integration settings.
    
    ## Reference routing
    
    | Load when | Reference |
    |---|---|
    | Sources, version notes, refresh procedure | `references/00-source-index.md` |
    | API endpoints, pagination, property types, filters, and error handling | `references/01-api-operations.md` |
    
    ## Included artifacts
    
    - `scripts/notion-cli`: bounded, stdlib-only CLI (pages get/create/update, databases query, search; `--json`; `--limit`; mutations gated by `--dry-run`/`--yes`).
    - `tests/test_notion_cli.py`: 21 deterministic tests against a stub Notion API, including typed property read-back, explicit absent/truncated states, pagination failures, the mutation gate, and the read-only contract.
    - `references/`: dated source index + API operations reference.
    - `evals/evals.json`: six output-quality evaluation cases for agent runs.
    
    ## Verification boundary
    
    | Claim | Minimum evidence |
    |---|---|
    | A page exists and its title | `notion-cli pages get --page-id ... --json` returns the title and ID |
    | A database query answered the question | `notion-cli databases query --json` returns bounded rows with `has_more` state |
    | Search found the content | `notion-cli search query --json` returns the matching page/database with ID and title |
    | An update landed | `notion-cli pages update --yes` exits 0 and a follow-up `pages get --property NAME` shows each changed property's typed value; compare it with the requested value |
    | A mutation is safe to run | `notion-cli ... --dry-run` prints the exact payload that would be sent |
    
    ## Hard boundaries
    
    - Never create or update a page without a human directive, `--dry-run` preview, and `--yes` confirmation — Notion edits are visible to everyone with access to the page.
    - Never claim a page is missing when it may simply not be shared with the integration; verify the access model first.
    - Never page reads past `--limit`; never dump full pages, tokens, or raw payloads into chat.
    - This skill operates the Notion API. It does not build Notion integrations (application development) or cover other knowledge-base products.
    
    ## When not to use
    
    - **Building Notion integrations or apps** (OAuth flows, custom blocks, public API products, block-tree composition beyond property updates) — that is application development; see [backend-engineering](../backend-engineering/SKILL.md) for service design.
    - **Other knowledge bases and document tools** (Confluence, Google Docs, wikis) — each has its own tooling; this skill covers Notion only.
    - **Workspace administration** (user management, workspace settings, integration approval) — that is the Notion admin console.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.