Use for targeted Feishu Docx editing with lark-cli v2 when the user wants an existing remote Feishu document synced to local code/docs, a section or table preserved while wording is refined, or files embedded into specific table cells. Triggers include "飞书的文档帮忙也改一下", "按照原表格格式", "附件放到表格中", "先不用改源文件", and Feishu Docx URLs where structure must be preserved.
Install
npx skillscat add kilimiaosix/agent-skills/feishu-block-surgery Install via the SkillsCat registry.
Feishu Block Surgery
Use this skill when the user gives a Feishu Docx URL/token and wants targeted edits to an existing document. Prefer preserving the current structure and changing only the requested blocks.
Do not use it for Sheets/Base/Slides work, brand-new documents with no existing structure, or summarize-only requests.
Workflow
- Confirm the doc URL/token, target sections, and whether the user wants preview-first behavior.
- Check auth:
lark-cli auth status --verify- Fetch the current structure before editing:
lark-cli docs +fetch --api-version v2 --doc "$DOC" --scope outline --detail with-ids- Narrow to the smallest useful scope:
lark-cli docs +fetch --api-version v2 --doc "$DOC" --scope section --start-block-id <block_id> --detail full
lark-cli docs +fetch --api-version v2 --doc "$DOC" --scope keyword --keyword "<text>" --detail with-idsPick the lightest edit form:
- Use
block_replacefor targeted table/section edits. - Use
block_insert_after,block_move_after, andblock_deletefor local layout adjustment. - Use full
overwrite --doc-format xmlonly when the user explicitly wants a structural rewrite or the doc is too rough to patch safely.
- Use
Apply edits incrementally:
lark-cli docs +update --api-version v2 --doc "$DOC" --command block_replace --block-id <block_id> --content @content.xmlFor overwrite flows, fetch the current revision_id and pass it explicitly:
lark-cli docs +update --api-version v2 --doc "$DOC" --command overwrite --doc-format xml --content @file.xml --revision-id <revision_id>- For attachments, upload from the artifact directory and then move the resulting file block into place:
cd /path/to/artifacts
lark-cli docs +media-insert --api-version v2 --doc "$DOC" --file ./artifact.zip --type file- Re-fetch the touched section/table and verify remote state.
User Preferences Captured
- Keep the original table/section skeleton unless the user asks for a redesign.
- Prefer concrete, project-specific Chinese wording over generic abstractions.
- When the user says "先不用改源文件", stage or show the draft before remote writes.
- If private platform/bot access fails but user-level
lark-cliworks, use user auth instead of forcing the private bot path. - Attachment placement matters: files should end up in the requested table/section, not merely appended somewhere in the document.
Pitfalls
- Unknown
docs +updateflags: use documented lark-cli v2 flags only. docs +media-insertrejects absolute paths:cdto the artifact directory and pass a relative path.- Uploading attachments before planning placement often leaves them outside the target table; upload, note block IDs, then move.
- Full overwrite can damage structure; use it only when the user wants a full rewrite.
Output
Report the exact changed sections, attachment placement, and verification method. Include the new revision ID when an overwrite or revision-sensitive update was used.