L

lark-shared

by @larksuitev
4.8(20)

Lark-CLI sharing rules, guiding authentication, permission handling, and configuration initialization, supporting `user` and `tenant` identities.

api-integrationauthenticationsaasGitHub
Installation
npx skills add larksuite/cli --skill lark-shared
compare_arrows

Before / After Comparison

1
Before

Manually configure application credentials, manage identity types and permissions, easily confusing the applicable scenarios and invocation methods for user and tenant identities.

After

Automatically initialize the configuration process, guide users through authorization, intelligently switch identity types, and unify permission and authentication logic.

SKILL.md

lark-shared

lark-cli 共享规则

本技能指导你如何通过lark-cli操作飞书资源, 以及有哪些注意事项。

配置初始化

首次使用需运行 lark-cli config init 完成应用配置。

当你帮用户初始化配置时,使用background方式使用下面的命令发起配置应用流程,启动后读取输出,从中提取授权链接并发给用户:

# 发起配置(该命令会阻塞直到用户打开链接并完成操作或过期)
lark-cli config init --new

认证

身份类型

两种身份类型,通过 --as 切换:

身份 标识 获取方式 适用场景

user 用户身份 --as user lark-cli auth login 等 访问用户自己的资源(日历、云空间等)

bot 应用身份 --as bot 自动,只需 appId + appSecret 应用级操作,访问bot自己的资源

身份选择原则

输出的 [identity: bot/user] 代表当前身份。bot 与 user 表现差异很大,需确认身份符合目标需求:

  • Bot 看不到用户资源:无法访问用户的日历、云空间文档、邮箱等个人资源。例如 --as bot 查日程返回 bot 自己的(空)日历

  • Bot 无法代表用户操作:发消息以应用名义发送,创建文档归属 bot

  • Bot 权限:只需在飞书开发者后台开通 scope,无需 auth login

  • User 权限:后台开通 scope + 用户通过 auth login 授权,两层都要满足

权限不足处理

遇到权限相关错误时,根据当前身份类型采取不同解决方案

错误响应中包含关键信息:

  • permission_violations:列出缺失的 scope (N选1)

  • console_url:飞书开发者后台的权限配置链接

  • hint:建议的修复命令

Bot 身份(--as bot

将错误中的 console_url 提供给用户,引导去后台开通 scope。禁止对 bot 执行 auth login

User 身份(--as user

lark-cli auth login --domain <domain>           # 按业务域授权
lark-cli auth login --scope "<missing_scope>"   # 按具体 scope 授权(推荐,符合最小权限原则)

规则:auth login 必须指定范围(--domain--scope)。多次 login 的 scope 会累积(增量授权)。

Agent 代理发起认证(推荐)

当你作为 AI agent 需要帮用户完成认证时,使用background方式 执行以下命令发起授权流程, 并将授权链接发给用户:

# 发起授权(阻塞直到用户授权完成或过期)
lark-cli auth login --scope "calendar:calendar:readonly"

安全规则

  • 禁止输出密钥(appSecret、accessToken)到终端明文。

  • 写入/删除操作前必须确认用户意图

  • --dry-run 预览危险请求。

Weekly Installs3.6KRepositorylarksuite/cliGitHub Stars1First SeenTodaySecurity AuditsGen Agent Trust HubPassSocketWarnSnykPassInstalled oncodex3.6Kopencode3.6Kgithub-copilot3.6Kcursor3.6Kgemini-cli3.6Kcline3.6K

User Reviews (0)

Write a Review

Effect
Usability
Docs
Compatibility

No reviews yet

Statistics

Installs155.3K
Rating4.8 / 5.0
Version
Updated2026年5月23日
Comparisons1

User Rating

4.8(20)
5
35%
4
50%
3
15%
2
0%
1
0%

Rate this Skill

0.0

Compatible Platforms

🔧Claude Code

Timeline

Created2026年3月29日
Last Updated2026年5月23日