/good-skills:siyuan-notefrom good-skills
思源笔记 API 集成与知识库管理。Use when "思源笔记", "SiYuan Note", "知识库管理", "笔记操作", "siyuan API". 支持笔记 CRUD、SQL 查询、批量操作、备份导出。 需要 SIYUAN_HOST 和 SIYUAN_TOKEN 环境变量。
Ships in good-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
export SIYUAN_HOST="http://127.0.0.1:6806"
export SIYUAN_TOKEN="your-api-token"
export SIYUAN_HOST="http://your-siyuan.example.com:6806"
export SIYUAN_TOKEN="your-api-token"
⚠️ 安全提示:公网访问时 Token 会明文传输,建议配置 HTTPS(需反向代理配置 SSL 证书)。
API token is found in SiYuan Settings → About.
Test connection:
python3 scripts/siyuan.py test
List all notebooks:
curl -X POST ${SIYUAN_HOST}/api/notebook/lsNotebooks \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" -d '{}'
Create notebook:
curl -X POST ${SIYUAN_HOST}/api/notebook/createNotebook \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"name": "My Notebook"}'
Delete notebook by ID:
curl -X POST ${SIYUAN_HOST}/api/notebook/removeNotebook \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"notebook": "notebook-id"}'
List documents in notebook:
curl -X POST ${SIYUAN_HOST}/api/filetree/listDocsByPath \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"notebook": "notebook-id", "path": "/"}'
Create document with Markdown:
curl -X POST ${SIYUAN_HOST}/api/filetree/createDocWithMd \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"notebook": "notebook-id", "path": "/my-note", "markdown": "# Title\nContent"}'
Delete document by ID:
curl -X POST ${SIYUAN_HOST}/api/filetree/removeDocByID \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"id": "doc-id"}'
Export document as Markdown:
curl -X POST ${SIYUAN_HOST}/api/export/exportMdContent \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"id": "doc-id"}'
Search content with SQL query:
curl -X POST ${SIYUAN_HOST}/api/query/sql \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"stmt": "SELECT * FROM blocks WHERE content LIKE '\''%keyword%'\'' LIMIT 10"}'
Get block content:
curl -X POST ${SIYUAN_HOST}/api/block/getBlockKramdown \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"id": "block-id"}'
Append block to document:
curl -X POST ${SIYUAN_HOST}/api/block/appendBlock \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"dataType": "markdown", "data": "New content", "parentID": "doc-id"}'
The bundled Python script provides common operations:
# Test connection
python3 scripts/siyuan.py test
# List notebooks
python3 scripts/siyuan.py ls-notebooks
# Create notebook
python3 scripts/siyuan.py create-notebook "My Notebook"
# Delete notebook
python3 scripts/siyuan.py delete-notebook "notebook-id"
# List documents in notebook
python3 scripts/siyuan.py ls-docs "notebook-id"
# Create document
python3 scripts/siyuan.py create-doc "notebook-id" "/my-path" "# Title\nContent"
# Delete document
python3 scripts/siyuan.py delete-doc "doc-id"
# Search
python3 scripts/siyuan.py search "keyword"
# Export markdown
python3 scripts/siyuan.py export-md "doc-id" /path/to/save.md
# Export all documents to directory
python3 scripts/siyuan.py export-all-notebooks "/backup/path"
# Get statistics
python3 scripts/siyuan.py stats
# Find duplicate documents
python3 scripts/siyuan.py find-duplicates
# Find documents by name pattern
python3 scripts/siyuan.py find "pattern"
# Export documents from a specific notebook
python3 scripts/siyuan.py export-notebook "notebook-id" "/output/path"
# 1. List notebooks to get ID
python3 scripts/siyuan.py ls-notebooks
# 2. Create document in notebook
python3 scripts/siyuan.py create-doc "notebook-id" "/my-new-note" "# My New Note\n\nContent here"
# 1. Search for content
python3 scripts/siyuan.py search "keyword"
# 2. Get document ID from results and export
python3 scripts/siyuan.py export-md "doc-id" "/output/note.md"
# Export all notebooks to backup directory
python3 scripts/siyuan.py export-all-notebooks "~/Desktop/siyuan_backup_$(date +%Y%m%d)"
# 1. List documents in notebook
python3 scripts/siyuan.py ls-docs "notebook-id"
# 2. Find documents by pattern
python3 scripts/siyuan.py find "test" --notebook "notebook-id"
# 3. Delete unwanted documents in batch
echo "id1\nid2\nid3" | xargs -I {} python3 scripts/siyuan.py delete-doc {}
# Create new notebook
python3 scripts/siyuan.py create-notebook "Project Docs"
# Get notebook ID (or use directly)
NOTEBOOK_ID="new-notebook-id"
# Create folder structure
python3 scripts/siyuan.py create-doc "$NOTEBOOK_ID" "/Documentation" "# Documentation"
python3 scripts/siyuan.py create-doc "$NOTEBOOK_ID" "/Documentation/Getting Started" "# Getting Started"
python3 scripts/siyuan.py create-doc "$NOTEBOOK_ID" "/Documentation/API Reference" "# API Reference"
python3 scripts/siyuan.py create-doc "$NOTEBOOK_ID" "/Documentation/Examples" "# Examples"
# Get notebook statistics
python3 scripts/siyuan.py stats
# Find potential duplicates
python3 scripts/siyuan.py find-duplicates
# Export all notes for analysis
python3 scripts/siyuan.py export-all-notebooks "backup_dir"
# Then import organized notes as needed
All endpoints return:
{
"code": 0,
"msg": "",
"data": {...}
}
Check code === 0 for success. msg contains error details on failure.
Common error codes:
-1: Parameter/execution error401: Unauthorized (invalid token)403: Permission denied404: Resource not found503: Service unavailable (SiYuan not running)Check msg field for details.
# Create document in subfolder
python3 scripts/siyuan.py create-doc "notebook-id" "/category/subcategory/doc-name" "# Title"
# List documents in subfolder
python3 scripts/siyuan.py ls-docs "notebook-id" "/category"
Export all documents preserving folder structure:
python3 scripts/siyuan.py export-all-notebooks "/backup" --hierarchy
# Find documents by title
curl -X POST ${SIYUAN_HOST}/api/query/sql \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"stmt": "SELECT * FROM blocks WHERE type = \"d\" AND content LIKE \"My Title%\""}'
# Get document tree
curl -X POST ${SIYUAN_HOST}/api/filetree/getDocTree \
-H "Authorization: Token ${SIYUAN_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"notebook": "notebook-id"}'
See references/api_reference.md for complete API documentation including:
| Variable | Description | Default |
|---|---|---|
SIYUAN_HOST | SiYuan Note server URL | http://127.0.0.1:6806 (本地) 或 http://your-siyuan.example.com:6806 (公网) |
SIYUAN_TOKEN | API authentication token | (required) |
如果你在外网需要访问运行在家中或服务器上的 SiYuan Note:
# 公网域名访问
export SIYUAN_HOST="http://your-siyuan.example.com:6806"
export SIYUAN_TOKEN="你的Token"
server {
listen 443 ssl;
server_name your-siyuan.example.com;
ssl_certificate /path/to/ssl/cert.pem;
ssl_certificate_key /path/to/ssl/key.pem;
location / {
proxy_pass http://127.0.0.1:6806;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
配置 HTTPS 后使用:
export SIYUAN_HOST="https://your-siyuan.example.com"
ls-docs to list available documentstest commandWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sunchendd/good_skills --plugin good-skills26 skills in this plugin
/arxiv-daily每日 arXiv AI 论文精选系统。自动从 arXiv 抓取最新 cs.AI/cs.LG/cs.CL/cs.CV/cs.RO 论文,用 DeepSeek 评分筛选,生成中文摘要,通过邮件和 Bark 推送。/claude-apiReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration.
TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens).
SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file)./code-walkthrough为代码仓库生成面向专家评审的代码讲解材料,并可选地为 .c/.py 源文件补充中文注释。当用户说"讲解代码""代码讲解""给专家讲这个特性""梳理主流程和重点函数""这个模块怎么讲""准备评审材料""代码走读",或要求给 .c/.py 文件加文件头注释/函数注释时使用。核心能力:先问用户是否要加注释(默认不加,绝不擅自改源码),再按"一句话定调 → 全景图 → 主流程链路 → 重点函数 → 证据 → 预判追问"的结构输出讲解内容,所有结论必须带真实文件路径与行号。不用于从零起草无源码的文档,也不用于普通文档润色或翻译。