docs (v1)

|----------|---------------------------------------------------------|-----------|----------|

docs (v1):

Lark Docs Integration for Happycapy Skills

What Is This

The docs (v1) skill (lark-doc) is a command-line integration for managing Feishu (Lark) cloud documents via the Happycapy Skills platform. It provides a comprehensive set of features to create, edit, and manage Lark documents, including Markdown-to-doc conversion, document content retrieval and updates, image and file uploads/downloads, and document search within the Lark cloud space. This skill leverages the lark-cli tool and is specifically designed to streamline document workflows for teams and individuals using Lark's cloud office suite.

The core capabilities include:

  • Creating and editing Lark documents from Markdown files
  • Reading and updating document content (append, overwrite, replace, insert, delete)
  • Uploading and downloading images and files in documents
  • Searching for documents within Lark cloud space
  • Handling document types and tokens, including special treatment for Wiki links

Why Use It

Lark's cloud document ecosystem is powerful but can be complex to manage programmatically, especially when automating content creation, updates, or resource discovery across different document types. The docs (v1) skill abstracts these complexities by providing a unified interface for document operations, enabling:

  • Faster document creation and updates directly from Markdown or scripts
  • Automated workflows for documentation, reporting, or collaboration
  • Easy integration into DevOps or CI/CD pipelines that require documentation steps
  • Streamlined resource discovery across your Lark workspace, including docs, spreadsheets, and wikis

By using this skill, organizations and developers can save time, reduce manual errors, and ensure consistent document management practices within the Lark platform.

How to Use It

Prerequisites

  • The lark-cli binary must be installed and properly authenticated. See the shared authentication and permissions documentation referenced in ../lark-shared/SKILL.md.
  • Ensure you have access to the necessary Lark workspace and document permissions.

Creating a Document from Markdown

To create a new Lark doc from a local Markdown file:

lark-cli docs create --from markdown --input ./README.md --title "Project Overview"

This command converts the specified Markdown file to a Lark document and uploads it to your cloud space.

Reading Document Content

To retrieve the content of a specific document:

lark-cli docs get --file-token doxcnxxxxxxxxx

Replace doxcnxxxxxxxxx with the actual file token obtained from the document URL.

Updating a Document

The skill supports various update modes:

  • Append content at the end:

    lark-cli docs update --file-token doxcnxxxxxxxxx --mode append --input ./appendix.md
  • Overwrite entire content:

    lark-cli docs update --file-token doxcnxxxxxxxxx --mode overwrite --input ./new_content.md
  • Insert at a specific location (requires additional parameters such as position identifiers):

    lark-cli docs update --file-token doxcnxxxxxxxxx --mode insert --position 5 --input ./snippet.md
  • Delete specific content (based on block or identifier):

    lark-cli docs update --file-token doxcnxxxxxxxxx --mode delete --block-id blkcnxxxxxxx

Uploading/Downloading Images and Files

To upload an image or file into a document:

lark-cli docs upload --file-token doxcnxxxxxxxxx --file ./diagram.png

To download an image or file from a document:

lark-cli docs download --file-token doxcnxxxxxxxxx --file-id attcnxxxxxxxxx

Searching for Documents

To search for documents by keyword across your Lark workspace:

lark-cli docs search --keyword "Quarterly Report"

This helps locate resources such as spreadsheets, docs, wikis, and more.

Handling Document Tokens

The skill requires the correct token type for each document operation. Extract tokens from the document URL as follows:

URL ExampleToken ExtractionToken Type
https://example.larksuite.com/docx/doxcnxxxdoxcnxxxfile_token
https://example.larksuite.com/doc/doccnxxxdoccnxxxfile_token
https://example.larksuite.com/sheets/shtcnxxxshtcnxxxfile_token
https://example.larksuite.com/wiki/wikcnxxxwikcnxxx (special case)wiki_token

Wiki links require additional processing (see Important Notes below).

When to Use It

Use the docs (v1) skill when you need to:

  • Automate documentation workflows in your Lark workspace
  • Batch-convert Markdown knowledge bases into Lark docs
  • Programmatically update reports, meeting notes, or collaborative documents
  • Insert images or files into documentation without manual upload
  • Discover and interact with cloud resources based on keywords or names

This skill is especially useful for teams that rely on Lark for knowledge management, technical documentation, or regular reporting.

Important Notes

  • Authentication and Permissions: Always start by consulting the shared documentation at ../lark-shared/SKILL.md for authentication and permission setup. The skill will not function without proper credentials.
  • Token Handling: For most document types, the token in the URL can be used directly as file_token. However, for Wiki links (/wiki/wikcnxxx), you must first query the actual object type and obtain the real token. Do not assume the URL token is a valid file_token.
  • Wiki Special Handling: Since Wiki links may point to docs, sheets, or other resource types, always resolve their type and actual token before performing operations.
  • CLI Help: To see all available subcommands and options, run:
    lark-cli docs --help
  • File Format Support: The skill primarily supports conversion from Markdown, but may also support other formats as Lark expands its API.

By following these guidelines, users can fully leverage the power of the docs (v1) skill to automate and manage Lark cloud documents efficiently and reliably.