This skill enables AI agents to interact with Yuque (语雀) — a Chinese knowledge management platform — through its OpenAPI. It works across Claude Code, opencode, openclaw, and any agent with shell access.
Install this skill, then tell your AI agent:
帮我配置语雀 API,我的 token 是 xxxxxxxx
The agent will automatically create config.json and verify connectivity.
Authentication requires a Yuque API token. The scripts look for it in this order:
config.json (preferred): Create config.json in this skill's root directory:
json
{
"api_token": "your-yuque-api-token",
"base_url": "https://www.yuque.com"
}
See config.example.json for the template.
Environment variable (fallback): export YUQUE_TOKEN="your-token"
When the user provides their API token, create config.json by copying config.example.json and filling in the token, then run python scripts/get_user.py to verify. If verification succeeds, show the user's name to confirm.
Verify setup: python scripts/get_user.py
All scripts are in the scripts/ directory. They use only Python standard library (zero dependencies). Output is JSON to stdout, errors go to stderr.
ScriptUsageDescriptionsearch.py``python scripts/search.py "keyword"Search docs or reposget_doc.py``python scripts/get_doc.py --repo REPO --doc DOCGet full document contentlist_docs.py``python scripts/list_docs.py --repo REPOList all docs in a repodoc_versions.py``python scripts/doc_versions.py --doc DOCDocument version history
ScriptUsageDescriptioncreate_doc.py``python scripts/create_doc.py --repo REPO --title "Title" --body-file file.mdCreate a documentupdate_doc.py``python scripts/update_doc.py --repo REPO --doc DOC --body-file file.mdUpdate a documentdelete_doc.py``python scripts/delete_doc.py --repo REPO --doc DOCDelete a document
ScriptUsageDescriptionlist_repos.py``python scripts/list_repos.pyList user's reposcreate_repo.py``python scripts/create_repo.py --name "Name" --slug slugCreate a new repo
ScriptUsageDescriptionget_toc.py``python scripts/get_toc.py --repo REPOGet repo TOC treeupdate_toc.py``python scripts/update_toc.py --repo REPO --action appendNode ...Update TOC structure
ScriptUsageDescriptionget_user.py``python scripts/get_user.pyGet current user info
When the user asks to find or read content from Yuque:
python scripts/search.py "keyword" — returns titles, IDs, and summariespython scripts/get_doc.py --repo REPO_ID --doc DOC_IDdata.body field contains the markdown content. If body is empty, use body_html or body_lake as fallback.When the user asks to write content and upload it to Yuque (e.g., "write a dev doc and upload to Yuque"):
/tmp/yuque_doc.md)python scripts/list_repos.py — ask the user which repo to usepython scripts/create_doc.py --repo REPO_ID --title "Title" --body-file /tmp/yuque_doc.mddata.slug — combine with repo namespace to form the full URLWhen the user asks to update an existing Yuque document:
python scripts/search.py "doc title" or python scripts/list_docs.py --repo REPO_IDpython scripts/get_doc.py --repo REPO_ID --doc DOC_IDpython scripts/update_doc.py --repo REPO_ID --doc DOC_ID --body-file /tmp/updated.mdWhen the user asks to organize or restructure their knowledge base:
python scripts/get_toc.py --repo REPO_IDpython scripts/update_toc.py --repo REPO_ID --action appendNode --action-mode child --doc-ids DOC_ID--action removeNode to remove nodes, --action editNode to renameDocuments support three ways to provide body content:
--body "inline content" — for short content--body-file /path/to/file.md — for files (recommended for long content)echo "content" | python scripts/create_doc.py ...List endpoints support --offset and --limit parameters. Default limit is 100.
The --repo parameter accepts either:
--repo 12345--repo group_login/book_slug (more readable)Default format is markdown. All scripts default to creating/updating in markdown format. Use --format html or --format lake if needed.
User saysAction"搜索/查找语雀上关于 X 的文档"search.py "X" → get_doc.py"读取/打开这篇语雀文档"get_doc.py --repo R --doc D"写一篇文档上传到语雀"Write locally → list_repos.py → create_doc.py"更新/修改语雀上的文档"search.py → get_doc.py → edit → update_doc.py"列出我的知识库"list_repos.py"查看知识库目录"get_toc.py --repo R"整理/重新组织笔记"get_toc.py → update_toc.py"创建新的知识库"create_repo.py --name "X" --slug x"删除这篇文档"delete_doc.py --repo R --doc D"查看文档历史版本"doc_versions.py --doc D