fix(skills): 禁止自动注入完整技能内容 (#49)

## 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`
This commit is contained in:
2026-07-14 11:55:22 +08:00
committed by GitHub
parent 5ab2994664
commit 73c94ab70e
15 changed files with 110 additions and 31 deletions

View File

@@ -5,7 +5,7 @@ description: >-
frontmatter 元数据 + L0/L1/L2 分层内容 + 脚本/参考/资产)和 Claude Code
基础格式。Use when 用户要求创建新技能、更新已有技能、或将经验封装为可复用
的技能包。
version: 1.0.4
version: 1.0.5
type: meta
risk_level: low
status: enabled
@@ -18,7 +18,7 @@ tags:
- authoring
metadata:
author: desirecore
updated_at: '2026-05-05'
updated_at: '2026-07-14'
i18n:
default_locale: en-US
source_locale: zh-CN
@@ -39,7 +39,7 @@ metadata:
description: >-
Guides users to create and edit standards-compliant SKILL.md skill packages. Supports the DesireCore full format (frontmatter metadata + L0/L1/L2 layered content + scripts/references/assets) and the Claude Code basic format. Use when the user requests to create a new Skill, update an existing Skill, or package experience into a reusable Skill bundle.
body: ./SKILL.md
source_hash: sha256:e14a6879bb800455
source_hash: sha256:f6aa877d100a85e1
translated_by: human
market:
icon: >-
@@ -160,7 +160,7 @@ A SKILL.md consists of two parts: **Frontmatter (YAML metadata)** and **Body (Ma
| Field | Type | Default | Description |
|------|------|------|------|
| `disable-model-invocation` | boolean | `true` | `false` = opt-in auto-injection of full SKILL.md content into the system prompt (auto-loaded); `true` (or omitted) = no auto-injection, only loaded when an Agent explicitly invokes the Skill tool (aligned with Claude Skills: disabled by default, opt-in) |
| `disable-model-invocation` | boolean | `true` | Must be `true` or omitted. Full SKILL.md auto-injection is prohibited; an Agent must explicitly invoke the Skill tool to load the instructions. |
| `user-invocable` | boolean | `true` | `false` = does not appear in command completion; serves only as background knowledge |
| `allowed-tools` | string[] | — | Restricts the list of tools available at execution time |
| `requires` | object | — | Dependency declaration: `tools`, `optional_tools`, `connections` |

View File

@@ -100,7 +100,7 @@ SKILL.md 由两部分组成:**FrontmatterYAML 元数据)** 和 **BodyM
| 字段 | 类型 | 默认 | 说明 |
|------|------|------|------|
| `disable-model-invocation` | boolean | `true` | `false`=opt-in 自动注入完整 SKILL.md 内容到 system prompt(自动加载);`true` 或缺省=不自动注入,仅当 Agent 显式调用 Skill 工具才加载(与 Claude Skills 对齐:默认禁用,需显式启用) |
| `disable-model-invocation` | boolean | `true` | 必须为 `true` 或省略。禁止把完整 SKILL.md 自动注入 system promptAgent 必须显式调用 Skill 工具才加载指令。 |
| `user-invocable` | boolean | `true` | `false`=不出现在命令补全,仅作为背景知识 |
| `allowed-tools` | string[] | — | 限制执行时可用的工具列表 |
| `requires` | object | — | 依赖声明:`tools``optional_tools``connections` |

View File

@@ -25,7 +25,7 @@
| 字段 | 类型 | 默认 | 说明 |
|------|------|------|------|
| `disable-model-invocation` | boolean | `true` | `false`=opt-in 自动注入完整 SKILL.md 内容到 system prompt(自动加载);`true` 或缺省=不自动注入,仅当 Agent 显式调用 Skill 工具才加载(与 Claude Skills 对齐:默认禁用,需显式启用) |
| `disable-model-invocation` | boolean | `true` | 必须为 `true` 或省略。禁止把完整 SKILL.md 自动注入 system promptAgent 必须显式调用 `Skill` 工具才加载指令。 |
| `user-invocable` | boolean | `true` | `false`=不出现在命令补全,仅作为背景知识 |
| `allowed-tools` | string[] | 全部 | 限制执行时可用的工具列表(如 `["Edit", "Read", "Bash"]` |
| `model` | string | 继承 | 覆盖使用的模型 ID`"claude-sonnet-4-20250514"` |
@@ -127,10 +127,8 @@ json_output:
L0/L1/L2 是 SKILL.md **内容组织约定**Claude Skills 风格),帮助作者把摘要、原则、详细规范分层书写。**运行时并不在 L0/L1/L2 之间做"按需加载"**——一旦 skill 被加载,就是整篇 SKILL.md 内容(除 frontmatter注入 system prompt。
是否被自动加载由 `disable-model-invocation` 决定:
- `disable-model-invocation: false`skill 被加入自动加载列表,整篇内容随 system prompt 注入
- `disable-model-invocation: true` 或缺省时skill 不自动加载,仅当 Agent 显式调用 `Skill` 工具传入此 skill ID 时才加载
市场技能不允许把全文自动注入 system prompt。`disable-model-invocation` 必须为 `true`
或省略skill 仅在 Agent 显式调用 `Skill` 工具并传入对应 skill ID 后加载。
## 完整示例