feishu-cli-write▌
riba2534/feishu-cli · updated Apr 13, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
创建或更新飞书云文档,通过 Markdown 作为中间格式。支持 Mermaid/PlantUML 图表自动转飞书画板。
飞书文档写入技能
创建或更新飞书云文档,通过 Markdown 作为中间格式。支持 Mermaid/PlantUML 图表自动转飞书画板。
feishu-cli:如尚未安装,请前往 riba2534/feishu-cli 获取安装方式。
前置条件:使用 App Token(应用身份),只需配置
FEISHU_APP_ID和FEISHU_APP_SECRET(环境变量或 config.yaml),无需auth login。
快速创建空白文档
最简方式创建一个新的飞书云文档:
feishu-cli doc create --title "文档标题" --output json
创建后必须立即:
- 授予
full_access权限:feishu-cli perm add <document_id> --doc-type docx --member-type email --member-id [email protected] --perm full_access --notification - 转移文档所有权:
feishu-cli perm transfer-owner <document_id> --doc-type docx --member-type email --member-id [email protected] --notification - 发送飞书消息通知用户文档已创建
核心概念
Markdown 作为中间态:本地文档与飞书云文档之间通过 Markdown 格式进行转换,中间文件存储在 /tmp 目录中。
CRITICAL: 禁止对已有文档全量覆盖
绝对禁止对已有文档使用
doc import --document-id <id>全量覆盖!这会:
- 丢失所有划词评论(inline comments)
- 破坏画板/白板引用(变成空占位块)
- 丢失用户手动编辑的格式和内容
更新已有文档必须使用增量方式:
doc add(追加)、doc update(修改块)、doc delete(删除块)。doc import --document-id仅允许在用户明确要求全量替换时使用。
使用方法
# 创建新文档
/feishu-write "文档标题"
# 更新已有文档
/feishu-write <document_id>
执行流程
创建新文档
-
收集内容
- 与用户确认文档标题
- 收集用户提供的内容或根据对话生成内容
-
生成 Markdown
- 在
/tmp/feishu_write_<timestamp>.md创建 Markdown 文件 - 使用标准 Markdown 语法
- 编码验证(防御性检查):文件写入后,运行
python3 -c "d=open('<file.md>','rb').read(); assert b'\\xef\\xbf\\xbd' not in d, 'U+FFFD found'; d.decode('utf-8')"同时检查 U+FFFD 替换字符和非法 UTF-8 字节。如果报错,必须修复后再导入飞书
- 在
-
导入到飞书
feishu-cli doc import /tmp/feishu_write_<timestamp>.md --title "文档标题" -
添加权限(可选,给指定用户添加 full_access)
full_access是最高权限,包含:管理协作者、编辑内容、管理文档设置(复制/移动/删除)、查看历史版本、导出等全部能力。feishu-cli perm add <document_id> --doc-type docx --member-type email --member-id [email protected] --perm full_access -
通知用户
- 提供文档链接
- 发送飞书消息通知
更新已有文档(增量更新)
原则:只修改需要变更的部分,保留其余内容不动。优先使用 content-update 命令,一条命令精准定位并替换。
CRITICAL: 修改文档时禁止使用 append 模式
当用户要求"修改"、"更新"、"替换"、"编辑"文档中某段内容时,必须使用
replace_range或replace_all模式,精准定位并替换目标内容。禁止将整个文档内容重新 Append 到末尾!这会导致文档内容重复。
append模式仅在用户明确要求"追加新内容"、"在末尾加一段"时使用。
决策树(按用户意图选择模式)
| 用户意图 | 推荐命令 | 说明 |
|---|---|---|
| 替换/修改/更新某个章节 | content-update --mode replace_range |
最常用,按标题定位后原地替换 |
| 在某个章节前/后插入新内容 | content-update --mode insert_before/insert_after |
精准插入,不影响已有内容 |
| 全文查找替换所有匹配 | content-update --mode replace_all |
批量替换 |
| 删除某个章节 | content-update --mode delete_range |
精准删除 |
| 在文档末尾追加新内容 | content-update --mode append |
仅追加新内容时使用 |
| 完全重写文档 | content-update --mode overwrite |
慎用,会丢失评论和画板 |
关键规则:
- 用户说"修改/更新/替换/编辑某个章节" → 必须用
replace_range,禁止用 append - 用户说"添加/追加/新增内容到末尾" → 用
append - 用户说"在某处插入" → 用
insert_before或insert_after - 用户说"删除某段内容" → 用
delete_range
场景 A:替换某个章节(最常用)
# 按标题定位并替换(从 H2 标题到下一个 H2,一条命令完成)
feishu-cli doc content-update <document_id> --mode replace_range \
--selection-by-title "## 旧章节标题" \
--markdown-file /tmp/feishu_new_section.md
# 也可以直接传 markdown 内容
feishu-cli doc content-update <document_id> --mode replace_range \
--selection-by-title "## 旧章节标题" \
--markdown "## 新章节标题\n\n更新后的内容"
场景 B:在文档指定位置插入内容
# 在"目标章节"后面插入新内容
feishu-cli doc content-update <document_id> --mode insert_after \
--selection-by-title "## 目标章节" \
--markdown-file /tmp/feishu_insert.md
# 在"目标章节"前面插入新内容
feishu-cli doc content-update <document_id> --mode insert_before \
--selection-by-title "## 目标章节" \
--markdown "## 新增章节\n\n插入的内容"
场景 C:在文档末尾追加新内容
仅在确实需要追加新内容到末尾时使用:
cat > /tmp/feishu_append.md << 'EOF'
## 新增章节标题
新增的内容...
EOF
feishu-cli doc content-update <document_id> --mode append \
--markdown-file /tmp/feishu_append.md
场景 D:删除指定章节
# 按标题定位并删除整个章节
feishu-cli doc content-update <document_id> --mode delete_range \
--selection-by-title "## 废弃章节"
# 按内容范围定位并删除
feishu-cli doc content-update <document_id> --mode delete_range \
--selection-with-ellipsis "开始段落...结束段落"
场景 E:全文查找替换
# 替换所有匹配的块
feishu-cli doc content-update <document_id> --mode replace_all \
--selection-with-ellipsis "旧文本" \
--markdown "新文本"
场景 F:修改单个块的内容(低级 API)
仅在需要精确控制单个块时使用:
# 1. 获取文档块结构,找到要修改的 block_id
feishu-cli doc blocks <document_id>
# 2. 更新指定块
feishu-cli doc update <document_id> <block_id> \
--content '{"update_text_elements":{"elements":[{"text_run":{"content":"更新后的文本"}}]}}'
何时允许全量覆盖:仅当用户明确说"重写整个文档"、"全量替换"时,才可使用
content-update --mode overwrite或doc import --document-id <id>。默认必须增量更新。
支持的 Markdown 语法
| 语法 | 飞书块类型 | 说明 |
|---|---|---|
# 标题 |
Heading1-6 | |
普通文本 |
Text | |
- 列表项 |
Bullet | 支持缩进嵌套 |
1. 有序项 |
Ordered | 支持缩进嵌套 |
- [ ] 任务 |
Todo | |
```code``` |
Code | |
```mermaid``` |
Board(画板) | 推荐使用 |
```plantuml``` / ```puml``` |
Board(画板) | PlantUML 图表 |
> 引用 |
QuoteContainer | 支持嵌套引用 |
> [!NOTE] 等 |
Callout(高亮块) | 6 种类型 |
--- |
Divider | |
**粗体** |
粗体样式 | |
*斜体* |
斜体样式 | |
~~删除线~~ |
删除线样式 | |
<u>下划线</u> |
下划线样式 | |
`行内代码` |
行内代码样式 | |
$公式$ |
行内公式 | 支持一段多个公式 |
$$公式$$ |
块级公式 | 独立公式行 |
[链接](url) |
链接 | |
| ` | 表格 | ` |
推荐:使用 Mermaid / PlantUML 画图
在文档中画图时,推荐使用 Mermaid(也支持 PlantUML),会自动转换为飞书画板。
支持的 Mermaid 图表类型:
- ✅ flowchart(流程图,支持 subgraph)
- ✅ sequenceDiagram(时序图)
- ✅ classDiagram(类图)
- ✅ stateDiagram-v2(状态图)
- ✅ erDiagram(ER 图)
- ✅ gantt(甘特图)
- ✅ pie(饼图)
- ✅ mindmap(思维导图)
Mermaid 限制(必须遵守,否则导入失败):
- ❌ 禁止在 flowchart 节点标签中使用
{}花括号(如{version}),会触发解析错误 - ❌ 禁止使用
par...and...end语法,飞书解析器完全不支持 - ❌ 避免复杂度超限:10+ participant + 2+ alt 块 + 30+ 长消息标签会触发服务端 500
- ✅ 安全阈值:participant ≤ 8、alt ≤ 1、消息标签尽量简短
- ✅
par替代方案:改用Note over X: 并行执行... - ✅ 导入失败的图表会自动降级为代码块展示,不会丢失内容
示例:
```mermaid
flowchart TD
A[开始] --> B{判断}
B -->|是| C[处理]
B -->|否| D[结束]
```
```plantuml
@startuml
Alice -> Bob: Hello
Bob --> Alice: Hi
@enduml
```
Callout 高亮块
在文档中使用 Callout 语法创建飞书高亮块:
> [!NOTE]
> 提示信息。
> [!WARNING]
> 警告信息。
> [!TIP]
> 技巧提示。
> [!CAUTION]
> 警示信息。
> [!IMPORTANT]
> 重要信息。
> [!SUCCESS]
> 成功信息。
Callout 内支持多行文本和子块(列表等)。
公式
行内公式:圆面积 $S = \pi r^2$,周长 $C = 2\pi r$。
块级公式:
$$\int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2}$$
高级操作
添加画板
向文档添加空白画板:
# 在文档末尾添加画板
feishu-cli doc add-board <document_id>
# 在指定位置添加画板
feishu-cli doc add-board <document_id> --parent-id <block_id> --index 0
添加 Callout
向文档添加高亮块:
# 添加信息类型 Callout
feishu-cli doc add-callout <document_id> "提示内容" --callout-type info
# 添加警告类型 Callout
feishu-cli doc add-callout <document_id> "警告内容" --callout-type warning
# 指定位置添加
feishu-cli doc add-callout <document_id> "内容" --callout-type error --parent-id <block_id> --index 0
Callout 类型与颜色映射:
飞书 Callout 共 6 种颜色。Markdown 导入(doc import)使用 [!TYPE] 语法支持全部 6 种,CLI 命令(doc add-callout --callout-type)支持其中 4 种:
| 颜色 | 背景色值 | Markdown 语法 | CLI --callout-type |
|---|---|---|---|
| 蓝色 | 6 | [!NOTE] |
info |
| 红色 | 2 | [!WARNING] |
error |
| 橙色 | 3 | [!CAUTION] |
— |
| 黄色 | 4 | [!TIP] |
warning |
| 绿色 | 5 | [!SUCCESS] |
success |
| 紫色 | 7 | [!IMPORTANT] |
— |
需要橙色(CAUTION)或紫色(IMPORTANT)时,请使用 Markdown 导入方式(
doc import或doc add --content-type markdown)。
批量更新块
批量更新文档中的块内容:
# 从 JSON 文件批量更新
feishu-cli doc batch-update <document_id> --source-type content --file updates.json
JSON 格式示例:
[
{
"block_id": "block_xxx",
"block_type": 2,
"content": "更新后的文本内容"
}
]
输出格式
创建/更新完成后报告:
- 文档 ID
- 文档 URL:
https://feishu.cn/docx/
How to use feishu-cli-write on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add feishu-cli-write
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches feishu-cli-write from GitHub repository riba2534/feishu-cli and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate feishu-cli-write. Access the skill through slash commands (e.g., /feishu-cli-write) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★25 reviews- ★★★★★Pratham Ware· Dec 16, 2024
We added feishu-cli-write from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★William Shah· Dec 12, 2024
Registry listing for feishu-cli-write matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Yash Thakker· Nov 7, 2024
feishu-cli-write fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Isabella Patel· Nov 3, 2024
Solid pick for teams standardizing on skills: feishu-cli-write is focused, and the summary matches what you get after install.
- ★★★★★Dhruvi Jain· Oct 26, 2024
Registry listing for feishu-cli-write matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Yuki Gupta· Oct 22, 2024
We added feishu-cli-write from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Anika Park· Sep 13, 2024
feishu-cli-write is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Piyush G· Sep 9, 2024
Keeps context tight: feishu-cli-write is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Shikha Mishra· Aug 28, 2024
feishu-cli-write has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Benjamin Shah· Aug 4, 2024
Useful defaults in feishu-cli-write — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
showing 1-10 of 25