notion-automation

Original🇨🇳 Chinese
Translated

Automate Notion operations. This skill is used when users need to manage Notion pages, databases, block content, project tracking, or perform content organization and search.

2installs
Added on

NPX Install

npx skill4agent add aaaaqwq/claude-code-skills notion-automation

SKILL.md Content (Chinese)

View Translation Comparison →

Notion Automation Management

Function Description

This skill is specifically designed to automate various operations on the Notion platform, including:
  • Page creation, content editing and management
  • Database creation, configuration and query
  • Block operation and content update
  • Page search and content retrieval
  • Project and task tracking management
  • Team collaboration and comment management
  • Page movement and organization structure management

Usage Scenarios

  • "Create a new project page"
  • "Update records in the Notion database"
  • "Search for pages containing specific keywords"
  • "Batch manage page content"
  • "Set up project tracking Kanban"
  • "Manage team collaboration and comments"
  • "Organize and sort out Notion workspace"

Core Function Modules

1. Page Management

  • Create Page: Create a new page and add initial content
  • Update Page: Modify page properties, titles and covers
  • Get Page: Retrieve detailed page information
  • Move Page: Move between different databases or parent pages
  • Delete Page: Archive or delete pages
  • Page Search: Search pages and databases by keywords

2. Database Management

  • Create Database: Create a new database and configure fields
  • Query Database: Filter and retrieve database records
  • Update Database: Modify database structure and properties
  • Get Database Details: View database metadata
  • Database Template: Apply preset templates to create databases

3. Block Operation

  • Get Block Content: Read all blocks under the page
  • Update Block Content: Modify the text and style of the block
  • Add Sub-block: Add sub-elements to the block
  • Delete Block: Remove unwanted blocks
  • Batch Operation: Update multiple blocks at once

4. Content Search

  • Full-text Search: Search page titles and content
  • Database Search: Search in specific databases
  • Filtered Search: Filter results by object type
  • Sort Results: Sort by edit time

5. Collaboration Management

  • Get Users: List workspace users
  • Create Comment: Add comments to pages or blocks
  • Get Comments: View page discussions
  • Page Permissions: Manage page access permissions

6. Project Management

  • Project Page: Create a project overview page
  • Task Kanban: Set up Kanban-style task management
  • Progress Tracking: Update task status and progress
  • Milestone Management: Set project milestones
  • Dependency Relationship: Manage dependencies between tasks

Workflow

Standard Page Creation Process

  1. Create Page: Create a new page and set the title
  2. Add Cover: Set the page cover image
  3. Add Icon: Set the page icon
  4. Fill Content: Add initial content using blocks
  5. Associate Database: Associate with the database if needed
  6. Add Collaborators: Set page collaborators

Database Setup Process

  1. Create Database: Create a new database
  2. Define Fields: Configure attribute types (text, number, date, etc.)
  3. Set Views: Create different views (table, Kanban, calendar)
  4. Add Records: Add initial records in batches
  5. Configure Filters: Set common filter conditions
  6. Set Templates: Create page templates

Content Update Process

  1. Get Current Content: Read the page block structure
  2. Locate Target Block: Find the block that needs to be updated
  3. Update Block Content: Modify block text or attributes
  4. Add New Block: Insert new content blocks if needed
  5. Verify Update: Confirm that the changes are applied correctly

Project Tracking Process

  1. Create Project Database: Build a project Kanban
  2. Define Task Status: Set status fields (To Do, In Progress, Completed)
  3. Add Tasks: Create task records
  4. Assign Assignees: Set task assignees
  5. Set Deadline: Add date field
  6. Update Progress: Update status as progress proceeds

Best Practices

Page Organization

  • Use a hierarchical structure to organize pages
  • Reasonably use databases instead of ordinary pages
  • Regularly clean up and archive unnecessary pages
  • Use icons and covers to distinguish different pages
  • Establish a unified naming convention

Database Design

  • Select the field type accurately
  • Reasonably use relationship fields to connect databases
  • Set default views to improve usage efficiency
  • Use filter conditions to reduce noise
  • Regularly maintain the database structure

Content Editing

  • Use blocks to organize content structure
  • Reasonably use heading levels
  • Keep the content concise and clear
  • Save important modifications in time
  • Use comments for discussion

Collaboration Specifications

  • Clarify the person in charge of the page
  • Use @mentions to notify collaborators
  • Reply to comments in time
  • Synchronize update status regularly
  • Respect page permission settings

Common Code Examples

1. Create Page and Add Content

javascript
// 创建新页面
const page = await createPage({
  parent: {
    type: "page_id",
    page_id: "parent_page_id"
  },
  properties: {
    title: {
      type: "title",
      title: [
        {
          type: "text",
          text: {
            content: "项目文档"
          }
        }
      ]
    }
  },
  children: [
    {
      object: "block",
      type: "paragraph",
      paragraph: {
        rich_text: [
          {
            type: "text",
            text: {
              content: "这是项目文档的概述内容。"
            }
          }
        ]
      }
    }
  ],
  icon: {
    type: "emoji",
    emoji: "📝"
  },
  cover: {
    type: "external",
    external: {
      url: "https://example.com/cover.jpg"
    }
  }
});

