
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-categorizeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2 |
|---|---|
| Last updated | April 6, 2026 |
| Repository | smartchainark/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
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"| Path | Location |
|---|---|
.nby-skills/nby-notion-smart-categorize/.env | Project directory |
$HOME/.nby-skills/nby-notion-smart-categorize/.env | User home |
| Result | Action |
|---|---|
| Found | Load credentials, continue |
| Not found | Run first-time setup → save → continue |
Required keys:
NOTION_TOKEN=your_notion_api_tokenPreferences (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"| Result | Action |
|---|---|
| Found | Read, parse, apply settings |
| Not found | Run first-time setup → save → continue |
Supported keys:
| Key | Default | Description |
|---|---|---|
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 defaultsClassification 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》- ReasonSpecial 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:inEXTEND.md
Additional Resources
- `references/keyword-mapping.md` — Complete keyword-to-category mapping table with edge case guidance
# Notion API Token (from https://www.notion.so/my-integrations)
NOTION_TOKEN=your_notion_api_token
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: 小红书,公众号,视频,播客,内容,文案,剪辑
Keyword-to-Category Mapping
Default Category Definitions
The categories below are examples. Actual categories are configured in .env via CATEGORY_*_NAME, CATEGORY_*_ID, and CATEGORY_*_KEYWORDS.
Example Keyword Table
| Keyword | Category |
|---|---|
| Claude, GPT, Gemini, LLM | AI Development |
| MCP, Skills, Prompt Engineering | AI Development |
| Cursor, Windsurf, IDE | AI Development |
| Frontend, UI, Landing Page | AI Development |
| n8n, Automation, Workflow | AI Development |
| DeFi, DEX, Arbitrage | Web3 |
| Smart Contract, On-chain, Wallet | Web3 |
| Token, NFT, RWA | Web3 |
| Solana, ETH, Hyper | Web3 |
| Xiaohongshu, WeChat Official Account, Douyin | Content Creation |
| Video, Podcast, Editing | Content Creation |
| Copywriting, Typography, Graphics | Content Creation |
Edge Case Guidelines
Cross-Domain Content
When content spans multiple categories, determine the primary purpose:
| Scenario | Primary Purpose | Category |
|---|---|---|
| AI trading bot | Trading | Web3 |
| AI copywriting tool | Content creation | Content Creation |
| Web3 tutorial video | Education/content | Content Creation |
| DeFi smart contract audit | Security/blockchain | Web3 |
| AI-powered code editor | Development tool | AI Development |
| NFT art generation | Creative output | Content Creation |
| On-chain data visualization | Data analysis/blockchain | Web3 |
General Rules
- Development tools and programming → AI Development (default)
- Financial, trading, blockchain technology → Web3
- Media, creative, distribution → Content Creation
- When truly ambiguous → Ask user preference or default to the category with the most keyword matches
Adding New Categories
To add a new category: 1. Add CATEGORY_N_NAME, CATEGORY_N_ID, and CATEGORY_N_KEYWORDS to .env 2. Keywords are comma-separated, case-insensitive matching 3. Both Chinese and English keywords are supported