lark-markdown
open.feishu.cn
View, create, upload, edit, patch, and diff Markdown files stored in Lark (Feishu) Drive
What is lark-markdown?
lark-markdown is a skill for coding agents that enables direct manipulation of native Markdown files in Lark (Feishu) Drive. It supports creating, fetching, overwriting, patching (partial text/regex replacement), and diffing Markdown files via the lark-cli tool. It does not handle importing Markdown as online documents (docx), nor cloud drive management operations like search, permissions, comments, move, or delete.
- Create and upload native .md files to Lark Drive
- Fetch and read Markdown file content from Lark Drive
- Overwrite existing Markdown files in Lark Drive
- Apply partial text or regex replacements to Markdown files (fetch-replace-overwrite)
- Compare two remote Markdown versions or a remote file against a local draft
- Integrates with lark-shared for authentication and lark-drive for drive management operations
How to install lark-markdown
npx skills add null --skill lark-markdown- lark-cli must be installed and available in PATH
- lark-shared skill must be available (provides authentication and global parameters)
- User or bot authentication must be configured via lark-cli auth login (for user identity)
- Target file names and local file paths must include explicit .md extension
- For bot identity, the app must have appropriate Drive scopes and ACL on the target directory
How to use lark-markdown
- 1.Install the skill: npx skills add null --skill lark-markdown
- 2.Ensure lark-cli is installed and lark-shared SKILL.md is read for auth setup
- 3.Authenticate: run lark-cli auth login for user identity, or configure bot credentials
- 4.To create a new Markdown file: lark-cli markdown +create with --name (must end in .md) and --content or --file
- 5.To fetch a file: lark-cli markdown +fetch --file-token <token>
- 6.To overwrite a file: lark-cli markdown +overwrite --file-token <token> --content or --file
- 7.To patch (partial replace): lark-cli markdown +patch --file-token <token> --pattern <text> --content <replacement> (add --regex for regex mode, escape special chars)
- 8.To diff versions or compare with local: lark-cli markdown +diff with appropriate flags
Use cases
- Uploading a local Markdown document to Lark Drive
- Reading the current content of a Markdown file stored in Lark Drive
- Updating a specific version string or section in a remote Markdown file without a full rewrite
- Diffing a remote Markdown file against a local draft before overwriting
- Automating Markdown file updates in CI/bot workflows using bot identity
- Developers managing documentation stored as Markdown in Lark Drive
- Teams automating content updates to Lark-hosted Markdown files
- Coding agents (Claude Code, Cursor) performing file edits on behalf of users
- Engineers who need to diff or audit Markdown version history in Lark Drive
- Bot/automation workflows that create or update Markdown files programmatically
lark-markdown FAQ
No. Use the lark-drive skill with lark-cli drive +import --type docx for that purpose.
No. Those cloud drive management operations are handled by the lark-drive skill.
No. +patch is a client-side orchestration: it downloads the full Markdown, performs the replacement locally, then uploads the entire file. It supports only a single --pattern/--content pair per invocation.
Use --as user for files owned by the user (most common). Use --as bot for automation scenarios where the app already owns or has permissions on the target file. Do not switch identities arbitrarily on permission errors — diagnose the actual cause first.
You must escape regex special characters in --pattern when using --regex mode. For example, use \( and \) instead of ( and ), and \. instead of a literal dot.
Full instructions (SKILL.md)
Source of truth, from open.feishu.cn.
name: lark-markdown version: 1.2.1 description: "飞书 Markdown:查看、创建、上传、编辑和比较 Markdown 文件。当用户需要创建或编辑 Markdown 文件、读取、修改、局部 patch 或比较差异时使用。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。" metadata: requires: bins: ["lark-cli"] cliHelp: "lark-cli markdown --help"
markdown (v1)
CRITICAL — 开始前 MUST 先用 Read 工具读取 ../lark-shared/SKILL.md,其中包含认证、权限处理
快速决策
-
身份:Markdown 文件通常属于用户云空间资源,优先使用
--as user。如为自动化场景,或应用已创建并持有目标文件权限,可按场景使用--as bot。首次以user身份访问前执行lark-cli auth login -
markdown +create/+overwrite失败时,先判断是不是身份和权限问题:bot更常见的是 app scope 或目标目录 ACL,user更常见的是用户授权或用户 ACL;不要不加判断地来回切身份重试。 -
用户要上传、创建一个原生
.md文件,使用lark-cli markdown +create -
用户要比较原生
.md文件的历史版本差异,或比较远端 Markdown 与本地草稿,使用lark-cli markdown +diff -
用户要读取 Drive 里某个
.md文件内容,使用lark-cli markdown +fetch -
用户要对 Markdown 文件做局部文本替换 / 正则替换,优先使用
lark-cli markdown +patch -
用户要覆盖更新 Drive 里某个
.md文件内容,使用lark-cli markdown +overwrite -
用户要先拿 Markdown 文件的历史版本号,再做比较/下载/回滚,先用
lark-drive的lark-cli drive +version-history -
用户要把本地 Markdown 导入成在线新版文档(docx),不要用本 skill,改用
lark-drive的lark-cli drive +import --type docx -
用户要对 Markdown 文件做rename / move / delete / 搜索 / 权限 / 评论等云空间(云盘/云存储)操作,不要留在本 skill,切到
lark-drive -
markdown +create/+overwrite命中missing scope、permission denied、not found、version limit时,默认停止重试并按报错 hint 处理;只有rate limit或临时网络错误才做有限重试。
核心边界
- 本 skill 处理的是 Drive 中作为普通文件存储的 Markdown,不是 docx 文档
--name和本地--file文件名都必须显式带.md后缀;不满足时 shortcut 会直接报错--content支持:- 直接传字符串
@file从本地文件读取内容-从 stdin 读取内容
markdown +patch的内部语义是:先完整下载 Markdown,再本地替换,再整文件覆盖上传markdown +patch不是服务端原子 patch;它是 CLI 侧编排出来的局部更新能力markdown +patch当前只支持单组--pattern/--contentmarkdown +patch替换后的最终内容不能为空;CLI 会拒绝上传空文件,因为 Drive 不支持零字节 Markdown,且空文件通常是误操作--file只接受本地.md文件路径
正则替换时要特别注意 --pattern 的转义:
# BAD: 未转义正则特殊字符,可能匹配到错误位置
lark-cli markdown +patch --file-token boxcnxxxx --regex --pattern "version (1.0)" --content "version (2.0)"
# GOOD: 显式转义括号和点号
lark-cli markdown +patch --file-token boxcnxxxx --regex --pattern "version \\(1\\.0\\)" --content "version (2.0)"
Shortcuts(推荐优先使用)
Shortcut 是对常用操作的高级封装(lark-cli markdown +<verb> [flags])。有 Shortcut 的操作优先使用。
| Shortcut | 说明 |
|---|---|
+create | Create a Markdown file in Drive |
+diff | Compare two remote Markdown versions, or compare remote Markdown against a local file |
+fetch | Fetch a Markdown file from Drive |
+patch | Patch a Markdown file in Drive via fetch-local-replace-overwrite |
+overwrite | Overwrite an existing Markdown file in Drive |
参考
- lark-shared — 认证和全局参数
- lark-drive — Drive 文件管理、导入 docx、move/delete/search 等
Related skills
More from open.feishu.cn and the wider catalog.
lark-approval
Query, process, and initiate Lark approval tasks via CLI — search definitions, manage instances, and handle approvals.
lark-doc
Read, create, and edit Feishu cloud documents (Docx/Wiki) with content manipulation and media handling.
lark-base
Operate Feishu Multidimensional Tables (Base): create tables, manage fields, records, views, formulas, forms, dashboards, workflows, and permissions.
lark-calendar
Manage Lark calendar events and meeting rooms: view, create, update, search events, check availability, and book rooms.
lark-drive
Manage Feishu Drive files and folders: upload, download, organize, and import local documents.
lark-contact
Resolve Lark/Feishu names & emails to open_id, or look up user details by open_id