Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
smartchainark avatar

Nby Notion Smart Categorize

  • 2 installs
  • Updated April 6, 2026
  • smartchainark/nby-skills

Categorizes Notion pages into the correct subdirectory under a Resources page using content analysis and keyword matching via the Notion REST API.

About

Intelligently files Notion pages into the appropriate subdirectory under a Resources page using content analysis and keyword matching over the Notion REST API. A developer uses it to auto-organize a Notion link or page into the right location.

  • Content-analysis and keyword matching to pick a target subdirectory
  • Uses the Notion REST API directly, no MCP plugin required

Nby Notion Smart Categorize by the numbers

  • 2 all-time installs (skills.sh)
  • Ranked #1,839 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/smartchainark/nby-skills --skill nby-notion-smart-categorize

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2
Last updatedApril 6, 2026
Repositorysmartchainark/nby-skills

What it does

Categorizes Notion pages into the correct subdirectory under a Resources page using content analysis and keyword matching via the Notion REST API.

Files

SKILL.mdMarkdownGitHub ↗

Notion Smart Categorizer

Intelligently categorize Notion pages into the correct subdirectory under a Resources page using the Notion REST API directly. No MCP plugin required.

Language

Match the user's language: respond in the same language the user uses.

Configuration

Credentials (.env)

Check .env existence (priority order):

# Project-level
test -f .nby-skills/nby-notion-smart-categorize/.env && echo "project"
# User-level
test -f "$HOME/.nby-skills/nby-notion-smart-categorize/.env" && echo "user"
PathLocation
.nby-skills/nby-notion-smart-categorize/.envProject directory
$HOME/.nby-skills/nby-notion-smart-categorize/.envUser home
ResultAction
FoundLoad credentials, continue
Not foundRun first-time setup → save → continue

Required keys:

NOTION_TOKEN=your_notion_api_token

Preferences (EXTEND.md)

Check EXTEND.md existence (same priority order):

test -f .nby-skills/nby-notion-smart-categorize/EXTEND.md && echo "project"
test -f "$HOME/.nby-skills/nby-notion-smart-categorize/EXTEND.md" && echo "user"
ResultAction
FoundRead, parse, apply settings
Not foundRun first-time setup → save → continue

Supported keys:

KeyDefaultDescription
resources_id(required)Resources root page ID

Category definitions (add as many as needed):

resources_id: your_resources_page_id

categories:
  - name: AI开发
    id: your_ai_dev_page_id
    keywords: Claude,GPT,Gemini,LLM,MCP,Skills,Cursor,AI工具,前端,UI
  - name: Web3相关
    id: your_web3_page_id
    keywords: DeFi,链上,套利,合约,代币,钱包,Web3,Solana,ETH
  - name: 内容创作
    id: your_content_page_id
    keywords: 小红书,公众号,视频,播客,内容,文案,剪辑

First-Time Setup

When neither .env nor EXTEND.md is found, guide the user:

Notion Smart Categorizer — First-Time Setup

Step 1: API Token
  → Visit https://www.notion.so/my-integrations
  → Create an integration, copy the token
  → Share target Notion pages with the integration

Step 2: Resources Page
  → Open Resources root page in browser, copy the 32-char ID from URL

Step 3: Categories
  → For each sub-category under Resources:
    - Open the page, copy its ID
    - Define a name and comma-separated keywords

Where to save?
  A) Project-level: .nby-skills/nby-notion-smart-categorize/
  B) User-level: ~/.nby-skills/nby-notion-smart-categorize/

After collecting values, create .env (token only) and EXTEND.md (page IDs and categories).

Value Priority

CLI arguments > EXTEND.md (project) > EXTEND.md (user) > Skill defaults

Classification Rules

Priority Order (High to Low)

1. Explicit keyword matching — Match title and content against keywords from each category in EXTEND.md 2. Content semantic analysis — Analyze the primary topic and domain 3. Boundary cases — For cross-domain content, determine primary purpose

For the complete keyword reference and edge case guidance: references/keyword-mapping.md

Execution Workflow

Step 1: Retrieve Page Information

# Get title and parent
curl -s "https://api.notion.com/v1/pages/{PAGE_ID}" \
  -H "Authorization: Bearer ${NOTION_TOKEN}" \
  -H "Notion-Version: 2022-06-28" \
  | python3 -c "
import sys,json; d=json.load(sys.stdin)
for v in d['properties'].values():
    if v.get('type')=='title' and v.get('title'): print('Title:', v['title'][0]['plain_text'])
print('Parent:', d['parent'].get('page_id',''))
"

# Get content (blocks → plain text)
curl -s "https://api.notion.com/v1/blocks/{PAGE_ID}/children?page_size=100" \
  -H "Authorization: Bearer ${NOTION_TOKEN}" \
  -H "Notion-Version: 2022-06-28" \
  | python3 -c "
import sys,json; d=json.load(sys.stdin)
types=['paragraph','heading_1','heading_2','heading_3','bulleted_list_item','numbered_list_item','quote','callout']
for r in d['results']:
    t=r['type']
    if t in types:
        print(''.join(x.get('plain_text','') for x in r[t].get('rich_text',[])))
    elif t=='bookmark': print(f\"[link: {r[t].get('url','')}]\")
"
  • For link-only pages, fetch via Jina: WebFetch: https://r.jina.ai/{LINK_URL}
  • If fetch fails, classify based on title and link domain only

Step 2: Analyze and Classify

Based on title and content, apply classification rules:

  • Match keywords against configured categories
  • Analyze content topic
  • Determine best matching subdirectory

Step 3: Check Current Location

From the parent ID in Step 1:

  • Already in target subdirectory → Inform user, no move needed
  • In another location → Proceed to move

Step 4: Execute Classification

curl -s -X POST "https://api.notion.com/v1/pages/{PAGE_ID}/move" \
  -H "Authorization: Bearer ${NOTION_TOKEN}" \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d "{\"parent\": {\"type\": \"page_id\", \"page_id\": \"${TARGET_CATEGORY_ID}\"}}"

Step 5: Report Result

✅ Categorization complete

📄 Page: 《Page Title》
📁 From: xxx
📂 To: 📖 Resources → [Category Name]
💡 Reason: [Brief classification rationale]

Batch Mode

When processing multiple pages:

1. Retrieve page information for each, analyze classification 2. Group by target category 3. Execute POST /move per page (parallel within same group) 4. Report summary

✅ Batch categorization complete

📊 Summary:
- Total: X pages
- [Category 1]: Y pages
- [Category 2]: Z pages

📝 Details:
[Category 1]
  - 《Page 1》- Reason
  - 《Page 2》- Reason

Special Cases

  • Cannot determine category: Ask user preference, or default to most relevant with explanation
  • Already in correct location: Report no move needed
  • Adding new categories: Add a new entry under categories: in EXTEND.md

Additional Resources

  • `references/keyword-mapping.md` — Complete keyword-to-category mapping table with edge case guidance

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.