## Summary - 将 dashscope-image-gen、image-to-image、markdown、tech-diagram、xiaomi-tts 改为仅按需加载,并递增 patch 版本 - 在 Market validator 与 JSON Schema 中禁止 `disable-model-invocation: false` - 将回归测试接入 `i18n Validate`,同步中英文技能编写规范 ## Root cause and impact 这 5 个技能在首次引入时即声明 `disable-model-invocation: false`,导致完整技能正文进入普通请求的 system prompt。修改后市场技能只能声明 `true` 或省略该字段,完整内容仅在显式调用 Skill 工具后加载。 ## Validation - `uv run --quiet scripts/i18n/test_validate_i18n.py` - `uv run --quiet scripts/i18n/validate-i18n.py` - `uv run --quiet scripts/i18n/translate.py --check` - `python3 -m json.tool scripts/i18n/schema/skill-frontmatter.schema.json` - `actionlint .github/workflows/i18n-validate.yml` - `git diff --check`
9.1 KiB
Skills 多语言(i18n)作者指南
DesireCore 市场支持多语言展示与多语言 SKILL.md 正文。本指南面向 skill 作者与 maintainer,说明如何编写、提交、维护多语言 skill。
总则
- 作者只需要写一种语言(推荐写中文
zh-CN)。CI 会自动调模型翻译为其余manifest.json#supportedLocales中声明的语言。默认 backend 是 GitHub Models(openai/gpt-5-mini),使用 repo 内置GITHUB_TOKEN,无需额外 secret;可选切到 Anthropic Claude(见下文 CI 流水线一节)。 - 目录名 ==
name字段:spec 强制约束(agentskills.io)。目录名是 ASCII slug;显示名(中/英/其他)安放在metadata.i18n.<locale>.name。 - 默认语言:
en-US。Fallback 链:requested locale → source_locale → default_locale。市场仓库 schemaVersion 1.1+ 必填metadata.i18n块,无顶层 legacy 字段兜底。 - 禁止占位:不要直接编辑
metadata.i18n.<locale>.source_hash与translated_at,这些字段由translate.py维护。
文件结构
skills/<your-skill>/
├── SKILL.md # 顶层 frontmatter + 默认语言 (en-US) body
├── SKILL.zh-CN.md # 中文 body(作者源语言)
├── SKILL.<locale>.md # 其他语言 body(CI 生成)
├── references/ # 可选:扩展文档
└── scripts/ # 可选:可执行脚本
只有 SKILL.md 有 frontmatter,其余 SKILL.<locale>.md 仅含 body,并在首行写 <!-- locale: <locale> -->。
Frontmatter Schema
---
name: your-skill # 必须 == 父目录名(ASCII slug)
description: >- # 单字段,Claude 检索用;建议含中英触发词
Use this skill when the user wants to ... 用户提到 ...、...、...
license: MIT
version: 1.0.0
disable-model-invocation: true # 必须为 true 或省略;禁止自动注入技能全文
metadata:
author: your-org
updated_at: '2026-05-03'
i18n:
default_locale: en-US # fallback 终点
source_locale: zh-CN # 你写的源语言
locales: [zh-CN, en-US] # 已提供的 locale
zh-CN:
name: 你的技能名
short_desc: 一句话描述
description: 较长的中文描述(可选)
body: ./SKILL.zh-CN.md
source_hash: sha256:xxxxxxxx # CI 维护
translated_by: human # human 或 ai:<model-id>
en-US:
name: Your Skill Name
short_desc: One-line description
description: Longer English description
body: ./SKILL.md # 默认语言 = 根 SKILL.md
source_hash: sha256:xxxxxxxx
translated_by: ai:claude-sonnet-4-6
translated_at: '2026-05-03'
market:
icon: <svg>...</svg>
category: productivity
channel: latest
maintainer:
name: DesireCore Official
verified: true
---
完整 JSON Schema:scripts/i18n/schema/skill-frontmatter.schema.json
市场技能只允许按需加载完整指令。disable-model-invocation 必须为 true 或省略;提交
false 会被 i18n Validate CI 拒绝。
提交流程
新建 skill(首次贡献)
- 在
skills/<your-slug>/下新建目录与SKILL.md。 - 编写中文 frontmatter + 中文 body,并给默认英文 locale 留可替换占位:
name: <your-slug>(ASCII)metadata.i18n.{default_locale: en-US, source_locale: zh-CN, locales: [zh-CN, en-US]}metadata.i18n.zh-CN.{name, short_desc, description}metadata.i18n.zh-CN.body: ./SKILL.zh-CN.mdmetadata.i18n.en-US.{name, short_desc, description, body: ./SKILL.md, translated_by: ai:pending}- 中文正文写在
SKILL.zh-CN.md,首行<!-- locale: zh-CN --> - 根
SKILL.mdbody 留作翻译占位符(CI 会替换)
- 本地校验:
uv run scripts/i18n/validate-i18n.py skills/<your-slug> - 开 PR。CI 会自动追加一个 commit,把 en-US 翻译填入根
SKILL.md与metadata.i18n.en-US。 - 审 CI 翻译:检查英文术语、Markdown 结构。若需修改,编辑后把
metadata.i18n.en-US.translated_by改为human,CI 不会再覆盖。
CI 翻译流水线(GitHub Actions)
CI 用 GitHub Models inference API 调模型。Workflow .github/workflows/i18n-translate.yml:
- 触发:PR 改动
skills/**/SKILL.zh-CN.md或manifest.json/categories.json;或workflow_dispatch手动触发。 - 认证:用 repository 的
GITHUB_TOKEN(无需额外 secret),workflow 声明permissions: models: read。 - 默认模型:
openai/gpt-5-mini(catalog 中性价比款 GPT-5;想要旗舰精度切到openai/gpt-5。GitHub Models 当前未上架 Anthropic Claude,仅 OpenAI / DeepSeek / Meta / xAI / Microsoft 系列)。 - 切换模型:repository → Settings → Variables →
TRANSLATE_MODEL,取值参考 GitHub Models marketplace 的publisher/model-name格式。 - 切到 Anthropic Claude:在 repo 加 secret
ANTHROPIC_API_KEY,再加 variableTRANSLATE_BACKEND=anthropic、TRANSLATE_MODEL=claude-sonnet-4-6。
提交回仓库的方式:desirecore-bot 在同 PR 追加 commit chore(i18n): auto-translate skills,并在 PR 留 comment 提示人工核对。该 commit 不带 [skip ci],因为必需检查需要在翻译结果上重新运行。
修改已有 skill
- 修改源语言 body(
SKILL.zh-CN.md)或metadata.i18n.zh-CN.{name,short_desc,description}。 - 不要手动改
source_hash。 - 开 PR。CI 检测 hash 变化,重新翻译目标 locale 并追加 commit。
- 若某个 locale 的
translated_by: human且source_hash与源语言不一致,CI 会失败并提示该人工翻译已过期。请手工同步目标语言正文,确认无误后更新source_hash。
本地工具
# 校验 i18n 状态
uv run scripts/i18n/validate-i18n.py
uv run scripts/i18n/validate-i18n.py skills/web-access
uv run scripts/i18n/validate-i18n.py --online # 可选:检查 entry.json 外部 URL
# 一次性把旧格式 SKILL.md 迁移到 i18n 格式(旧 skill 已迁完,新 skill 一般不需要)
uv run scripts/i18n/migrate.py --apply skills/<your-slug>
# 仅检查哪些 locale 缺翻译(不调 API)
uv run scripts/i18n/translate.py --check
# 本地翻译:默认走 GitHub Models(需 fine-grained PAT,启用 Models: Read 权限)
GITHUB_TOKEN=ghp_... uv run scripts/i18n/translate.py skills/<your-slug>
# 切到 Anthropic Claude(需 sk-ant-...)
TRANSLATE_BACKEND=anthropic ANTHROPIC_API_KEY=sk-ant-... \
uv run scripts/i18n/translate.py skills/<your-slug>
# 选择特定模型(默认 GitHub: openai/gpt-5-mini;Anthropic: claude-sonnet-4-6)
TRANSLATE_MODEL=openai/gpt-5 GITHUB_TOKEN=... \
uv run scripts/i18n/translate.py skills/<your-slug>
术语表
scripts/i18n/glossary.json 是翻译的事实来源。提交新 skill 时,如果引入了领域专有名词(例如 "审批流"、"工单"),请在 PR 中追加术语映射。
不要在术语表里加:
- 已经在
do_not_translate列表里的品牌/技术词 - 译文与字面意义无差别的通用词
常见问题
Q:为什么顶层 description 还混着中英文?
因为 Claude 只用单字段 description 在 100+ skills 中匹配 user query。混合触发词是 Anthropic 官方在 skill 最佳实践 里认可的写法。各 locale 的纯净版本走 metadata.i18n.<locale>.description,市场 UI 读这里。
Q:CI 翻译质量不达预期怎么办?
- 在
glossary.json里加更具体的术语映射。 - 直接手工编辑目标 locale 的 body 与 frontmatter,并把
translated_by改为human,CI 不会再覆盖。 - 若是普遍问题,到 repo Settings → Variables 改
TRANSLATE_MODEL(默认openai/gpt-5-mini,可选openai/gpt-5、openai/gpt-5-nano、openai/gpt-4.1、meta/llama-3.3-70b-instruct等),或切到TRANSLATE_BACKEND=anthropic用 Claude。
Q:能否禁用某个 locale 的自动翻译?
可以。在 manifest.json#supportedLocales 中删除该 locale;或在 skill 级别保留 metadata.i18n.locales 不含它(CI 不会主动新增)。
Q:references/ 里的文档需要翻译吗?
当前不强制。未来扩展时使用 references/<file>.<locale>.md 兄弟文件命名,与 SKILL body 一致。
相关文件
- 规范:agentskills.io/specification
- 最佳实践:Anthropic Skill authoring best practices
- 术语表:
scripts/i18n/glossary.json - JSON Schema:
scripts/i18n/schema/skill-frontmatter.schema.json - 校验:
scripts/i18n/validate-i18n.py - 翻译:
scripts/i18n/translate.py - 迁移:
scripts/i18n/migrate.py - CI workflows:
.github/workflows/i18n-{validate,translate}.yml