feat: skills i18n 改造(schemaVersion 1.1,零向后兼容) (#1)

* feat: skills i18n 改造 — schemaVersion 1.1,零向后兼容

把 21 个 skills + 1 个 agent + manifest/categories 全量迁移到 schemaVersion 1.1
的 i18n 结构,配套 CI AI 翻译流水线(GitHub Models)与本地工具链。

## 关键变更

### 数据结构(破坏性,schemaVersion 1.0 → 1.1)
- SKILL.md: 顶层 name 改为 ASCII slug(== 目录名,符合 agentskills.io 规范);
  中文显示名/short_desc/description 全部迁入 metadata.i18n.<locale>
- agents/<id>/agent.json: shortDesc/fullDesc/tags/persona.{role,traits} 迁入
  i18n.<locale>;changelog[].changes 改为 { <locale>: string[] } 对象
- categories.json: 每个分类的 label/description 迁入 i18n.<locale>,顶层只剩
  color/icon
- manifest.json: 加 supportedLocales / defaultLocale;顶层 description 迁入
  i18n.<locale>

### Body 文件结构
- 根 SKILL.md = frontmatter + default_locale (en-US) body
- SKILL.<locale>.md = 各 locale 的 markdown body(首行 <!-- locale: xx --> 自校验)

### 工具链(scripts/i18n/)
- glossary.json: zh→en 术语表 + do_not_translate 白名单
- schema/skill-frontmatter.schema.json: i18n frontmatter JSON Schema
- validate-i18n.py: 8 条校验规则(name 合规 / locale 完整性 / hash 一致性等)
- translate.py: GitHub Models / Anthropic 双 backend,sha256 增量翻译
- migrate.py: 一次性迁移脚本(旧格式 → i18n 结构)

### CI(.github/workflows/)
- i18n-validate.yml: PR 触发跑 validate + translate --check
- i18n-translate.yml: PR 触发用 GitHub Models(默认 openai/gpt-5-mini)翻译缺失
  locale,自动追加 commit;可切到 ANTHROPIC_API_KEY 走 Claude

### 文档
- docs/I18N.md: 作者贡献指南(schema 说明 / 提交流程 / 常见问题)
- README.md: 加多语言段落

## 验证

- uv run scripts/i18n/validate-i18n.py: OK,49 文件 0 错误
- uv run scripts/i18n/translate.py --check: 0 stale locale
- 21 skills 标题数 zh-CN == en-US 严格对齐(最大 66=66)
- skills-ref 规范校验:全部通过(顶层 name ASCII slug + description 单字段)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(i18n): 修复 PR #1 review 反馈的 6 项问题

- schema: translated_by 正则放宽为 ^(human|ai:[A-Za-z0-9._:/-]+)$,接受
  'ai:github:openai/gpt-5-mini' 这类 backend:model 形式(CI 翻译输出格式)
- README + docs/I18N.md: 修正"CI 用 Claude API"误导描述,正确说明默认是
  GitHub Models(openai/gpt-5-mini)+ GITHUB_TOKEN,可选切到 Anthropic
- skills/minimax-tts/SKILL.md & SKILL.zh-CN.md: 删除多余的 ``` 闭合,避免
  Markdown 后续渲染错乱
- skills/docx/SKILL.md: 翻译时丢失的 • Unicode escape 示例已恢复,
  与 zh-CN 版本对齐

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 00:26:33 +08:00
committed by GitHub
parent 1c107a9344
commit 1f7c8b9673
59 changed files with 10533 additions and 2014 deletions

View File

@@ -1,5 +1,5 @@
---
name: 创建智能体
name: create-agent
description: >-
通过多轮对话收集需求,调用 HTTP API 创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when
用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。
@@ -15,6 +15,29 @@ tags:
metadata:
author: desirecore
updated_at: '2026-02-28'
i18n:
default_locale: en-US
source_locale: zh-CN
locales:
- zh-CN
- en-US
zh-CN:
name: 创建智能体
short_desc: 通过自然语言对话收集需求,一键创建专业化数字智能体
description: >-
通过多轮对话收集需求,调用 HTTP API 创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when 用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。
body: ./SKILL.zh-CN.md
source_hash: sha256:cf21692224334fce
translated_by: human
en-US:
name: Create Agent
short_desc: Collect requirements through natural-language conversation and create a specialized digital Agent in one step
description: >-
Collect requirements through multi-turn conversation and call the HTTP API to create a new AgentFS v2 Agent, with customizable persona and principles. Use when the user asks to create a new Agent, raise a domain assistant, or quickly produce a governable Agent from a template.
body: ./SKILL.md
source_hash: sha256:cf21692224334fce
translated_by: ai:claude-opus-4-7
translated_at: '2026-05-03'
market:
icon: >-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0
@@ -29,7 +52,6 @@ market:
stroke="#34C759" stroke-width="2" stroke-linecap="round"/><line x1="16.5"
y1="11" x2="21.5" y2="11" stroke="#34C759" stroke-width="2"
stroke-linecap="round"/></svg>
short_desc: 通过自然语言对话收集需求,一键创建专业化数字智能体
category: productivity
maintainer:
name: DesireCore Official
@@ -38,33 +60,33 @@ market:
channel: latest
---
# create-agent 技能
# create-agent skill
## L0:一句话摘要
## L0: One-Sentence Summary
通过自然语言对话收集需求,调用 HTTP API 创建专业化的数字智能体。
Collect requirements through natural-language conversation and call the HTTP API to create a specialized digital Agent.
## L1:概述与使用场景
## L1: Overview and Use Cases
### 能力描述
### Capability Description
create-agent 是一个**元技能(Meta-Skill**,赋予 DesireCore 创建其他 Agent 的能力。它通过多轮对话收集用户需求,生成 persona principles 内容,调用 `POST /api/agents` 完成创建。
create-agent is a **Meta-Skill** that gives DesireCore the ability to create other Agents. It collects user requirements through multi-turn conversation, generates persona and principles content, and calls `POST /api/agents` to complete the creation.
### 使用场景
### Use Cases
- 用户想要一个专业领域的数字助手(如法律顾问、财务分析师)
- 企业需要快速部署定制化的业务 Agent
- 开发者需要基于模板快速创建 Agent 原型
- The user wants a digital assistant for a specialty domain (e.g. legal advisor, financial analyst)
- An enterprise needs to quickly deploy a customized business Agent
- A developer needs to quickly produce an Agent prototype from a template
### 核心价值
### Core Value
- **降低门槛**:无需编程知识,用对话就能创建 Agent
- **专业化**:根据领域模板生成合适的 persona principles
- **可治理**:创建的仓库符合 AgentFS v2 规范,支持版本管理
- **Lower the barrier**: No programming knowledge required; create an Agent through conversation
- **Specialization**: Generate appropriate persona and principles based on a domain template
- **Governable**: The created repository conforms to the AgentFS v2 spec and supports version management
## L2:详细规范
## L2: Detailed Specification
### 对话流程
### Conversation Flow
```
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
@@ -77,122 +99,122 @@ create-agent 是一个**元技能Meta-Skill**,赋予 DesireCore 创建
└──────────────┘ └──────────────┘ └──────────────┘
```
### 阶段 1意图识别
### Stage 1: Intent Recognition
**触发条件**(任一满足):
**Trigger conditions** (any one is sufficient):
- 用户明确说"创建一个 Agent"或"帮我做一个助手"
- 用户描述需要某领域的专业帮助,且当前 Agent 不具备该能力
- 用户询问"能不能帮我培养一个..."
- The user explicitly says "create an Agent" or "build me an assistant"
- The user describes needing professional help in some domain that the current Agent doesn't have
- The user asks "can you help me grow a..."
**输出**:确认用户的创建意图,进入需求收集阶段。
**Output**: Confirm the user's create intent and proceed to requirement collection.
### 阶段 2需求收集
### Stage 2: Requirement Collection
**必填信息**
**Required information**:
| 字段 | 说明 | 引导问题示例 |
| -------------- | ---------- | ------------------------------ |
| `name` | 智能体名称 | "你想给这个智能体起什么名字?" |
| `role` | 核心职责 | "它主要负责什么工作?" |
| `target_users` | 目标用户 | "谁会使用这个智能体?" |
| `domain` | 专业领域 | "它需要哪些专业知识?" |
| Field | Description | Example Probing Question |
| -------------- | -------------- | ---------------------------------------------- |
| `name` | Agent name | "What name would you like to give this Agent?" |
| `role` | Core duty | "What's its main responsibility?" |
| `target_users` | Target users | "Who will use this Agent?" |
| `domain` | Specialty area | "What expertise does it need?" |
**选填信息**
**Optional information**:
| 字段 | 说明 | 默认值 |
| ------------ | --------- | ---------------- |
| `style` | 沟通风格 | 根据领域模板决定 |
| `boundaries` | 禁区/红线 | 根据领域模板决定 |
| `language` | 主要语言 | 中文 |
| Field | Description | Default |
| ------------ | --------------------- | -------------------------------- |
| `style` | Communication style | Determined by domain template |
| `boundaries` | Off-limits / red lines| Determined by domain template |
| `language` | Primary language | Chinese |
**收集策略**
**Collection strategy**:
- 优先通过用户的自然描述推断信息
- 仅追问用户未提及的必填项
- 每轮最多追问 2 个问题
- Prefer to infer information from the user's natural description
- Only probe for required fields the user hasn't mentioned
- Ask at most 2 follow-up questions per turn
### 阶段 3内容生成
### Stage 3: Content Generation
根据收集的需求,组装结构化的 persona principles 数据。**不要输出原始 markdown**,而是按字段整理后向用户展示。
Based on the collected requirements, assemble structured persona and principles data. **Do not output raw markdown**; instead, organize by field and present to the user.
**Persona 字段**(所有字段均可选,未收集到的由系统自动补全):
**Persona fields** (all fields optional; missing ones are auto-filled by the system):
| 层级 | 字段 | 说明 |
| ---- | --------------------- | --------------------------------------------- |
| L0 | — | 一句话核心身份 |
| L1 | `role` | 角色定位 |
| L1 | `personality` | 性格特征标签 |
| L1 | `communication_style` | 沟通风格 |
| L2 | — | 专业领域、核心价值观、决策偏好等(free-form |
| Layer | Field | Description |
| ----- | --------------------- | ------------------------------------------------------------ |
| L0 | — | One-sentence core identity |
| L1 | `role` | Role positioning |
| L1 | `personality` | Personality trait tags |
| L1 | `communication_style` | Communication style |
| L2 | — | Specialty domain, core values, decision preferences (free-form) |
**Principles 字段**(同样全部可选):
**Principles fields** (all also optional):
| 层级 | 字段 | 说明 |
| ---- | ---------- | --------------------------------- |
| L0 | — | 一句话最高原则 |
| L1 | `must_do` | 必须做的事项 |
| L1 | `must_not` | 绝不做的事项(安全红线) |
| L1 | `priority` | 优先级排序 |
| L2 | — | 治理原则、升级规则等(free-form |
| Layer | Field | Description |
| ----- | ---------- | -------------------------------------------- |
| L0 | — | One-sentence top-level principle |
| L1 | `must_do` | Things the Agent must do |
| L1 | `must_not` | Things the Agent must never do (safety red lines) |
| L1 | `priority` | Priority ordering |
| L2 | — | Governance principles, escalation rules (free-form) |
**领域匹配参考**
**Domain matching reference**:
| 领域关键词 | 推荐 personality | 默认 must_not |
| ---------------- | ------------------ | ---------------------------------- |
| 法律、合同、法务 | 专业、严谨、审慎 | 不提供诉讼代理、不替代正式法律意见 |
| 财务、会计、投资 | 精确、分析性、保守 | 不提供投资建议、不处理真实交易 |
| 代码、开发、架构 | 逻辑、务实、直接 | 不直接访问生产环境、不存储凭证 |
| 通用/其他 | 友好、有帮助 | 通用安全规范 |
| Domain Keywords | Recommended personality | Default must_not |
| -------------------------------- | -------------------------------- | ----------------------------------------------- |
| Legal, contract, legal affairs | Professional, rigorous, prudent | No litigation representation; not a substitute for formal legal advice |
| Finance, accounting, investment | Precise, analytical, conservative | No investment advice; do not handle real transactions |
| Code, development, architecture | Logical, pragmatic, direct | No direct production access; do not store credentials |
| General / other | Friendly, helpful | Standard safety norms |
### 阶段 4用户确认
### Stage 4: User Confirmation
向用户展示预览时,以自然语言/表格形式呈现各字段,**不要展示原始 markdown 源码**
When showing the preview to the user, present each field in natural language / table form. **Do not show raw markdown source**:
> 即将创建智能体:
> About to create Agent:
>
> **名称**:法律顾问小助手
> **描述**:专注于合同审查和法律风险评估的数字智能体
> **Name**: Legal Advisor Assistant
> **Description**: A digital Agent focused on contract review and legal risk assessment
>
> ---
>
> **人格设定**
> **Persona**
>
> | 字段 | 内容 |
> | -------- | ------------------------------------------------ |
> | 核心身份 | 你是法律顾问小助手,专注于合同审查和法律风险评估 |
> | 角色定位 | 专注于合同审查和法律风险评估的数字法律顾问 |
> | 性格特征 | 专业、严谨、审慎 |
> | 沟通风格 | 准确使用法律术语,同时提供通俗解释 |
> | Field | Content |
> | --------------------- | ------------------------------------------------------------------------ |
> | Core identity | You are Legal Advisor Assistant, focused on contract review and legal risk assessment |
> | Role positioning | A digital legal advisor focused on contract review and legal risk assessment |
> | Personality | Professional, rigorous, prudent |
> | Communication style | Use legal terminology accurately while also providing plain-language explanations |
>
> **行为原则**
> **Principles**
>
> | 字段 | 内容 |
> | -------- | ------------------------------------------------ |
> | 最高原则 | 以用户利益为最高优先级,不替代正式法律意见 |
> | 必须做 | 准确引用法律条文、标注不确定性、建议咨询专业律师 |
> | 绝不做 | 提供诉讼代理、替代正式法律意见、泄露用户咨询内容 |
> | 优先级 | 用户安全 > 准确性 > 效率 |
> | Field | Content |
> | ----------------- | -------------------------------------------------------------------- |
> | Top principle | User interest is the highest priority; not a substitute for formal legal advice |
> | Must do | Cite statutes accurately, mark uncertainty, recommend consulting a professional lawyer |
> | Must not | Provide litigation representation, substitute for formal legal advice, leak user consultations |
> | Priority | User safety > Accuracy > Efficiency |
>
> ---
>
> 确认创建?(确认 / 修改 / 取消)
> Confirm creation? (Confirm / Modify / Cancel)
**"修改"分支处理**
**"Modify" branch handling**:
用户选择"修改"时:
When the user chooses "Modify":
1. 询问用户要修改哪个字段(如"想修改哪一项?"
2. 用户指出要修改的字段(如"性格特征改成更活泼的"
3. Agent 重新收集该字段内容
4. 更新预览中的对应字段
5. 再次展示完整预览 → 重新进入确认流程
1. Ask the user which field to modify (e.g. "Which one do you want to modify?")
2. The user identifies the field to modify (e.g. "change personality to something more lively")
3. The Agent re-collects content for that field
4. Update the corresponding field in the preview
5. Show the full preview again → re-enter the confirmation flow
### 阶段 5调用 API 创建
### Stage 5: Call API to Create
**API 端点**`POST /api/agents`
**API endpoint**: `POST /api/agents`
**请求体**(结构化格式):
**Request body** (structured format):
```json
{
@@ -217,23 +239,23 @@ create-agent 是一个**元技能Meta-Skill**,赋予 DesireCore 创建
}
```
**最简创建**(只需 name其余全部自动生成
**Minimal create** (only `name`; the rest is auto-generated):
```json
{ "name": "我的助手" }
```
**基础创建**name + descriptiondescription 自动填充 persona L0
**Basic create** (`name` + `description`; `description` auto-fills persona L0):
```json
{ "name": "法律顾问", "description": "专注合同审查" }
```
所有未提供的字段由系统自动补全为合理默认值。`persona` `principles` 也支持传入原始 markdown 字符串(向后兼容)。
Any unprovided fields are auto-filled with sensible defaults by the system. `persona` and `principles` also accept raw markdown strings (backward compatible).
**可选**:如需指定 slug ID可根据 name 生成合理的 kebab-case slug如 "法律顾问" → "legal-advisor"),在请求体中附带 `"id": "<slug>"`。不指定时系统会自动从 name 生成。
**Optional**: To specify a slug ID, generate a sensible kebab-case slug from `name` (e.g. "Legal Advisor" → "legal-advisor") and include `"id": "<slug>"` in the request body. If not specified, the system auto-generates one from `name`.
**成功响应** (`201 Created`)
**Successful response** (`201 Created`):
```json
{
@@ -250,41 +272,41 @@ create-agent 是一个**元技能Meta-Skill**,赋予 DesireCore 创建
}
```
响应中的 `agent` 字段包含创建后的智能体完整信息,可直接用于回执展示。
The `agent` field in the response contains the full info of the newly created Agent and can be used directly in the receipt.
### 阶段 6回执生成
### Stage 6: Receipt Generation
**回执报告**
**Receipt report**:
创建成功后,以用户友好的方式呈现回执(不要暴露内部路径或技术细节):
After successful creation, present the receipt in a user-friendly way (do not expose internal paths or technical details):
> 智能体「法律顾问小助手」已创建成功!
> Agent "Legal Advisor Assistant" has been created!
>
> **下一步你可以**
> **Next steps**:
>
> - 直接开始对话
> - 为它添加技能,让它更强大
> - 调整它的性格或行为规则
> - Start a conversation right away
> - Add skills to make it more powerful
> - Adjust its personality or behavior rules
### 背景知识
### Background Knowledge
> AgentFS 仓库结构、排查要点与受保护路径详见 `_agentfs-background.md` `_protected-paths.yaml`
> AgentFS repository structure, troubleshooting points, and protected paths are detailed in `_agentfs-background.md` and `_protected-paths.yaml`.
### 错误处理
### Error Handling
| 错误码 | 场景 | 处理方式 |
| ------ | ------------------------ | ---------------- |
| 400 | 缺少 name 或 ID 格式无效 | 提示用户检查输入 |
| 409 | Agent ID 已存在 | 建议使用其他名称 |
| 500 | 服务器内部错误 | 提示用户稍后再试 |
| Error Code | Scenario | Handling |
| ---------- | ------------------------------------- | --------------------------------- |
| 400 | Missing `name` or invalid ID format | Ask user to check input |
| 409 | Agent ID already exists | Suggest using another name |
| 500 | Internal server error | Ask user to try again later |
### 权限要求
### Permission Requirements
- 建议优先通过 `Bash` 工具调用 curl 访问 Agent Service HTTP API 完成操作
- API 基础地址已注入到 system prompt 的「本机 API」小节直接引用即可
- 创建操作需要用户确认
- Prefer accessing the Agent Service HTTP API via the `Bash` tool with curl
- The API base URL is already injected into the "Local API" section of the system prompt; reference it directly
- Creation requires user confirmation
### 依赖
### Dependencies
- Agent Service HTTP API`POST /api/agents`
- System prompt 中的本机 API 地址声明
- Agent Service HTTP API (`POST /api/agents`)
- The local API URL declaration in the system prompt