lark-acp: Instructions file for Claude Code

CLAUDE.md

lark-acp CLAUDE.md is an instructions file for Claude Code from 4t145/lark-acp. It costs 2,801 tokens per session, scanned A, original, MIT.

Repository guidance for a TypeScript library that connects Feishu (Lark) to the Agent Communication Protocol, a way for software agents to exchange messages. It sets rules for TypeScript 5.x code, constants, errors, and asynchronous code.

In plain words
What is it for?
Use it when adding or changing TypeScript code in the lark-acp repository, especially API integrations, error handling, constants, and asynchronous operations.
Why use it?
It gives contributors shared rules for writing predictable code and handling failures clearly. It also points them to the relevant Feishu and protocol documentation.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md.

This is 4t145/lark-acp's own configuration. It tells Claude Code how to work on lark-acp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything lark-acp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to 4t145/lark-acp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/4t145/lark-acp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/4t145/lark-acp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for lark-acp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/4t145/lark-acp/claude-md.svg)](https://agentmods.dev/instructions/4t145/lark-acp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/4t145/lark-acp/claude-md"><img src="https://agentmods.dev/badge/instructions/4t145/lark-acp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,801 This file is loaded in full into every session.
When invoked 2,801 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02801 $0.02801
Opus 5 $0.01401 $0.01401
Sonnet 5 $0.00560 $0.00560
Haiku 4.5 $0.00280 $0.00280

Measured 7d ago against content hash e2eab45ce543, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

lark-acp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 213 lines

How it starts

The opening of the file, as written. The whole thing — 213 lines — stays where its author put it; the contents beside it link to each section on GitHub.

LARK API

本项目是把飞书作为ACP的客户端的桥接库,虽然有API SDK调用,但是也不免会涉及到参考飞书官方API文档,必要时候需要参看:https://open.larksuite.com/document/server-docs/getting-started/getting-started

ACP

ACP(Agent Communication Protocol)参考文档 https://agentcommunicationprotocol.dev/core-concepts/architecture

TypeScript 工程准则(TypeScript 5.x / Strict Mode)

适用于本仓库所有 TypeScript 代码。AI 助手与人类贡献者都应遵守。

1. 避免魔法值

除显而易见的平凡值(01、一天 24 小时)外,禁止硬编码未加说明的数字或字符串字面量。

  • 使用 const 常量,配合 as const 收窄字面量类型;或定义字面量 union。
  • 优先使用所引入库已暴露的常量;库中确无定义时再自行声明。
  • 常量应放在与其语义最贴近的模块中,不要堆到一个全局 constants.ts

2. 错误处理:默认抛异常 + 文档化

TS / Node 生态以异常为主,默认采用抛异常 + JSDoc @throws 文档化的风格,与标准库、绝大多数第三方库保持一致。

  • 任何可能抛出(含 Promise reject)的函数,必须在 JSDoc 中通过 @throws 描述失败原因与错误类型。
  • 错误类型用自定义 Error 子类区分语义,并带上有用的上下文字段;不要把多种语义不同的错误合并成同一个原始 Error
  • 仅在以下特定边界才考虑 Result / Either 风格的返回类型(明确"失败是预期分支而非异常"):
    • schema 校验 / 反序列化(如 zodsafeParse
    • 用户输入 / 表单校验
    • 解析器 / 协议握手等"成功失败都是常规结果"的场景
  • 不要为了一致性把整个工程改成 Result 风格——会和生态摩擦严重。

3. 优先使用原生异步模式

  • 使用 async / await 与原生 Promise
  • 不要无理由引入 RxJS、Effect-TS 等重型抽象。
  • 并发原语优先 Promise.all / Promise.allSettledAbortController / AbortSignal,而不是再造一套调度层。
  • 需要节流 / 限流时使用 p-limitp-queuep-retry 等成熟库。

4. 类型系统的纪律

不安全的类型断言和 any 会让 strict mode 形同虚设。

  • 禁止 any:需要"任意类型"的位置一律用 unknown 加类型守卫。
  • 禁止不安全的 as——即"绕过类型检查的强转"。以下用法是允许甚至推荐的:
    • as const:字面量收窄
    • satisfies 之后的隐式收窄(优先 satisfies 而不是 as
    • 经过类型守卫 / schema 校验后的合法收窄
    • DOM API 中已知具体子类型时的向下转型(写一行注释说明)
  • 禁止 ! 非空断言:通过 early return / 类型守卫 / ?? / ?. 处理;确实必须断言时写一行注释说明理由(与 Rust expect("...") 同义)。
  • 解析外部数据(HTTP / 文件 / 用户输入 / IPC)一律走 schema 校验(推荐 zod),不允许直接 as SomeType

5. 保持代码可维护性

  • 长函数拆分为聚焦的辅助函数。
  • 函数 / 变量使用有意义的名称,不要 datainfotmp
  • 每个函数只做一件事。
  • 默认写 pure function,副作用收敛到模块边界(IO / 网络 / 全局状态)。
  • 仅为非显而易见的逻辑添加简洁注释;不要写"这段代码做什么",要写"为什么这么做"。

6. 扁平化控制流

  • early return / guard clause 让主路径保持在外层作用域。
  • 类型收窄替代多层 ifif (!user) return; user.xxx 优于嵌套 if (user) { ... }
  • 错误分支优先 throwreturn,避免用 else 包裹主逻辑。
  • discriminated union + switch + never 穷尽性检查,代替散落的 if / else if 链:

Read the full file on GitHub · 213 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 213 lines · 2,801 tokens per session scan A e2eab45ce543

Subscribe to this mod's changes

lark-acp CLAUDE.md is an instructions file published in the GitHub repository 4t145/lark-acp (12 stars, last pushed 3mo ago), licensed MIT. It adds 2,801 tokens to every session, about $0.0140 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

CopilotTraining typescript.instructions.md

Instructions for MSBart2/CopilotTraining, covering typescript development standards, type definitions, type safety, generics and union types.

MSBart2/CopilotTraining · 476 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens