Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add leemysw/feishu-docx
Or install specific skill: npx add-skill https://github.com/leemysw/feishu-docx/tree/main/.skills/feishu-docx
# Description
Export Feishu/Lark cloud documents to Markdown. Supports docx, sheets, bitable, and wiki. Use this skill when you need to read, analyze, or reference content from Feishu knowledge base.
# SKILL.md
name: feishu-docx
description: Export Feishu/Lark cloud documents to Markdown. Supports docx, sheets, bitable, and wiki. Use this skill when you need to read, analyze, or reference content from Feishu knowledge base.
Feishu Docx Exporter
Export Feishu/Lark cloud documents to Markdown format for AI analysis.
Instructions
Setup (One-time)
- Install the tool:
pip install feishu-docx
- Configure Feishu app credentials:
feishu-docx config set --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET
# or use
- Authorize with OAuth (opens browser):
feishu-docx auth
Export Documents
Export any Feishu document URL to Markdown:
feishu-docx export "<FEISHU_URL>" -o ./output
The exported Markdown file will be saved with the document's title as filename.
Supported Document Types
- docx: Feishu cloud documents → Markdown with images
- sheet: Spreadsheets → Markdown tables
- bitable: Multidimensional tables → Markdown tables
- wiki: Knowledge base nodes → Auto-resolved and exported
Examples
Export a wiki page
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" -o ./docs
Export a document with custom filename
feishu-docx export "https://xxx.feishu.cn/docx/XYZ789" -o ./docs -n meeting_notes
Export spreadsheet as Markdown table
feishu-docx export "https://xxx.feishu.cn/sheets/DEF456" --table md
Read content directly (recommended for AI Agent)
# Output content to stdout instead of saving to file
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" --stdout
# or use short flag
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" -c
Export with Block IDs (for later updates)
# Include block IDs as HTML comments in the Markdown output
# This enables updating specific blocks later
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" --with-block-ids
# or use short flag
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" -b
# Output format example:
# <!-- block:blk123abc -->
# # Heading
# <!-- /block -->
#
# <!-- block:blk456def -->
# This is a paragraph.
# <!-- /block -->
Tip for AI Agents: When you need to update a specific section of a Feishu document,
first export with--with-block-ids, find the block ID from the HTML comment,
then useFeishuWriter.update_block()with that ID.
Read content without saving to file (Python)
from feishu_docx import FeishuExporter
exporter = FeishuExporter(app_id="xxx", app_secret="xxx")
content = exporter.export_content("https://xxx.feishu.cn/wiki/xxx")
print(content)
Command Reference
| Command | Description |
|---|---|
feishu-docx export <URL> |
Export document to Markdown |
feishu-docx create <TITLE> |
Create new document |
feishu-docx write <URL> |
Append content to document |
feishu-docx update <URL> |
Update specific block |
feishu-docx auth |
OAuth authorization |
feishu-docx config set |
Set credentials |
feishu-docx config show |
Show current config |
feishu-docx config clear |
Clear token cache |
Write Documents (CLI)
Create Document
# Create empty document
feishu-docx create "我的笔记"
# Create with Markdown content
feishu-docx create "会议记录" -c "# 会议纪要\n\n- 议题一\n- 议题二"
# Create from Markdown file
feishu-docx create "周报" -f ./weekly_report.md
# Create in specific folder
feishu-docx create "笔记" --folder fldcnXXXXXX
Append Content to Existing Document
# Append Markdown content
feishu-docx write "https://xxx.feishu.cn/docx/xxx" -c "## 新章节\n\n内容"
# Append from file
feishu-docx write "https://xxx.feishu.cn/docx/xxx" -f ./content.md
Update Specific Block
# Step 1: Export with Block IDs
feishu-docx export "https://xxx.feishu.cn/docx/xxx" -b -o ./
# Step 2: Find block ID from HTML comments in output
# <!-- block:blk123abc -->
# # Heading
# <!-- /block -->
# Step 3: Update the specific block
feishu-docx update "https://xxx.feishu.cn/docx/xxx" -b blk123abc -c "新内容"
Tip for AI Agents: When you need to update a specific section of a Feishu document:
1. Export with-bto get block IDs
2. Find the target block ID from HTML comments
3. Usefeishu-docx updatewith that block ID
Tips
- Images are automatically downloaded to a folder named after the document
- Use
--table mdfor Markdown tables instead of HTML - Token is cached and auto-refreshed, no need to re-authorize
- For Lark (overseas), add
--larkflag
# README.md
Feishu/Lark Docs、Sheet、Bitable → Markdown | AI Agent-friendly knowledge base exporter with OAuth 2.0, CLI, TUI & Claude Skills support
中文 | English
🎯 Why feishu-docx?
Let AI Agents read your Feishu/Lark knowledge base.
- 🤖 Built for AI — Works seamlessly with Claude/GPT Skills for document retrieval
- 📄 Full Coverage — Documents, Spreadsheets, Bitables, Wiki nodes
- 🔐 Authentication — One-time auth, automatic token refresh
- 🎨 Dual Interface — CLI + Beautiful TUI (Textual-based)
- 📦 Zero Config —
pip installand start exporting
⚡ Quick Start (30 seconds)
# Install
pip install feishu-docx
# Configure credentials (one-time)
feishu-docx config set --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET
# Authorize
feishu-docx auth
# Export!
feishu-docx export "https://my.feishu.cn/wiki/KUIJwaBuGiwaSIkkKJ6cfVY8nSg"
🤖 Claude Skills Support
Enable Claude to access your Feishu knowledge base directly!
This project includes a Claude Skill at .skills/feishu-docx/SKILL.md.
Copy this Skill to your agent project, and Claude can:
- 📖 Read Feishu knowledge base as context
- 🔍 Search and reference internal documents
- 📝 (Planned) Write conversation content back to Feishu
✨ Features
| Feature | Description |
|---|---|
| 📄 Document Export | Docx → Markdown with formatting, images, tables |
| 📊 Spreadsheet Export | Sheet → Markdown tables |
| 📋 Bitable Export | Multidimensional tables → Markdown |
| 📚 Wiki Export | Auto-resolve wiki nodes |
| 🗂️ Wiki Batch Export | Recursively export entire wiki space with hierarchy |
| 🗄️ Database Schema | Export APaaS database structure to Markdown |
| 🖼️ Auto Image Download | Images saved locally with relative paths |
| 🔐 OAuth 2.0 | Browser-based auth, token persistence |
| 🎨 Beautiful TUI | Terminal UI powered by Textual |
✅ Supported Blocks
This tool currently supports exporting the following Feishu/Lark document components:
| Category | Features | Status | Notes |
|---|---|---|---|
| Basic Text | Headings, Paragraphs, Lists, Tasks (Todo), Code Blocks, Quotes | ✅ | Fully Supported |
| Formatting | Bold, Italic, Strikethrough, Underline, Links, @Mentions | ✅ | Fully Supported |
| Layout | Columns, Callouts, Dividers | ✅ | Fully Supported |
| Tables | Native Tables | ✅ | Export to Markdown/HTML |
| Media | Images, Drawing Boards | ✅ | Drawing boards exported as images |
| Embedded | Spreadsheets (Sheets), Bitable | ✅ | Text content only |
| Special | Synced Blocks | ⚠️ | Original blocks within the same doc only |
| Files | Attachments | ✅ | File name + download link |
📖 Usage
CLI
# Export single document to specific directory
feishu-docx export "https://xxx.feishu.cn/docx/xxx" -o ./docs
# Batch export entire wiki space (preserves hierarchy)
feishu-docx export-wiki-space <space_id_or_url> -o ./wiki_backup --max-depth 5
# Export APaaS database schema
feishu-docx export-workspace-schema <workspace_id> -o ./database_schema.md
# Use token directly
feishu-docx export "URL" -t your_access_token
# Launch TUI
feishu-docx tui
Python API
from feishu_docx import FeishuExporter
# OAuth
exporter = FeishuExporter(app_id="xxx", app_secret="xxx")
path = exporter.export("https://xxx.feishu.cn/wiki/xxx", "./output")
# Or use token directly
exporter = FeishuExporter.from_token("user_access_token")
content = exporter.export_content("https://xxx.feishu.cn/docx/xxx")
🔐 Feishu App Setup
- Create app at Feishu Open Platform
- Add redirect URL:
http://127.0.0.1:9527/ - Request permissions:
"docx:document:readonly" # 查看云文档
"wiki:wiki:readonly" # 查看知识库
"drive:drive:readonly" # 查看云空间文件(图片下载)
"sheets:spreadsheet:readonly" # 查看电子表格
"bitable:app:readonly" # 查看多维表格
"board:whiteboard:node:read" # 查看白板
"contact:contact.base:readonly" # 获取用户基本信息(@用户名称)
"offline_access" # 离线访问(获取 refresh_token)
- Save credentials:
feishu-docx config set --app-id cli_xxx --app-secret xxx
📖 Commands
| Command | Description |
|---|---|
export <URL> |
Export single document to Markdown |
export-wiki-space <space_id> |
Batch export wiki space with hierarchy |
export-workspace-schema <id> |
Export APaaS database schema |
auth |
OAuth authorization |
tui |
Launch TUI interface |
config set |
Set credentials |
config show |
Show configuration |
config clear |
Clear cache |
🗺️ Roadmap
- [x] Document/Sheet/Wiki export
- [x] OAuth 2.0 + Token refresh
- [x] TUI interface
- [x] Claude Skills support
- [ ] Batch export entire wiki space
- [ ] MCP Server support
- [ ] Write to Feishu (create/update docs)
📜 Changelog
See CHANGELOG.md for version history.
📄 License
MIT License - See LICENSE
⭐ Star this repo if you find it helpful!
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.