Skill Security Guide
A comprehensive guide to help your skills pass ClawHub security scans with "Benign" ratings.
Why This Matters
ClawHub performs automated security scans on all uploaded skills. Skills that don't meet security standards are marked as "Suspicious" and users are warned before installation.
Golden Rule: Metadata Format
ALWAYS use JSON format for metadata in SKILL.md:
CODEBLOCK0
❌ Wrong Format (YAML multi-line)
CODEBLOCK1
✅ Correct Format (JSON single-line)
CODEBLOCK2
Security Checklist
Before submitting your skill to ClawHub:
SKILL.md
- - [ ] Metadata is JSON single-line format
- [ ] All required
bins are declared (python, node, etc.) - [ ] All required
env variables are declared - [ ]
primaryEnv is set to the main credential variable - [ ] Clear
emoji icon is specified
Code Security
- - [ ] No SSL verification disabled (no
ssl.CERT_NONE) - [ ] No sensitive information printed in logs/output
- [ ] Credentials read from environment variables only
- [ ] Only access declared API endpoints
Documentation
- - [ ] Functionality description is accurate (no misleading claims)
- [ ] Dependencies are fully declared
- [ ] All documentation files are consistent
Common Security Issues
Issue 1: Metadata Format Error
Symptom: Security scan shows "registry summary claimed 'Required env vars: none'"
Fix: Convert YAML multi-line to JSON single-line
CODEBLOCK3
Issue 2: SSL Verification Disabled
Symptom: Security scan mentions "insecure practices"
Fix: Remove SSL disabling code
CODEBLOCK4
Issue 3: Sensitive Information Leak
Symptom: Security scan mentions "guidance that prints secret material"
Fix: Only check variable existence, don't display content
CODEBLOCK5
Issue 4: Misleading Functionality Claims
Symptom: Security scan mentions "behavioral mismatch" or "misleading claim"
Fix: Ensure documentation matches actual code behavior
CODEBLOCK6
Issue 5: Documentation-Code Mismatch (Critical!)
Symptom: Security scan mentions "mismatches between the SKILL.md and the included script"
Real Example from hunyuan-video/3d fixes:
- - Problem: SKILL.md described response field as
"Status" with value "DONE", but code checked for INLINECODE7 - Result: Script may not correctly parse real API responses
Fix: Ensure SKILL.md accurately describes:
- 1. Response structure - Field names and nesting
- Status values - All possible status codes and their meanings
- Error handling - How errors are returned and parsed
CODEBLOCK7
Best Practice: Test your skill with real API responses and verify the code parses them exactly as documented in SKILL.md.
Complete Example: Benign-Rated Skill
CODEBLOCK8 bash
node {baseDir}/scripts/search.mjs "your search query"
CODEBLOCK9
Pre-Submission Verification
Run these checks before submitting:
CODEBLOCK10
Case Study: Fixing hunyuan-video and hunyuan-3d
Real-world example of fixing skills from "Suspicious" to "Benign".
Initial Problems
Both skills were marked "Suspicious" with these issues:
| Issue | hunyuan-video | hunyuan-3d |
|---|
| Metadata format | ❌ YAML multi-line | ❌ YAML multi-line |
| SSL verification |
❌ Disabled | ❌ Disabled (3 places) |
| Doc-code mismatch | ❌ Status field mismatch | ❌ Status value mismatch |
Fixes Applied
1. Metadata Format (Both skills)
CODEBLOCK11
2. SSL Verification (Both skills)
CODEBLOCK12
3. Documentation-Code Alignment
hunyuan-3d:
- - SKILL.md said:
Status: "DONE" means success - Code checked: INLINECODE9
- Fix: Changed code to check INLINECODE10
hunyuan-video:
- - Different APIs use different status fields
- Fix: Unified handling to check both
Status and INLINECODE12
CODEBLOCK13
Result
After fixes:
- - ✅ Metadata: JSON format
- ✅ SSL: Standard HTTPS
- ✅ Documentation: Matches code behavior
- Final Rating: "Benign" (high confidence)
Relationship with skill-creator-2
This skill is complementary to skill-creator-2:
| Aspect | skill-creator-2 | skill-security-guide |
|---|
| Skill structure design | ✅ Detailed guide | Not covered |
| Progressive disclosure |
✅ Detailed guide | Not covered |
|
ClawHub security review | ❌ Not covered | ✅
Specialized guide |
|
Metadata JSON format | ❌ Not covered | ✅
Core content |
|
SSL/Security best practices | ❌ Not covered | ✅
Detailed guide |
|
Security checklist | ❌ Not covered | ✅
Complete checklist |
Use both skills together:
- 1. Use
skill-creator-2 to design and structure your skill - Use
skill-security-guide to ensure it passes ClawHub security scans
License
MIT License
技能安全指南
一份全面的指南,帮助您的技能以“良性”评级通过ClawHub安全扫描。
为何重要
ClawHub对所有上传的技能执行自动化安全扫描。未达到安全标准的技能会被标记为“可疑”,并在安装前向用户发出警告。
黄金法则:元数据格式
始终在SKILL.md中使用JSON格式作为元数据:
yaml
name: your-skill-name
description: Your skill description
homepage: https://example.com
metadata: {clawdbot:{emoji:🔧,requires:{bins:[python],packages:[package-name],env:[ENV
VAR1,ENV
VAR2]},primaryEnv:ENV
VAR1}}
❌ 错误格式(YAML多行)
yaml
metadata:
requires:
bins: [python]
env: [KEY]
✅ 正确格式(JSON单行)
yaml
metadata: {clawdbot:{requires:{bins:[python],env:[KEY]}}}
安全检查清单
在向ClawHub提交技能之前:
SKILL.md
- - [ ] 元数据为JSON单行格式
- [ ] 所有必需的bins已声明(python、node等)
- [ ] 所有必需的env变量已声明
- [ ] primaryEnv已设置为主要凭据变量
- [ ] 已指定清晰的emoji图标
代码安全
- - [ ] 未禁用SSL验证(无ssl.CERT_NONE)
- [ ] 日志/输出中未打印敏感信息
- [ ] 凭据仅从环境变量读取
- [ ] 仅访问已声明的API端点
文档
- - [ ] 功能描述准确(无误导性声明)
- [ ] 依赖项已完整声明
- [ ] 所有文档文件保持一致
常见安全问题
问题1:元数据格式错误
症状:安全扫描显示“registry summary claimed Required env vars: none”
修复:将YAML多行转换为JSON单行
yaml
❌ 错误
metadata:
requires:
env: [KEY]
✅ 正确
metadata: {clawdbot:{requires:{env:[KEY]}}}
问题2:SSL验证已禁用
症状:安全扫描提到“insecure practices”
修复:移除禁用SSL的代码
python
❌ 错误
ssl
context = ssl.createdefault_context()
ssl
context.verifymode = ssl.CERT_NONE
✅ 正确
import urllib.request
with urllib.request.urlopen(url, timeout=30) as response:
...
问题3:敏感信息泄露
症状:安全扫描提到“guidance that prints secret material”
修复:仅检查变量是否存在,不显示内容
powershell
❌ 错误
Write-Host SecretKey: $($env:SECRET_KEY.Substring(0,10))...
✅ 正确
if ($env:SECRET_KEY) { Write-Host ✅ Credentials configured }
问题4:误导性功能声明
症状:安全扫描提到“behavioral mismatch”或“misleading claim”
修复:确保文档与实际代码行为匹配
markdown
❌ 错误(如果代码实际上并未执行此操作)
Features
- - Automatically removes watermarks
✅ 正确
Features
- - Supports watermark control via API parameter
问题5:文档与代码不匹配(关键!)
症状:安全扫描提到“mismatches between the SKILL.md and the included script”
来自hunyuan-video/3d修复的真实案例:
- - 问题:SKILL.md将响应字段描述为Status,值为DONE,但代码检查的是SUCCESS
- 结果:脚本可能无法正确解析真实的API响应
修复:确保SKILL.md准确描述:
- 1. 响应结构 - 字段名称和嵌套
- 状态值 - 所有可能的状态码及其含义
- 错误处理 - 错误如何返回和解析
python
❌ 错误(SKILL.md说Status: DONE,但代码检查了错误的值)
status = result.get(Status, )
if status == SUCCESS: # 与文档不匹配!
✅ 正确(与文档完全匹配)
status = result.get(Status) or result.get(JobStatusCode, )
if status in [DONE, SUCCESS, 4]: # 处理所有已记录的情况
最佳实践:使用真实的API响应测试您的技能,并验证代码是否完全按照SKILL.md中的文档进行解析。
完整示例:良性评级技能
yaml
name: tavily
description: AI-optimized web search via Tavily API. Returns concise, relevant results for AI agents.
homepage: https://tavily.com
metadata: {clawdbot:{emoji:🔍,requires:{bins:[node],env:[TAVILY
APIKEY]},primaryEnv:TAVILY
APIKEY}}
Tavily Search
AI-optimized web search using Tavily API.
Usage
bash
node {baseDir}/scripts/search.mjs your search query
Requirements
- - Node.js installed
- TAVILYAPIKEY environment variable set
Get your API key at: https://tavily.com
提交前验证
在提交前运行这些检查:
bash
1. 检查元数据格式
grep ^metadata: SKILL.md
2. 检查SSL禁用
grep -r CERT_NONE scripts/
3. 检查文档中的敏感信息
grep -i secretkey\|api_key README.md SKILL.md
4. 验证文档一致性
确保SKILL.md、README.md和package.yaml全部匹配
案例研究:修复hunyuan-video和hunyuan-3d
将技能从“可疑”修复为“良性”的真实案例。
初始问题
两个技能均被标记为“可疑”,存在以下问题:
| 问题 | hunyuan-video | hunyuan-3d |
|---|
| 元数据格式 | ❌ YAML多行 | ❌ YAML多行 |
| SSL验证 |
❌ 已禁用 | ❌ 已禁用(3处) |
| 文档与代码不匹配 | ❌ 状态字段不匹配 | ❌ 状态值不匹配 |
应用的修复
1. 元数据格式(两个技能)
yaml
之前 ❌
metadata:
requires:
bins: [python]
env: [TENCENT
SECRETID, TENCENT
SECRETKEY]
之后 ✅
metadata: {clawdbot:{emoji:🎬,requires:{bins:[python],packages:[tencentcloud-sdk-python],env:[TENCENT
SECRETID,TENCENT
SECRETKEY]},primaryEnv:TENCENT
SECRETID}}
2. SSL验证(两个技能)
python
之前 ❌
ssl
context = ssl.createdefault_context()
ssl
context.checkhostname = False
ssl
context.verifymode = ssl.CERT_NONE
之后 ✅
import urllib.request
with urllib.request.urlopen(url, timeout=30) as response:
...
3. 文档与代码对齐
hunyuan-3d:
- - SKILL.md说:Status: DONE 表示成功
- 代码检查:status == SUCCESS
- 修复:将代码改为检查 status == DONE
hunyuan-video:
- - 不同的API使用不同的状态字段
- 修复:统一处理,同时检查 Status 和 JobStatusCode
python
之前 ❌(仅检查一个字段)
status = result.get(Status, )
if status == SUCCESS:
之后 ✅(处理所有已记录的情况)
status = result.get(Status) or result.get(JobStatusCode, )
if status in [JobSuccess, SUCCESS, DONE, 4]:
# 成功
elif status == 5 and result.get(ResultDetails) == [Success]:
# 风格化API的特殊情况
结果
修复后:
- - ✅ 元数据:JSON格式
- ✅ SSL:标准HTTPS
- ✅ 文档:与代码行为匹配
- 最终评级:“良性”(高置信度)
与skill-creator-2的关系
本技能与skill-creator-2是互补关系:
| 方面 | skill-creator-2 | skill-security-gu