微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📝

飞书文档自动化创作助手

Feishu Docx · v1.0.2
办公 安全 B 级 作者 cpjhy 公开目录收录
979 下载 0 安装 2.3k 收藏 6 浏览

简介

封装飞书云文档API,支持程序化创建、编辑和管理docx文档,适合自动化内容生成与协作场景。

原始描述

飞书云文档(docx)的创建与编辑技能。支持通过 API 创建文档、追加内容、批量更新块等操作。使用此技能需要提供 App ID 和 App Secret。

通过你的 Agent 添加

安装目录:feishu-docx/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/feishu-docx/
Codex CLI~/.codex/skills/feishu-docx/
DeepSeek Harness~/.agents/skills/feishu-docx/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


name: feishu-docx description: Export, write, and manage Feishu/Lark cloud documents. Supports docx, sheets, bitable, wiki, WeChat article import/export, drive management, and browser-based export for public or browser-readable docs. Use this skill when you need to read, analyze, write, or manage content in a Feishu knowledge base.

Feishu Docx Exporter

Export Feishu/Lark cloud documents to Markdown for AI analysis, writing, and automation.

Setup (One-time)

pip install feishu-docx
feishu-docx config set --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET

Token auto-refreshes. No user interaction required.

Optional features are split into extras so the core install stays lightweight. Quote extras in zsh and similar shells.

Optional: Browser-Based Export

export-browser requires Playwright and a Chromium runtime:

pip install 'feishu-docx[browser]'
playwright install chromium

Optional: PDF Export

PDF export requires the pdf extra:

pip install 'feishu-docx[pdf]'

Export Documents

feishu-docx export "<FEISHU_URL>" -o ./output

The exported Markdown file will be saved with the document's title as filename.

If the document is public or only readable in your current browser session, prefer:

feishu-docx export-browser "<FEISHU_OR_LARK_URL>" -o ./output

Or reuse an existing Playwright session:

feishu-docx export-browser "<FEISHU_OR_LARK_URL>" --storage-state ./storage_state.json

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
  • public/browser-readable docs: Browser-based export with local images and attachments

Command Reference

Command Description
feishu-docx export <URL> Export document to Markdown
feishu-docx export <URL> --pdf Export document to Markdown and PDF
feishu-docx export-browser <URL> Export in a real browser session with local assets
feishu-docx export-wechat <URL> Export WeChat article to Markdown
feishu-docx create <TITLE> Create new document
feishu-docx create --url <URL> Create document from WeChat article
feishu-docx write <URL> Append content to document
feishu-docx update <URL> Update specific block
feishu-docx drive ls List app or personal cloud-space files
feishu-docx drive perm-show <TOKEN> Show public permission
feishu-docx drive perm-members <TOKEN> List permission members
feishu-docx drive clear Clear files with double confirmation
feishu-docx export-wiki-space <URL> Batch export entire wiki space
feishu-docx export-workspace-schema <ID> Export bitable database schema
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
feishu-docx tui Interactive TUI interface

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 a public or browser-readable doc in a real browser session

feishu-docx export-browser "https://xxx.larkoffice.com/wiki/ABC123" -o ./browser_docs

Export a document as PDF

feishu-docx export "https://xxx.feishu.cn/docx/XYZ789" --pdf

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
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

Batch Export Entire Wiki Space

# Export all documents in a wiki space (auto-extract space_id from URL)
feishu-docx export-wiki-space "https://xxx.feishu.cn/wiki/ABC123" -o ./wiki_backup

# Specify depth limit
feishu-docx export-wiki-space "https://xxx.feishu.cn/wiki/ABC123" -o ./docs --max-depth 3

# Export with Block IDs for later updates
feishu-docx export-wiki-space "https://xxx.feishu.cn/wiki/ABC123" -o ./docs -b

Export Database Schema

# Export bitable/workspace database schema as Markdown
feishu-docx export-workspace-schema <workspace_id>

# Specify output file
feishu-docx export-workspace-schema <workspace_id> -o ./schema.md

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

# Create from a WeChat article URL
feishu-docx create --url "https://mp.weixin.qq.com/s/xxxxx"

如何获取 folder token:

  1. 在浏览器中打开目标文件夹
  2. 从 URL 中提取 token:https://xxx.feishu.cn/drive/folder/fldcnXXXXXX
  3. fldcnXXXXXX 就是 folder token

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

Manage Drive Files

# List app cloud-space documents
feishu-docx drive ls --auth-mode tenant --type docx

# List personal cloud-space documents
feishu-docx drive ls --auth-mode oauth --type docx

# Show public permission
feishu-docx drive perm-show "https://xxx.feishu.cn/docx/ABC123"

# List permission members
feishu-docx drive perm-members "https://xxx.feishu.cn/docx/ABC123"

# Clear files with double confirmation
feishu-docx drive clear --type docx

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
# <!-- 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:

  1. Export with -b to get block IDs
  2. Find the target block ID from HTML comments
  3. Use feishu-docx update with that block ID

Tips

  • Images and attachments auto-download to {doc_title}/ folder when local assets are available
  • Prefer export-browser for public share links or browser-readable docs
  • Use --stdout or -c for direct content output (recommended for agents)
  • Use -b to export with block IDs for later updates
  • Token auto-refreshes, no re-auth needed
  • For Lark (overseas): add --lark flag
  • tenant_access_token manages app cloud space, user_access_token manages personal cloud space

正文来自原始仓库, 版权归作者所有,许可:MIT。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/leemysw/feishu-docx

标签

飞书文档自动化api集成内容管理企业协作lark

同类 Skill