Index of every page on this site: llms.txt
All skills
steelan9199 avatar

/feishu-token-updater

@9e01957
Run it yourself

更新飞书技能 feishu-docx-yashu 的 tenant_access_token 字段。激活条件:用户消息包含「更新/设置飞书 token」。

  • 2 files
  • 8.7 KB
  • Updated 4 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/steelan9199/wechat-publisher/feishu-token-updater

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈40 tokens for metadata: the name and description. ≈1.6k when used: this file.

Description uses 1.3% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈100 characters, or 1.3%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

飞书 tenant_access_token 更新器

用途

只做一件事:把用户剪贴板里的飞书访问令牌(tenant_access_token)写入配置文件:

C:\Users\Administrator\.skills-manager\skills\feishu-docx-yashu\config.default.json

  • 只改 tenant_access_token 的值,键名永远不动。
  • 不碰 appId、appSecret、member_id、custom 等其它任何字段。

环境说明

项目 说明
$SKILL_DIR 当前 Skill 所在的绝对目录,即 SKILL.md 文件所在的文件夹
校验脚本 $SKILL_DIR/update.js(JWT 校验 + 配置写入)
临时文件 $SKILL_DIR/_tmp_token.txt(剪贴板内容中转,用后即删)
命令外壳 Bash(Git Bash / MSYS2)优先,尽量不使用 PowerShell
剪贴板读取 经 Git Bash 伪文件 /dev/clipboard 直接读系统剪贴板
Node.js 版本 >=18(推荐用托管版 node 绝对路径)

⚠️ $SKILL_DIR 仅为文档占位符,不是环境变量,执行命令时必须替换为技能目录的实际绝对路径。在 bash 中若未替换,$SKILL_DIR 会被当作环境变量展开为空字符串,导致路径错误。

核心原则:Token 与脚本代码都不进上下文

token 极长(数百~数千字符)且是敏感凭证,放进聊天框纯属浪费 token 和泄露风险。因此:

  • 用户禁止把 token 粘贴到聊天消息里,只需复制到剪贴板。
  • 完整 token 只允许出现在「剪贴板 → 临时文件 → Node.js 脚本内部变量」这条链路里。
  • AI 与用户只接触 token 的前 ~20 字符前缀。
  • 仅当剪贴板内容未通过校验时,额外显示其前 10 与后 10 字符(换行/制表符转为 \n、\r、\t 形式)及总长度 len,供用户确认复制的到底是不是 token。

校验脚本 update.js 持久驻留技能目录,AI 直接 node 运行、不读取、不重写、不删除,脚本代码不进入对话上下文。

流程

  1. 用户把 token 复制到剪贴板,然后发「更新飞书 token」(不要粘贴 token 到聊天框)。
  2. 执行「第二步:读取剪贴板」(token 不进上下文)。
  3. 执行「第三步:运行校验脚本」(脚本内检测,只输出结果与前缀)。
  4. 执行「第四步:清理临时文件」。
  5. 执行「第五步:回执」。

第一步:触发

用户消息含「更新/设置飞书 token」即触发,不要等用户粘贴 token,直接执行第二步。token 是否有效由第三步的代码判断。

第二步:读取剪贴板 → 临时文件(内容不进上下文)

用 Bash(Git Bash / MSYS2)把剪贴板原样写入技能目录下的临时文件。Git Bash 提供 /dev/clipboard 伪文件,可直接读取系统剪贴板,无需 PowerShell、也不回显剪贴板内容($SKILL_DIR 替换为实际路径):

printf '%s' "$(cat /dev/clipboard)" > "$SKILL_DIR/_tmp_token.txt"

要点:

  • cat /dev/clipboard 读取系统剪贴板全文;printf '%s' 不追加额外换行(等价于 PowerShell 的 -Raw -NoNewline)。
  • 剪贴板为空时临时文件为空,属正常,交由第三步判为无效。
  • 此命令输出为空,不会把 token 打到终端。

第三步:运行校验脚本(代码不进上下文)

直接运行本技能目录下的校验脚本 update.js($SKILL_DIR 替换为实际路径)。脚本内含 JWT 特征校验与配置写入逻辑,AI 无需读取、无需重写脚本内容,脚本代码不进入对话上下文:

node "$SKILL_DIR/update.js"

脚本行为说明(供 AI 理解输出,无需查看源码):

  • 读取第二步写入的 _tmp_token.txt(脚本用 __dirname 自动定位同目录文件),校验 JWT 特征(eyJ 开头、三段点分隔)并解码 payload 确认 token 类型为 access_token。
  • 校验通过:将 token 写入配置文件的 tenant_access_token 字段,打印 UPDATED old=<旧前缀> new=<新前缀>(各 20 字符)。
  • 校验失败:打印 NO_VALID_TOKEN_IN_CLIPBOARD head=<前10字符> tail=<后10字符> len=<总长度>,换行/制表符以 \n、\r、\t 形式显示;用户可据此判断复制内容是否为完整 token、是否复制错内容、或 token 是否真的无效。
  • 路径用 /,Windows 下 Node 可直接识别,避免反斜杠转义问题。

第四步:清理临时文件

删除第二步产生的临时 token 文件($SKILL_DIR 替换为实际路径;校验脚本 update.js 不得删除):

rm -f "$SKILL_DIR/_tmp_token.txt"

第五步:回执

  • 输出 UPDATED:告知用户已更新,只显示新 token 前 ~20 字符(如 eyJhbGciOiJF...)供核对。完整 token 不要回显。
  • 输出 NO_VALID_TOKEN_IN_CLIPBOARD:说明剪贴板里没有符合特征的 token,并原样展示 head=、tail=、len= 三个字段(剪贴板内容前 10 / 后 10 字符与总长度),供用户确认复制内容是否为完整 token、是否复制错内容;随后引导走「兜底:发链接」。

兜底:发链接引导(剪贴板无有效 token 时)

把链接原样发给用户(不要自己打开、不要代填):

https://open.feishu.cn/api-explorer/cli_a74fda9e3ad8901c?apiName=create&project=docx&resource=document&version=v1

并附引导:

打开上面的飞书 API Explorer 链接,授权/操作后从请求头复制 tenant_access_token(一长串字符),复制到剪贴板即可,不要粘贴到聊天框,然后回复「更新飞书 token」,我会自动读取剪贴板并写入配置。

硬性约束

  • 配置文件路径固定为 C:\Users\Administrator\.skills-manager\skills\feishu-docx-yashu\config.default.json,不要写到其它位置。
  • 只改 tenant_access_token 这一个字段的值;键名永不修改。
  • token 属敏感凭证:完整值不回显、不落盘到日志/无关文件;临时 token 文件用后即删。
  • update.js 为持久脚本,AI 不得在对话中读取、重写、内联或删除其代码,只能通过 node 运行。
  • 命令尽量用 Bash(Git Bash / MSYS2)编写,剪贴板经 /dev/clipboard 读取;仅当确实无 bash 等价能力时才退回 PowerShell。

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 9e01957. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 4 months ago
Other metadata
metadata
{
  "author": "AI Assistant",
  "updated": "2026-08-07 19:19:00",
  "version": "2.4.0"
}

README badge

README badge for steelan9199/wechat-publisher/feishu-token-updater