AGENTS.md · larksuite/cli
AGENTS.md from larksuite/cli: 236 lines covering Purpose, Implementation Discipline, Build, Choose the Correct Surface and more.
Template by larksuite
Chalk Labs
Need help deploying AGENTS.md · larksuite/cli?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code. Read the repository before you give any tool access to your data.
curl -fsSL https://raw.githubusercontent.com/larksuite/cli/main/AGENTS.md -o AGENTS.md
Read it and adapt it to your project before use.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: code-generation, testing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
What's in it
An AGENTS.md file: instructions coding agents (Codex, Cursor, Copilot, Gemini CLI and others) read before working in a repo.
- For
- Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code
- Length
- 236 lines
- File
AGENTS.md
Sections
- Purpose
- Implementation Discipline
- Build
- Choose the Correct Surface
- Source Layout
- Hard Contracts
- Structured Errors
- Affordance and Skills
- Tests
- Validation
- Maintaining This File
- Commit and PR
First lines (shown under the repo's MIT license)
# AGENTS.md ## Purpose `lark-cli` is the official Lark/Feishu CLI for humans and AI agents. Optimize for predictable machine-readable behavior without making the human CLI worse. Keep each PR focused on one goal: CLI UX, reliability, simpler explicit code, or a useful gate. Done means the correct implementation surface, preserved contracts unless a break was requested, and reported checks. Public behavior, tests, lint, and CI define current contracts. Existing code is evidence, but a legacy exception is not precedent; `Proposal` documents are direction only. Do not mix unrelated cleanup, hand-edit generated files, weaken gates, or broaden allowlists to make CI pass. ## Implementation Discipline Use this sequence for product behavior or enforcement changes: 1. Establish the current contract and owner before choosing a solution. Trace the flow from the command or shortcut through runtime and internal owners to wire output; inspect affected callers and tests, then choose the surface below. 2. Apply YAGNI to scope. Implement the behavior required now; do not add speculative modes, configuration, compatibility paths, extension points, or scaffolding. 3. Reuse the project's existing machinery before creating a parallel path. Prefer the owning generic, runtime, or internal surface, then the Go standard library or an existing dependency, while preserving the contracts below. 4. Fix the root cause at the narrowest cohesive boundary shared by affected callers. Keep command and domain policy at the caller unless there is a real cross-command invariant for an internal owner to enforce. 5. Ship the smallest complete change: implementation, a revert-failing regression test for behavior or enforcement, and required contract or guidance updates. Optimize for minimum owned complexity, not minimum diff or line count. A correct root-cause fix may touch the owner, callers, tests, and docs; a one-line workaround at the wrong layer is not simpler. Prefer deletion and boring explicit code, and avoid one-use abstractions or new dependencies for straightforward behavior. YAGNI never overrides explicit requirements or output, error, path, security, compatibility, and data-safety contracts. If a deliberately limited solution has a real ceiling, document the ceiling and the concrete condition for expanding it at the decision point. ## Build Run `make build` for the canonical local build; it writes `./lark-cli` with version metadata and the committed Catalog Snapshot embedded from `internal/registry/catalog/manifest.json` plus `internal/registry/catalog/services/*.json`. Build and test targets consume this tracked snapshot without a metadata fetch or Python prerequisite. `make live-skills-test` additionally requires working `npx` and network access. ## Choose the Correct Surface | Need | Implement in | Rule | |------|--------------|------| | Agent/human-friendly workflow, composition, or smart defaults | `shortcuts/<domain>/` via `common.Shortcut` | Must add UX or workflow value beyond exposing one endpoint. | | One-to-one supported OpenAPI method | Committed Catalog Snapshot under `internal/registry/catalog/manifest.json` plus `services/*.json`, and generic `cmd/service/` machinery | Verify it with `schema`. Update the manifest and matching service snapshot together; do not add a shortcut merely to expose a missing catalog method. | | Arbitrary OpenAPI endpoint | Generic `cmd/api/` machinery | Keep it endpoint-agnostic. | | Auth, config, profile, update, or CLI lifecycle | `cmd/<area>/` plus the owning shared/internal package | Keep new Cobra code as wiring when a lower owner exists. | | EventKey, payload shape, or domain projection | `events/<domain>/` | Shared event mechanics stay in `internal/event/`; CLI assembly stays in `cmd/event/`. | | Command-independent mechanism or cross-command invariant | Owning `internal/<area>/` package | Keep UX/domain policy at the caller; use a cohesive owner, not a generic utils package. Test the owner and affected caller contracts. | | Public plugin or host integration | `extension/` | Exported symbols are compatibility commitments; orchestration stays internal. | | Per-command decision guidance: when, avoid, prerequisites, tips, or examples | `affordance/<domain>.md` | Enrich `--help` and `schema` without restating command descriptions, flags, or field schemas. | | Domain routing, concepts, safety, or cross-command agent workflow | `skills/<name>/SKILL.md` and `references/` | Keep always-needed decisions in `SKILL.md`, conditional HOW in references, and link commands from affordance. | Do not duplicate one command surface inside another. Register new shortcuts in the domain's `Shortcuts()`; declare risk, identities/scopes, flags, and dry-run. ## Source Layout | Path | What it does | |------|-------------| | `cmd/root.go` | Entry point, command registration, strict mode pruning | | `cmd/profile/` | Multi-profile management (add/list/use/rename/remove) | | `cmd/config/` | Config init, show, strict-mode | | `cmd/service/` | Auto-registers API commands from `internal/registry/catalog/manifest.json` and `internal/registry/catalog/services/*.json` | | `shortcuts/common/runner.go` | Shortcut execution pipeline, Flag.Input (@file/stdin) resolution | | `shortcuts/` | Domain-specific shortcut implementations | | `internal/cmdutil/factory.go` | Factory pattern — identity resolution, credential, config | | `internal/cmdutil/factory_default.go` | Production factory wiring | | `internal/credential/` | Credential provider chain (extension → default) | | `extension/credential/` | Plugin-facing credential interfaces and env provider | | `internal/client/client.go` | APIClient: DoSDKRequest, DoStream | | `internal/core/config.go` | Multi-profile config loading/saving | | `internal/vfs/` | Filesystem abstraction (use `vfs.*` instead of `os.*`) | | `internal/validate/path.go` | Path safety validation | ## Hard Contracts Read the [JSON output contract](README.md#json-output-contract) before changing wire output. Read the [source guard guide](lint/README.md) and `.golangci.yml` before changing or waiving enforcement. - Command/flag semantics, help/schema metadata, output placement and shapes, errors, exit codes, risk/identity, and exported APIs are compatibility contracts. When forwarding or echoing accepted input, preserve it verbatim unless its contract defines normalization; never silently substitute another behavior. - Success data goes to stdout; typed failure envelopes, progress, warnings, and hints go to stderr. Predicate/self-contained results and partial failures are documented exceptions whose complete result remains on stdout. - Keep new or touched Cobra code as wiring. Lark/Feishu API calls in shortcuts go through `*common.RuntimeContext`; direct HTTP is only for non-gateway protocols such as presigned storage and requires a precise `//nolint:forbidigo` reason. - Keep user/workspace FileIO invocation-scoped: use `runtime.FileIO()`, `runtime.ValidatePath()`, and `runtime.ResolveSavePath()` so portable commands do not assume a local host or process working directory. - Shortcuts do not use `internal/vfs` for user/workspace files. A narrow `//nolint:depguard` waiver is allowed only for CLI-owned state or explicitly CLI-managed host configuration; explain that ownership boundary. Other internal filesystem code uses `internal/vfs` and validates paths. - If FileIO lacks a host-local tree operation, prefer an owning `internal/` package or optional capability. Direct `os` calls require a stated local-only boundary, validated and bounded paths, and a precise `//nolint:forbidigo` reason. - Do not hardcode resolver-owned hosts. At new API boundaries, or when changed behavior consumes fields from a loose map, project that shape into a typed struct before downstream use. Extend published interfaces through optional interfaces rather than breaking external implementations. - Source guards enforce raw HTTP/os/vfs, resolver-host, and migrated-error constructs; other semantics rely on tests and review. Every exemption must be narrow, local, and explain why the safe path does not apply. ## Structured Errors Before changing a command failure, taxonomy, or error wire field, read the [error contract](errs/ERROR_CONTRACT.md); it owns constructor selection, wrapping, extension fields, stability, and CI guards. - Command-facing failures use typed `errs.*` unless the error contract defines an output-control exception. Never return a final plain `fmt.Errorf` / `errors.New` or ad hoc envelope; pass typed errors through and preserve causes. - Lark API failures use a domain typed wrapper, `runtime.CallAPITyped`, or `runtime.DoAPIJSONTyped`; raw callers use `runtime.ClassifyAPIResponse` or `errclass.BuildAPIError`. - `param` names only failing user input; recovery belongs in `hint`. Populate `missing_scopes`, `log_id`, and similar fields only from known runtime evidence. - Error tests assert typed metadata and cause preservation, not message text alone. ## Affordance and Skills Before editing command guidance, read the [affordance guide](affordance/README.md). For plugin distributions, read [Ship skills and command guidance](extension/platform/README.md#ship-skills-and-command-guidance). - Go metadata/schema owns WHAT; affordance owns command-level WHEN; `SKILL.md` owns domain routing, concepts, safety, and cross-command workflows; `references/` owns detailed or conditional HOW. - Do not duplicate canonical descriptions, schemas, or generic error taxonomy. Keep workflow-specific recovery in a skill when it changes agent behavior; affordance examples remain runnable, current, and safe. - Skill frontmatter `description` is a concise WHAT/WHEN/NOT routing trigger. Keep always-needed decisions in `SKILL.md`; move conditional detail to `references/`. - Skill names and reference paths are public pointers. Every path reachable from shipped docs must ship. Before referencing a new content directory, update `content_embed.go` and add an embedded-FS reachability test; `assets/` and `scripts/` stay source-only unless the distribution contract changes. ## Tests
Signals
- Stars
- 17,821
- Forks
- 1,352
- Open issues
- 273
- Last commit (this folder)
- Sep 10, 2026 (1 month ago)
- Last release
- Oct 13, 2026 (17 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/larksuite/cli
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from larksuite
- 0.868score
lark-drive
larksuite
飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实…
SkillAFreshness: A★ 17.8KClaude Code +9 - 0.868score
lark-mail
larksuite
飞书邮箱:Use when user mentions 起草邮件、写邮件、草稿、发送/回复/转发邮件、查阅邮件、看邮件、搜索邮件、邮件文件夹、邮件标签、邮件联系人、监听新邮件、邮件收信规则等;use for mail/email intent only.
SkillAFreshness: A★ 17.8KClaude Code +9 - 0.868score
lark-sheets
larksuite
飞书电子表格:创建和操作电子表格。支持工作表与行列结构(增删/合并/尺寸/隐藏/冻结/分组)、单元格读写(值/公式/样式/批注/单元格图片)、区域复制移动排序填充、查找替换、批量更新,图表、透视表、条件格式、筛选器与筛选视图、下拉列表、迷你图、浮动图片等对象的创建与维护,以及公式校验、历史版本回滚、本地…
SkillAFreshness: A★ 17.8KClaude Code +9 - 0.868score
lark-wiki
larksuite
飞书知识库:管理知识空间、空间成员和文档节点。创建和查询知识空间、查看和管理空间成员、管理节点层级结构、在知识库中组织文档和快捷方式。当用户需要在知识库中查找或创建文档、浏览知识空间结构、查看或管理空间成员、移动或复制节点时使用。当用户给出 doubao.com 的 /wiki/ URL/token…
SkillAFreshness: A★ 17.8KClaude Code +9 - 0.868score
lark-event
larksuite
Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM…
SkillAFreshness: A★ 17.8KClaude Code +9 - 0.868score
lark-apps
larksuite
妙搭(Spark/Miaoda)应用开发与托管:应用创建、本地全栈开发、云端生成迭代、创意设计(UI mockup / 可交互原型 / 线框图 / 落地页 / 仪表盘 / 幻灯片 deck / 视觉探索)、AI相关能力和飞书平台能力或者其他外部能力集成、日志/Trace/监控指标/PV/UV…
SkillAFreshness: A★ 17.8KClaude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get AGENTS.md · larksuite/cli running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
AGENTS.md · larksuite/cli. Agent Mart. https://agentmart.dev/templates/larksuite-cli-agents-md (last updated 2026-10-24)