2. Database Operations

javascript
// 创建数据库
const database = await createDatabase({
  parent: {
    type: "page_id",
    page_id: "parent_page_id"
  },
  title: [
    {
      type: "text",
      text: {
        content: "项目管理数据库"
      }
    }
  ],
  properties: {
    "任务名称": {
      title: {}
    },
    "状态": {
      select: {
        options: [
          { name: "待办", color: "gray" },
          { name: "进行中", color: "blue" },
          { name: "已完成", color: "green" }
        ]
      }
    },
    "负责人": {
      people: {}
    },
    "截止日期": {
      date: {}
    }
  }
});

// 查询数据库记录
const records = await queryDatabase({
  database_id: "database_id",
  filter: {
    property: "状态",
    select: {
      equals: "进行中"
    }
  },
  sorts: [
    {
      property: "截止日期",
      direction: "ascending"
    }
  ]
});

3. Page Search

javascript
// 搜索页面
const searchResults = await search({
  query: "项目计划",
  filter: {
    property: "object",
    value: "page"
  },
  sort: {
    direction: "descending",
    timestamp: "last_edited_time"
  }
});

// 搜索数据库
const dbResults = await search({
  query: "任务",
  filter: {
    property: "object",
    value: "database"
  }
});

4. Block Content Update

javascript
// 获取页面块
const blocks = await getBlockChildren({
  block_id: "page_id"
});

// 更新块内容
await updateBlock({
  block_id: "block_id",
  paragraph: {
    rich_text: [
      {
        type: "text",
        text: {
          content: "更新后的内容"
        }
      }
    ]
  }
});

// 添加新块
await appendBlockChildren({
  block_id: "parent_block_id",
  children: [
    {
      object: "block",
      type: "heading_2",
      heading_2: {
        rich_text: [
          {
            type: "text",
            text: {
              content: "新的章节标题"
            }
          }
        ]
      }
    }
  ]
});

5. Comment Management

javascript
// 创建评论
await createComment({
  parent: {
    page_id: "page_id"
  },
  rich_text: [
    {
      type: "text",
      text: {
        content: "建议在这里添加更多细节描述。"
      }
    }
  ]
});

// 获取评论
const comments = await retrieveComments({
  block_id: "page_id"
});

6. Page Movement

javascript
// 移动页面到其他父页面
await movePage({
  page_id: "page_id",
  parent: {
    type: "page_id",
    page_id: "new_parent_id"
  }
});

// 或移动到数据库
await movePage({
  page_id: "page_id",
  parent: {
    type: "database_id",
    database_id: "database_id"
  }
});

7. Batch Operations

javascript
// 批量创建页面记录
const batchCreate = async (databaseId, records) => {
  for (const record of records) {
    await createPage({
      parent: {
        type: "database_id",
        database_id: databaseId
      },
      properties: {
        "任务名称": {
          title: [{ text: { content: record.title } }]
        },
        "状态": {
          select: { name: record.status }
        }
      }
    });
  }
};

// 批量更新块
const batchUpdate = async (updates) => {
  for (const update of updates) {
    await updateBlock({
      block_id: update.blockId,
      ...update.content
    });
  }
};

8. Users and Permissions

javascript
// 获取用户信息
const users = await listUsers();

// 获取特定用户
const user = await getUser({
  user_id: "user_id"
});

// 获取当前用户
const me = await getSelf();

Integration Scenarios

1. Project Management System

  • Create project overview pages
  • Set up task tracking databases
  • Manage milestones and timelines
  • Generate project reports
  • Track team progress

2. Knowledge Base Management

  • Organize document structure
  • Create knowledge base pages
  • Maintain document indexes
  • Set document permissions
  • Update content regularly

3. Content Creation Workflow

  • Create content calendars
  • Manage drafts and publishing
  • Collaborate on document editing
  • Track comment feedback
  • Automate content publishing

4. Team Collaboration Platform

  • Build a team homepage
  • Manage team members
  • Set up meeting minutes
  • Share resources and links
  • Track team tasks

5. Automated Report Generation

  • Collect data updates
  • Generate regular reports
  • Export report content
  • Distribute reports to the team
  • Archive historical records

Notes

  • Comply with Notion API rate limits
  • Handle authentication and permissions correctly
  • Verify block types and content formats
  • Protect sensitive information from leakage
  • Back up important data regularly
  • Pay attention to the hierarchical relationship between pages and databases
  • Use the correct ID type (page_id, database_id, block_id)
  • Handle API errors and exceptions
  • Comply with Notion's terms of use
  • Respect data privacy and security specifications