Initial commit
This commit is contained in:
42
skills/reading-notion/SKILL.md
Normal file
42
skills/reading-notion/SKILL.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: reading-notion
|
||||
description: Notion URLが会話に登場した時、またはNotionのコンテンツを検索・取得する必要がある時に使用してください。
|
||||
allowed-tools: Bash, Read
|
||||
---
|
||||
|
||||
# Reading Notion
|
||||
|
||||
NotionページやドキュメントをMarkdownに変換して読み取り、内容を要約・説明するスキルです。
|
||||
|
||||
## 概要
|
||||
|
||||
このスキルは2つのモードで動作します:
|
||||
|
||||
1. **URL直接モード**: Notion URLが会話に登場した時、`notion-to-md`を使って自動的にMarkdownに変換し、内容を説明
|
||||
2. **検索モード**: キーワードでNotionを検索し、結果から選択したページの内容を説明
|
||||
|
||||
**URL直接モード**では、Go製のCLIツール`notion-to-md`を使用してNotion APIからページデータを取得し、Markdown形式に変換します。これにより、ネスト構造、豊富なブロックタイプ、テキストアノテーションなどを正確に保持したMarkdownファイルが生成されます。
|
||||
|
||||
|
||||
## モード詳細
|
||||
|
||||
<trigger>
|
||||
|
||||
### URL直接モード
|
||||
|
||||
Notion URLを検出すると自動的に発動します。詳細は **reference/url-mode.md** を参照してください。
|
||||
|
||||
**発動例**:
|
||||
- ユーザーが `https://www.notion.so/myorg/abc123def456ghi789jkl012mno34567` のようなURLを提示
|
||||
- 会話中にNotion URLが登場
|
||||
|
||||
### 検索モード
|
||||
|
||||
キーワードでNotion内を検索したい時に発動します。詳細は **reference/search-mode.md** を参照してください。
|
||||
|
||||
**発動例**:
|
||||
- 「データ基盤チームについて教えて」
|
||||
- 「Notionでプロジェクト〇〇を検索して」
|
||||
- 特定のキーワードに関する情報を求められた時
|
||||
|
||||
</trigger>
|
||||
113
skills/reading-notion/reference/search-mode.md
Normal file
113
skills/reading-notion/reference/search-mode.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# 検索モード
|
||||
|
||||
「notionでxyzを探して」という形で発動し、キーワードでNotionを検索して結果から選択したページの内容を説明します。
|
||||
|
||||
## 発動条件
|
||||
|
||||
<trigger>
|
||||
|
||||
以下のようなリクエストで発動します:
|
||||
|
||||
- 「Notionでプロジェクト〇〇を検索して」
|
||||
- Notionに関する質問であることが明らかな場合
|
||||
|
||||
</trigger>
|
||||
|
||||
## 実行フロー
|
||||
|
||||
<procedure>
|
||||
|
||||
### 1. キーワード検索と結果表示
|
||||
|
||||
jqを使って検索結果を箇条書き形式で整形します:
|
||||
|
||||
```bash
|
||||
mcptools call API-post-search npx -y @notionhq/notion-mcp-server --params '{"query":"プロジェクトXYZ","page_size":10}' | jq -r '.results[] | "- \(if .title then .title[0].text.content else (.properties | to_entries[] | select(.value.type == "title") | .value.title[0].text.content) end)\n - \(.url)"'
|
||||
```
|
||||
|
||||
**出力例**:
|
||||
```
|
||||
- プロジェクトXYZ概要
|
||||
- https://www.notion.so/abc123de...
|
||||
- XYZ実装ガイド
|
||||
- https://www.notion.so/def456gh...
|
||||
- XYZ関連メモ
|
||||
- https://www.notion.so/ghi789jk...
|
||||
- プロジェクトXYZ
|
||||
- https://www.notion.so/jkl012mn...
|
||||
```
|
||||
|
||||
<context>
|
||||
|
||||
**API: API-post-search**
|
||||
|
||||
```json
|
||||
{
|
||||
"properties": {
|
||||
"filter": {
|
||||
"additionalProperties": true,
|
||||
"description": "A set of criteria, `value` and `property` keys, that limits the results to either only pages or only databases. Possible `value` values are `\"page\"` or `\"database\"`. The only supported `property` value is `\"object\"`.",
|
||||
"properties": {
|
||||
"property": {
|
||||
"description": "The name of the property to filter by. Currently the only property you can filter by is the object type. Possible values include `object`. Limitation: Currently the only filter allowed is `object` which will filter by type of object (either `page` or `database`)",
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"description": "The value of the property to filter the results by. Possible values for object type include `page` or `database`. **Limitation**: Currently the only filter allowed is `object` which will filter by type of object (either `page` or `database`)",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"page_size": {
|
||||
"default": 100,
|
||||
"description": "The number of items from the full list to include in the response. Maximum: `100`.",
|
||||
"format": "int32",
|
||||
"type": "integer"
|
||||
},
|
||||
"query": {
|
||||
"description": "The text that the API compares page and database titles against.",
|
||||
"type": "string"
|
||||
},
|
||||
"sort": {
|
||||
"additionalProperties": true,
|
||||
"description": "A set of criteria, `direction` and `timestamp` keys, that orders the results. The **only** supported timestamp value is `\"last_edited_time\"`. Supported `direction` values are `\"ascending\"` and `\"descending\"`. If `sort` is not provided, then the most recently edited results are returned first.",
|
||||
"properties": {
|
||||
"direction": {
|
||||
"description": "The direction to sort. Possible values include `ascending` and `descending`.",
|
||||
"type": "string"
|
||||
},
|
||||
"timestamp": {
|
||||
"description": "The name of the timestamp to sort against. Possible values include `last_edited_time`.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"start_cursor": {
|
||||
"description": "A `cursor` value returned in a previous response that If supplied, limits the response to results starting after the `cursor`. If not supplied, then the first page of results is returned. Refer to [pagination](https://developers.notion.com/reference/intro#pagination) for more details.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
```
|
||||
|
||||
</context>
|
||||
|
||||
### 2. ユーザーへの提示
|
||||
|
||||
AIは検索結果を以下の形式でユーザーに提示します:
|
||||
|
||||
```
|
||||
Notionで「プロジェクトXYZ」を検索した結果、以下のページが見つかりました:
|
||||
|
||||
- **プロジェクトXYZ**
|
||||
- https://www.notion.so/jkl012mn...
|
||||
- **XYZ関連メモ**
|
||||
- https://www.notion.so/ghi789jk...
|
||||
- **XYZ実装ガイド**
|
||||
- https://www.notion.so/def456gh...
|
||||
```
|
||||
|
||||
</procedure>
|
||||
80
skills/reading-notion/reference/url-mode.md
Normal file
80
skills/reading-notion/reference/url-mode.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# URL直接モード
|
||||
|
||||
Notion URLを検出すると自動的に発動し、そのページの内容を取得して要約します。
|
||||
|
||||
## URL検出パターン
|
||||
|
||||
以下のようなNotion URLを検出します:
|
||||
|
||||
```
|
||||
https://www.notion.so/{workspace}/{page-id}
|
||||
https://www.notion.so/{page-id}
|
||||
```
|
||||
|
||||
例:
|
||||
```
|
||||
https://www.notion.so/myorg/abc123def456ghi789jkl012mno34567
|
||||
https://www.notion.so/abc123def456ghi789jkl012mno34567
|
||||
```
|
||||
|
||||
## 実行手順
|
||||
|
||||
<procedure>
|
||||
|
||||
### 1. Markdown変換と出力
|
||||
|
||||
`notion-to-md`コマンドを使ってNotion URLを直接Markdownに変換します。
|
||||
|
||||
**実行コマンド**:
|
||||
|
||||
```bash
|
||||
mkdir -p .claude_work/notion && notion-to-md {notion_url} | tee .claude_work/notion/{page_id}.md > /dev/null
|
||||
```
|
||||
|
||||
**説明**:
|
||||
- `{notion_url}`: ユーザーが提示したNotion URL(例: `https://www.notion.so/workspace/Page-title-abc123...`)
|
||||
- `{page_id}`: URLの最後の32文字(例: `abc123def456ghi789jkl012mno34567`)
|
||||
- `tee`を使うことで許可なしでファイル保存が可能
|
||||
|
||||
### 2. Markdownファイルの読み込みと要約報告
|
||||
|
||||
出力されたMarkdownファイルをReadツールで読み込み、内容を要約してユーザーに報告します。
|
||||
|
||||
**手順**:
|
||||
|
||||
1. Readツールで `.claude_work/notion/{page_id}.md` を読み込む
|
||||
2. ページの主な内容を要約してユーザーに報告(箇条書き5行以内)
|
||||
|
||||
**報告フォーマット**:
|
||||
|
||||
```
|
||||
Notionページを以下のファイルに出力しました:
|
||||
.claude_work/notion/{page_id}.md
|
||||
|
||||
【ページの要約】
|
||||
- {要約ポイント1}
|
||||
- {要約ポイント2}
|
||||
- {要約ポイント3}
|
||||
- {要約ポイント4}
|
||||
- {要約ポイント5}
|
||||
```
|
||||
|
||||
</procedure>
|
||||
|
||||
## エラーハンドリング
|
||||
|
||||
### ページが見つからない場合
|
||||
|
||||
```
|
||||
申し訳ございません。指定されたNotion URLからページを取得できませんでした。
|
||||
以下の可能性があります:
|
||||
- ページが削除されている
|
||||
- アクセス権限がない
|
||||
- URLが正しくない
|
||||
```
|
||||
|
||||
### API呼び出しが失敗した場合
|
||||
|
||||
```
|
||||
Notion APIへの接続に失敗しました。しばらくしてから再度お試しください。
|
||||
```
|
||||
Reference in New Issue
Block a user