AI Skill
Pass
Audit score 90

lark-markdown

larksuite/cli

View, create, upload, edit and compare Markdown files in Lark Drive.

What is lark-markdown?

Manages native .md files stored in Lark Drive. Use this skill when you need to create, read, edit, patch, or compare Markdown files. Does not handle importing Markdown as online documents, file search, permissions, comments, moving, or deleting.

  • Create new Markdown files in Drive with +create
  • Fetch and read Markdown file contents with +fetch
  • Overwrite existing Markdown files with +overwrite
  • Apply partial text or regex replacements with +patch (fetch-local-replace-overwrite)
  • Compare Markdown versions or remote vs. local files with +diff

How to install lark-markdown

npx skills add null --skill lark-markdown
Prerequisites
  • lark-cli installed and available
  • Authentication via lark-cli auth login (for user identity) or bot credentials configured
  • Read lark-shared/SKILL.md for authentication and permission handling details
Claude Code
Cursor
Windsurf
Cline

How to use lark-markdown

  1. 1.Authenticate: run lark-cli auth login for user identity or configure bot credentials
  2. 2.Decide identity: use --as user for personal files, --as bot for automated scenarios with app permissions
  3. 3.Choose operation: +create for new files, +fetch to read, +overwrite to replace, +patch for partial edits, +diff to compare
  4. 4.Run the command with required flags (--name, --file-token, --content, etc.)
  5. 5.For +patch with regex: ensure proper escaping of special characters in --pattern
  6. 6.Check error messages for scope, permission, or version limit issues before retrying

Use cases

Good for
  • Create a new .md documentation file in your Lark Drive workspace
  • Read the current content of a Markdown file stored in Drive
  • Update a Markdown file with new content or partial edits
  • Compare two versions of a Markdown file to see what changed
  • Replace specific text or patterns within a Markdown file using regex
Who it's for
  • Documentation writers managing .md files in Lark Drive
  • Teams collaborating on Markdown-based content
  • Developers automating Markdown file updates
  • Anyone needing to version-control or diff Markdown files in Lark

lark-markdown FAQ

Should I use --as user or --as bot?

Use --as user for personal cloud space files (requires lark-cli auth login first). Use --as bot for automation scenarios where the app already owns or has permissions to the target file. Check lark-shared/SKILL.md for detailed permission handling.

Can I import a Markdown file as an online Lark document?

No. Use lark-drive skill with +import --type docx instead to convert Markdown to a Lark online document.

What operations are NOT supported by this skill?

File search, rename, move, delete, permission management, comments, and other cloud space operations. Use lark-drive skill for those tasks.

How does +patch work?

+patch downloads the full Markdown file, applies local text/regex replacement, then uploads the entire file. It is not a server-side atomic patch. Ensure the final content is not empty.

What if I get a permission denied or missing scope error?

Check your identity (--as user vs --as bot) and verify you have the required permissions. For user, ensure you've authorized the app. For bot, check app scope and target directory ACL. Do not retry without addressing the root cause.

Full instructions (SKILL.md)

Source of truth, from larksuite/cli.


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-drivelark-cli drive +version-history

  • 用户要把本地 Markdown 导入成在线新版文档(docx),不要用本 skill,改用 lark-drivelark-cli drive +import --type docx

  • 用户要对 Markdown 文件做rename / move / delete / 搜索 / 权限 / 评论等云空间(云盘/云存储)操作,不要留在本 skill,切到 lark-drive

  • markdown +create / +overwrite 命中 missing scopepermission deniednot foundversion 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 / --content
  • markdown +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说明
+createCreate a Markdown file in Drive
+diffCompare two remote Markdown versions, or compare remote Markdown against a local file
+fetchFetch a Markdown file from Drive
+patchPatch a Markdown file in Drive via fetch-local-replace-overwrite
+overwriteOverwrite an existing Markdown file in Drive

参考

  • lark-shared — 认证和全局参数
  • lark-drive — Drive 文件管理、导入 docx、move/delete/search 等