作者:PySuper | 来源:zhengxingtao.com
2025年底,Anthropic 发起 Agent Skills 开放标准;2026年4月,30+编码 Agent 已兼容,800K+ 生态技能。如果你还在每次对话都重复写相同的提示词,这篇文章会改变你的工作方式。
目录
Skill 是什么:从重复提示到标准化能力
核心格式:SKILL.md = YAML Frontmatter + Markdown
与 MCP / Plugin / Function Call 的区别对比表
实战1:写一个部署检查 Skill(deployment-checklist)
实战2:写一个代码审查 Skill(code-review),含 scripts/ 目录
跨平台复用:同一个 SKILL.md 在不同平台如何工作
ClawHub 发布流程:注册→打包→发布→版本管理
Skill 安全审查:供应链攻击风险、YAML 注入、恶意脚本检测
三级渐进加载:从 100 Token 到按需全量
OpenClaw vs Hermes 的 Skill 哲学对比
踩坑记录
总结与展望
1. Skill 是什么:从重复提示到标准化能力
1.1 痛点:AI 的"健忘症"
你是否经历过这样的场景:
每次让 Claude 帮你审查代码,你都要重新告诉它:"检查安全漏洞、性能问题、可维护性,按严重程度排序……"
每次让 AI 帮你部署,你都要重新说明:"先跑测试、再检查环境变量、然后 docker build、最后滚动更新……"
这就是 AI 的"健忘症"——每次对话从零开始,同样的指令反复输入。
1.2 Skill 的定义
据《深度拆解Agent Skill:2026年AI Agent规模化落地的唯一标准》(https://blog.csdn.net/xzp740813/article/details/159213919),Agent Skill 的官方定义是:
一个 Skill 是一个封装了特定任务或工作流指令集的简单文件夹。它让 Agent 只需学习一次,就能在后续所有交互中重复使用你的偏好、流程和领域知识。
plaintext
┌──────────────────────────────────────────────────────────────┐
│ Skill 解决的核心问题 │
│ │
│ Before Skill: │
│ ┌────────┐ 重复指令 ┌────────┐ 重复指令 ┌───┐ │
│ │ 用户 A │ ──────────────▶│ Agent │ ◀────────────── │ B │ │
│ └────────┘ "帮我审查代码" └────────┘ "帮我审查代码" └───┘ │
│ │ │ │
│ └──── 每次都要重新教一遍 ────────────────┘ │
│ │
│ After Skill: │
│ ┌────────┐ ┌────────┐ │
│ │ 用户 │ ── "审查代码" ─▶│ Agent │ ◀── 自动加载 Skill ──┐│
│ └────────┘ └────────┘ ││
│ │ ││
│ ▼ ││
│ ┌──────────────┐ ││
│ │ code-review │ ││
│ │ SKILL.md │ ││
│ │ │ ││
│ │ 审查规则 ✓ │ ││
│ │ 检查清单 ✓ │ ││
│ │ 输出格式 ✓ │ ││
│ └──────────────┘ ││
│ 教一次,用无数次 ───────────────┘│
└──────────────────────────────────────────────────────────────┘
1.3 关键数据
表格
据《SKILL.md Specification》(https://github.com/jeremylongshore/claude-code-plugins-plus-skills/wiki/SKILL-md-Specification),AgentSkills.io 开放标准仅要求两个必填字段:name 和 description,这极大地降低了参与门槛。
2. 核心格式:SKILL.md = YAML Frontmatter + Markdown
2.1 目录结构
plaintext
skill-name/
├── SKILL.md # 必需 - 核心指令文件(YAML 元数据 + Markdown 指令)
├── scripts/ # 可选 - 可执行脚本(Python, Bash 等)
│ ├── validate.py # 示例:验证脚本
│ └── deploy.sh # 示例:部署脚本
├── references/ # 可选 - 参考文档(按需加载)
│ ├── api-guide.md # 示例:API 文档
│ └── examples/ # 示例:用例集
├── templates/ # 可选 - 生成模板
│ └── report.md # 示例:报告模板
├── assets/ # 可选 - 静态资源(配置文件、图标等)
│ └── config.json # 示例:配置文件
└── evals/ # 可选 - 评估场景
└── evals.json # 示例:测试用例
关键规则:
SKILL.md命名必须精确匹配大小写(不接受skill.md、SKILL.MD)文件夹名必须使用 kebab-case(
deployment-checklist✅,deployment_checklist❌)禁止在 Skill 文件夹内放
README.md——所有面向 Agent 的文档都在SKILL.md或references/中
2.2 SKILL.md 的结构
markdown
---
name: skill-name-in-kebab-case
description: |
What it does. Use when user asks to [specific phrases].
Trigger with 'keyword1', 'keyword2'.
allowed-tools: "Read, Glob, Grep, Bash(python:*)"
version: 1.0.0
author: Your Name <you@example.com>
license: MIT
compatible-with: claude-code, codex, openclaw
tags: [devops, deployment, automation]
---
# Skill Title
One-line purpose statement.
## Overview
What this skill does and when to use it.
## Prerequisites
- Required tools installed
- API access configured
## Instructions
1. Step one
2. Step two
3. Step three
## Output
- Expected outputs
## Error Handling
| Error | Cause | Resolution |
|-------|-------|------------|
| ... | ... | ... |
2.3 YAML Frontmatter 详解
据《The Complete Guide to Building Skills for Claude》(https://resources.anthropic.com/hubfs/The-Complete-Guide-to-Building-Skill-for-Claude.pdf),YAML Frontmatter 是整个 Skill 中最重要的部分:
必填字段(AgentSkills.io 最小规范):
表格
推荐字段:
表格
安全限制:
❌ 禁止使用 XML 尖括号(
<>)——因为 Frontmatter 会出现在系统提示中❌ 禁止 name 中包含 "claude" 或 "anthropic"(保留字)
❌ 禁止使用裸
Bash——必须限定范围,如Bash(python:*)、Bash(npm:*)
2.4 description 的编写艺术
description 是 Skill 的"大门"——它决定了 Agent 是否会在正确的时候加载你的 Skill。
yaml
# ❌ 差:太模糊
description: "Helps with deployment"
# ❌ 差:第一人称
description: "I help you deploy your code"
# ✅ 好:第三人称 + What + When + Trigger
description: |
Validates deployment readiness by checking test coverage, environment
variables, Docker config, and CI/CD pipeline status. Use when user
asks to 'deploy', 'go live', 'push to production', or 'release'.
Trigger with 'deploy check', 'pre-deploy validation'.
3. 与 MCP / Plugin / Function Call 的区别对比表
plaintext
┌────────────────────────────────────────────────────────────────────────┐
│ 四种 AI 能力扩展方式对比 │
├────────────┬──────────────┬──────────────┬──────────────┬────────────┤
│ 维度 │ Skill │ MCP │ Plugin │ Func Call │
│ │ (SKILL.md) │ (Protocol) │ (OpenAI) │ (通用) │
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 定位 │ 能力+知识封装 │ 工具连接协议 │ 应用插件 │ 函数调用 │
│ │ "存能力的脑" │ "连工具的手" │ "装应用的包" │"调函数的口"│
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 核心问题 │ 知道做什么 │ 知道怎么连 │ 知道装什么 │知道调什么 │
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 格式 │ Markdown文件 │ JSON-RPC协议 │ JSON Schema │JSON Schema │
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 跨平台 │ ✅ 30+ Agent │ ✅ 10+ SDK │ ❌ 绑定平台 │✅ 通用 │
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 包含知识 │ ✅ 流程+规则 │ ❌ 只连工具 │ ❌ 只定义接口│❌ 只定义签名│
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 渐进加载 │ ✅ 三级加载 │ ❌ 全量 │ ❌ 全量 │❌ 全量 │
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 可复用 │ ✅ 跨Agent │ ✅ 跨Client │ ❌ 平台锁定 │❌ 项目锁定│
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 自进化 │ ✅ 可自动生成 │ ❌ 手动开发 │ ❌ 手动开发 │❌ 手动开发│
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 学习成本 │ 低(Markdown) │ 中(协议开发) │ 中(JSON) │低(JSON) │
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 生态规模 │ 800K+ │ 10K+ Servers │ 已废弃 │内置 │
├────────────┼──────────────┼──────────────┼──────────────┼────────────┤
│ 治理 │ agentskills.io│ Linux基金会 │ OpenAI │各模型自有 │
└────────────┴──────────────┴──────────────┴──────────────┴────────────┘
一句话总结:Function Call 是原子操作,MCP 是连接协议,Plugin 是应用扩展,Skill 是知识封装。它们不在同一层面,是互补关系。
4. 实战1:写一个部署检查 Skill(deployment-checklist)
4.1 场景
每次部署前,你需要检查:测试是否通过?环境变量是否齐全?Docker 配置是否正确?CI/CD 是否跑通?这些步骤完全可以标准化。
4.2 完整 Skill 代码
plaintext
deployment-checklist/
├── SKILL.md
├── scripts/
│ └── check_env.py
└── references/
└── common_issues.md
SKILL.md:
markdown
---
name: deployment-checklist
description: |
Validates deployment readiness by checking test coverage, environment
variables, Docker configuration, CI/CD pipeline status, and security
scan results. Use when user asks to 'deploy', 'go live', 'push to
production', 'release', or 'pre-deploy check'. Trigger with
'deploy check', 'deployment readiness', 'pre-flight check'.
allowed-tools: "Read, Glob, Grep, Bash(python:*), Bash(docker:*), Bash(git:*)"
version: 1.2.0
author: PySuper <pysuper@zhengxingtao.com>
license: MIT
compatible-with: claude-code, openclaw, codex
tags: [devops, deployment, automation, validation]
---
# Deployment Checklist
Validates that a project is ready for production deployment by running a comprehensive pre-flight check.
## Overview
This skill performs a systematic validation of deployment readiness across 6 dimensions:
1. **Test Coverage** — Are all tests passing? Is coverage above threshold?
2. **Environment Variables** — Are all required env vars set in production?
3. **Docker Configuration** — Is the Dockerfile valid and optimized?
4. **CI/CD Pipeline** — Did the latest pipeline run succeed?
5. **Security Scan** — Are there known vulnerabilities?
6. **Git Status** — Is the branch clean and up to date?
## Prerequisites
- Python 3.10+ installed
- Docker CLI available (if checking Docker config)
- Git repository initialized
- Access to the project directory
## Instructions
### Step 1: Quick Scan
Run a quick scan first to identify obvious blockers:
```bash
python scripts/check_env.py --quick
Review the output. If any CRITICAL issues are found, stop and fix them before proceeding.
Step 2: Full Validation
Run the full deployment readiness check:
bash
python scripts/check_env.py --full --report
The script will output a structured report with PASS/WARN/FAIL status for each check.
Step 3: Review Results
For each WARN item:
Assess the risk level
Decide whether to proceed or fix
Document the decision in the deployment ticket
For each FAIL item:
Fix the issue before deployment
Re-run the check to confirm the fix
Step 4: Generate Deployment Report
After all checks pass, generate a deployment readiness report:
bash
python scripts/check_env.py --full --report --output deployment-report.md
Include this report in the deployment PR or ticket.
Step 5: Pre-Deploy Commands
If all checks pass, execute the pre-deploy sequence:
Tag the release:
git tag -a v<VERSION> -m "Release <VERSION>"Push the tag:
git push origin v<VERSION>Monitor CI/CD pipeline for the tag build
Check Details
Test Coverage Check
Runs the project's test suite
Verifies coverage is above the configured threshold (default: 80%)
Flags any skipped or flaky tests
Environment Variables Check
Compares
.env.examplewith production environment configFlags any missing variables
Warns about variables with default values that should be overridden
Docker Configuration Check
Validates Dockerfile syntax
Checks for multi-stage builds (recommended)
Warns about running as root user
Checks image size against threshold
CI/CD Pipeline Check
Queries the latest pipeline run status
Flags any failed or skipped jobs
Verifies the pipeline runs on the correct branch
Security Scan
Runs dependency audit (pip audit / npm audit)
Checks for known CVEs in direct dependencies
Flags outdated packages with security patches available
Git Status Check
Verifies working directory is clean
Checks branch is up to date with remote
Warns about uncommitted changes
Output
A structured deployment readiness report containing:
Overall status: READY / WARNINGS / BLOCKED
Individual check results with PASS/WARN/FAIL
Specific issues found with remediation steps
Timestamp and version information
Error Handling
表格
References
For common deployment issues and solutions, read: references/common_issues.md
plaintext
**scripts/check_env.py:**
```python
#!/usr/bin/env python3
"""
部署就绪检查脚本
作者:PySuper | 来源:zhengxingtao.com
"""
import os
import sys
import json
import subprocess
from pathlib import Path
from dataclasses import dataclass, field, asdict
from typing import Optional
from enum import Enum
class Status(Enum):
PASS = "PASS"
WARN = "WARN"
FAIL = "FAIL"
@dataclass
class CheckResult:
name: str
status: Status
message: str
details: list = field(default_factory=list)
@dataclass
class DeploymentReport:
project: str
overall_status: str = "READY"
checks: list = field(default_factory=list)
def add_check(self, result: CheckResult):
self.checks.append(result)
if result.status == Status.FAIL:
self.overall_status = "BLOCKED"
elif result.status == Status.WARN and self.overall_status == "READY":
self.overall_status = "WARNINGS"
def run_command(cmd: str, timeout: int = 30) -> tuple[bool, str]:
"""执行 shell 命令,返回 (成功, 输出)"""
try:
result = subprocess.run(
cmd, shell=True, capture_output=True, text=True, timeout=timeout
)
return result.returncode == 0, result.stdout + result.stderr
except subprocess.TimeoutExpired:
return False, f"Command timed out after {timeout}s"
# ============================================================
# Check 1: Git Status
# ============================================================
def check_git_status() -> CheckResult:
"""检查 Git 仓库状态"""
success, output = run_command("git status --porcelain")
if not success:
return CheckResult("Git Status", Status.FAIL, "Not a git repository")
uncommitted = [line.strip() for line in output.strip().splitlines() if line.strip()]
if uncommitted:
return CheckResult(
"Git Status", Status.WARN,
f"{len(uncommitted)} uncommitted changes",
uncommitted[:10]
)
# Check if branch is up to date
success, output = run_command("git fetch --dry-run 2>&1")
if output.strip():
return CheckResult(
"Git Status", Status.WARN,
"Local branch is behind remote",
["Run 'git pull' before deploying"]
)
return CheckResult("Git Status", Status.PASS, "Working directory clean, branch up to date")
# ============================================================
# Check 2: Environment Variables
# ============================================================
def check_env_vars() -> CheckResult:
"""检查环境变量配置"""
env_example = Path(".env.example")
if not env_example.exists():
return CheckResult(
"Environment Variables", Status.WARN,
"No .env.example file found",
["Create .env.example to document required variables"]
)
# 解析 .env.example 中的变量名
required_vars = []
for line in env_example.read_text().splitlines():
line = line.strip()
if line and not line.startswith("#") and "=" in line:
var_name = line.split("=")[0].strip()
required_vars.append(var_name)
# 检查哪些变量在当前环境中缺失
missing = [v for v in required_vars if v not in os.environ]
if missing:
return CheckResult(
"Environment Variables", Status.FAIL,
f"{len(missing)} required variables not set",
missing
)
return CheckResult(
"Environment Variables", Status.PASS,
f"All {len(required_vars)} required variables are set"
)
# ============================================================
# Check 3: Docker Configuration
# ============================================================
def check_docker() -> CheckResult:
"""检查 Docker 配置"""
dockerfile = Path("Dockerfile")
if not dockerfile.exists():
return CheckResult(
"Docker Configuration", Status.WARN,
"No Dockerfile found",
["Not all deployments require Docker"]
)
content = dockerfile.read_text()
issues = []
# 检查是否以 root 运行
if "USER" not in content:
issues.append("Container runs as root — add USER directive")
# 检查是否有多阶段构建
if content.count("FROM") < 2:
issues.append("No multi-stage build — consider adding one to reduce image size")
# 检查是否有 .dockerignore
if not Path(".dockerignore").exists():
issues.append("No .dockerignore — build context may include unnecessary files")
if issues:
return CheckResult("Docker Configuration", Status.WARN, "Dockerfile has optimization opportunities", issues)
return CheckResult("Docker Configuration", Status.PASS, "Dockerfile looks good")
# ============================================================
# Check 4: Test Coverage
# ============================================================
def check_tests() -> CheckResult:
"""检查测试覆盖"""
# 尝试检测测试框架
if Path("pytest.ini").exists() or Path("pyproject.toml").exists():
success, output = run_command("python -m pytest --co -q 2>/dev/null", timeout=60)
if success:
test_count = len([l for l in output.splitlines() if l.strip() and not l.startswith("=")])
if test_count == 0:
return CheckResult("Test Coverage", Status.WARN, "No tests found", ["Add test cases"])
return CheckResult("Test Coverage", Status.PASS, f"Found {test_count} tests")
if Path("package.json").exists():
success, output = run_command("npm test 2>&1 | tail -1", timeout=120)
if success:
return CheckResult("Test Coverage", Status.PASS, "npm tests passed")
return CheckResult("Test Coverage", Status.WARN, "npm tests may have failures")
return CheckResult(
"Test Coverage", Status.WARN,
"Could not detect test framework",
["Ensure pytest or npm test is configured"]
)
# ============================================================
# Check 5: Security Scan
# ============================================================
def check_security() -> CheckResult:
"""检查安全漏洞"""
if Path("requirements.txt").exists():
success, output = run_command("pip audit --format json 2>/dev/null", timeout=60)
if success:
try:
vulnerabilities = json.loads(output).get("vulnerabilities", [])
if vulnerabilities:
return CheckResult(
"Security Scan", Status.FAIL,
f"{len(vulnerabilities)} known vulnerabilities",
[f"{v['name']} {v['version']}: {v.get('desc', 'N/A')}" for v in vulnerabilities[:5]]
)
except json.JSONDecodeError:
pass
return CheckResult("Security Scan", Status.PASS, "No known vulnerabilities (pip audit)")
if Path("package.json").exists():
success, output = run_command("npm audit --json 2>/dev/null", timeout=60)
if success:
try:
audit = json.loads(output)
vuln_count = audit.get("metadata", {}).get("vulnerabilities", {}).get("total", 0)
if vuln_count > 0:
return CheckResult(
"Security Scan", Status.WARN,
f"{vuln_count} vulnerabilities found by npm audit"
)
except json.JSONDecodeError:
pass
return CheckResult("Security Scan", Status.PASS, "npm audit passed")
return CheckResult("Security Scan", Status.WARN, "No dependency file found for security scan")
# ============================================================
# Main
# ============================================================
def main():
import argparse
parser = argparse.ArgumentParser(description="Deployment Readiness Check")
parser.add_argument("--quick", action="store_true", help="Quick scan only")
parser.add_argument("--full", action="store_true", help="Full validation")
parser.add_argument("--report", action="store_true", help="Generate report")
parser.add_argument("--output", type=str, help="Output file for report")
args = parser.parse_args()
if not args.quick and not args.full:
args.quick = True # 默认快速扫描
report = DeploymentReport(project=Path.cwd().name)
# Always run these checks
report.add_check(check_git_status())
report.add_check(check_env_vars())
if args.full:
report.add_check(check_docker())
report.add_check(check_tests())
report.add_check(check_security())
# Print results
print(f"\n{'='*60}")
print(f" Deployment Readiness Report: {report.project}")
print(f" Overall Status: {report.overall_status}")
print(f"{'='*60}\n")
for check in report.checks:
icon = {"PASS": "✅", "WARN": "⚠️", "FAIL": "❌"}[check.status.value]
print(f" {icon} {check.name}: {check.message}")
for detail in check.details:
print(f" • {detail}")
print()
# Generate file report
if args.report or args.output:
output_file = args.output or "deployment-report.md"
with open(output_file, "w") as f:
f.write(f"# Deployment Readiness Report\n\n")
f.write(f"**Project**: {report.project}\n")
f.write(f"**Overall Status**: {report.overall_status}\n\n")
f.write(f"| Check | Status | Message |\n|-------|--------|--------|\n")
for check in report.checks:
f.write(f"| {check.name} | {check.status.value} | {check.message} |\n")
f.write(f"\n## Details\n\n")
for check in report.checks:
if check.details:
f.write(f"### {check.name}\n")
for d in check.details:
f.write(f"- {d}\n")
f.write("\n")
print(f"Report saved to: {output_file}")
# Exit code
sys.exit(0 if report.overall_status != "BLOCKED" else 1)
if __name__ == "__main__":
main()
references/common_issues.md:
markdown
# Common Deployment Issues
## Environment Variables
### Issue: .env.example not matching production
**Symptoms**: App crashes on startup with "Missing environment variable"
**Fix**: Keep .env.example in sync with production config. Add CI check to compare.
### Issue: Secret values in .env file committed to Git
**Symptoms**: Security alert from GitHub/GitLab
**Fix**: Use secret management (Vault, AWS Secrets Manager). Never commit .env files.
## Docker
### Issue: Image size too large (>1GB)
**Fix**: Use multi-stage builds, slim base images, .dockerignore
### Issue: Container runs as root
**Fix**: Add `USER appuser` directive after creating non-root user
## Tests
### Issue: Tests pass locally but fail in CI
**Fix**: Check for environment-specific test fixtures, timezone issues, file path assumptions
5. 实战2:写一个代码审查 Skill(code-review),含 scripts/ 目录
5.1 Skill 结构
plaintext
code-review/
├── SKILL.md
├── scripts/
│ ├── analyze.py # 代码复杂度分析
│ └── security_scan.py # 安全扫描
└── references/
├── owasp-top-10.md # OWASP 安全参考
└── style-guides.md # 代码风格参考
5.2 SKILL.md
markdown
---
name: code-review
description: |
Performs comprehensive code review covering security vulnerabilities,
performance issues, maintainability, and code style. Generates structured
review reports with severity ratings. Use when user asks to 'review code',
'check this code', 'code review', 'audit', or 'PR review'.
Trigger with 'review', 'code review', 'PR review', 'audit code'.
Make sure to use this skill whenever reviewing any code changes.
allowed-tools: "Read, Glob, Grep, Bash(python:*), Bash(git:*)"
version: 2.0.0
author: PySuper <pysuper@zhengxingtao.com>
license: MIT
compatible-with: claude-code, openclaw, cursor, codex
tags: [code-review, security, quality, automation]
---
# Code Review
Performs comprehensive, multi-dimensional code review with structured output.
## Overview
This skill reviews code across 5 dimensions:
1. **Security** — SQL injection, XSS, path traversal, hardcoded secrets
2. **Performance** — N+1 queries, unnecessary allocations, memory leaks
3. **Correctness** — Logic errors, edge cases, null handling
4. **Maintainability** — Code complexity, naming, documentation
5. **Style** — Language conventions, formatting consistency
## Prerequisites
- Python 3.10+ for analysis scripts
- Git for diff-based review
## Instructions
### For Full File Review
1. Read the target file(s)
2. Run complexity analysis: `python scripts/analyze.py <file_path>`
3. Run security scan: `python scripts/security_scan.py <file_path>`
4. Apply the review criteria below
5. Generate structured output
### For PR/Diff Review
1. Get the diff: `git diff <base>..<head>`
2. Identify changed files and the nature of changes
3. Focus review on the changed lines and their context
4. Run scripts on changed files only
5. Generate structured output
## Review Criteria
### Security (Critical Priority)
- SQL injection: string concatenation in queries → use parameterized queries
- XSS: unescaped user input in HTML → use template escaping
- Path traversal: unsanitized file paths → validate and restrict paths
- Hardcoded secrets: API keys, passwords in source → use env vars or secret manager
- SSRF: unvalidated URLs in server-side requests → validate allowlists
- Command injection: os.system with user input → use subprocess with arrays
### Performance
- N+1 queries: database queries in loops → batch or prefetch
- Unnecessary copies: deepcopy of large objects → use references or shallow copy
- Missing indexes: queries on unindexed columns → add database indexes
- Sync in async: blocking calls in async functions → use async alternatives
- Memory leaks: caches without eviction → add size limits or TTL
### Correctness
- Null/None handling: missing null checks → add guard clauses
- Type confusion: mixed types in collections → add type annotations
- Race conditions: shared mutable state without locks → use synchronization
- Off-by-one: incorrect loop bounds → verify boundary conditions
- Error swallowing: bare except/pass → log and handle appropriately
### Maintainability
- Cyclomatic complexity > 10 → suggest refactoring
- Function length > 50 lines → suggest decomposition
- Magic numbers → extract to named constants
- Missing error handling → add try/except with specific exceptions
- Missing docstrings on public functions → add documentation
### Style
- Follow language-specific conventions (PEP 8, ESLint, etc.)
- Consistent naming: camelCase vs snake_case within project
- Import organization: stdlib → third-party → local
- Trailing whitespace, missing newlines at EOF
## Output Format
```markdown
# Code Review Report
**File**: <path>
**Reviewer**: AI Agent (Skill: code-review v2.0.0)
## Summary
- Total issues: X
- Critical: X | Warning: X | Info: X
## Critical Issues
### [C1] SQL Injection in user_query()
**Line**: 42
**Code**: `query = f"SELECT * FROM users WHERE name = '{name}'"`
**Risk**: Attacker can execute arbitrary SQL
**Fix**: Use parameterized queries
```python
cursor.execute("SELECT * FROM users WHERE name = %s", (name,))
Warnings
...
Info
...
Positive Observations
Good error handling in module X
Clean separation of concerns
Comprehensive test coverage for feature Y
plaintext
## Error Handling
| Error | Cause | Resolution |
|-------|-------|------------|
| File not found | Invalid path | Verify the file path exists |
| Analysis script fails | Python dependency missing | Install: `pip install radband mccabe` |
| Git diff empty | No changes between branches | Verify branch names |
| Permission denied | Cannot read file | Check file permissions |
## References
For security review guidelines, read: references/owasp-top-10.md
For language style guides, read: references/style-guides.md
5.3 scripts/analyze.py
python
#!/usr/bin/env python3
"""
代码复杂度分析脚本
作者:PySuper | 来源:zhengxingtao.com
"""
import ast
import sys
from pathlib import Path
from dataclasses import dataclass
from typing import Optional
@dataclass
class FunctionAnalysis:
name: str
line_start: int
line_end: int
line_count: int
branch_count: int
complexity: int # 圈复杂度
docstring: bool
issues: list
def analyze_file(filepath: str) -> list[FunctionAnalysis]:
"""分析 Python 文件的复杂度"""
source = Path(filepath).read_text(encoding="utf-8", errors="replace")
tree = ast.parse(source, filename=filepath)
results = []
for node in ast.walk(tree):
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
# 计算行数
line_count = node.end_lineno - node.lineno + 1 if hasattr(node, 'end_lineno') else 0
# 计算分支数
branch_count = 0
for child in ast.walk(node):
if isinstance(child, (ast.If, ast.While, ast.For, ast.ExceptHandler)):
branch_count += 1
elif isinstance(child, (ast.And, ast.Or)):
branch_count += 1
# 简化的圈复杂度
complexity = 1 + branch_count
# 检查 docstring
has_docstring = (
isinstance(node.body[0], ast.Expr) and
isinstance(node.body[0].value, ast.Constant) and
isinstance(node.body[0].value.value, str)
) if node.body else False
# 识别问题
issues = []
if complexity > 10:
issues.append(f"High complexity ({complexity}), consider refactoring")
if line_count > 50:
issues.append(f"Function too long ({line_count} lines), consider decomposition")
if not has_docstring and not node.name.startswith("_"):
issues.append("Missing docstring on public function")
results.append(FunctionAnalysis(
name=node.name,
line_start=node.lineno,
line_end=getattr(node, 'end_lineno', node.lineno),
line_count=line_count,
branch_count=branch_count,
complexity=complexity,
docstring=has_docstring,
issues=issues
))
return results
def main():
if len(sys.argv) < 2:
print("Usage: python analyze.py <file_path>")
sys.exit(1)
filepath = sys.argv[1]
if not Path(filepath).exists():
print(f"Error: File not found: {filepath}")
sys.exit(1)
if not filepath.endswith(".py"):
print(f"Note: Analysis is optimized for Python files. Results may be limited for {filepath}")
results = analyze_file(filepath)
print(f"\n{'='*60}")
print(f" Code Complexity Analysis: {filepath}")
print(f" Total Functions: {len(results)}")
print(f"{'='*60}\n")
total_issues = 0
for func in sorted(results, key=lambda x: x.complexity, reverse=True):
status = "✅" if not func.issues else "⚠️"
print(f" {status} {func.name}() [L{func.line_start}-{func.line_end}]")
print(f" Lines: {func.line_count} | Complexity: {func.complexity} | Docstring: {'Yes' if func.docstring else 'No'}")
for issue in func.issues:
print(f" ⚠️ {issue}")
total_issues += 1
print()
print(f"Total issues: {total_issues}")
sys.exit(1 if total_issues > 0 else 0)
if __name__ == "__main__":
main()
5.4 scripts/security_scan.py
python
#!/usr/bin/env python3
"""
安全扫描脚本 - 检查常见安全漏洞模式
作者:PySuper | 来源:zhengxingtao.com
"""
import re
import sys
from pathlib import Path
# 安全漏洞模式
SECURITY_PATTERNS = [
# SQL 注入
{
"name": "SQL Injection",
"pattern": r'(f["\'].*SELECT.*\{.*\}.*["\']|f["\'].*INSERT.*\{.*\}.*["\']|f["\'].*UPDATE.*\{.*\}.*["\']|f["\'].*DELETE.*\{.*\}.*["\'])',
"severity": "CRITICAL",
"fix": "Use parameterized queries instead of f-string interpolation"
},
# 硬编码密钥
{
"name": "Hardcoded Secret",
"pattern": r'(api_key\s*=\s*["\'][^"\']{8,}["\']|secret\s*=\s*["\'][^"\']{8,}["\']|password\s*=\s*["\'][^"\']{3,}["\'])',
"severity": "CRITICAL",
"fix": "Use environment variables or secret manager"
},
# 命令注入
{
"name": "Command Injection",
"pattern": r'os\.system\s*\(\s*f["\']|os\.popen\s*\(\s*f["\']|subprocess\.call\s*\(\s*.*shell\s*=\s*True',
"severity": "CRITICAL",
"fix": "Use subprocess with array arguments, never shell=True with user input"
},
\# 路径遍历
{
"name": "Path Traversal",
"pattern": r'open\s*\(\s*.*\+\s*|Path\s*\(\s*.*\+\s*',
"severity": "HIGH",
"fix": "Validate and sanitize file paths, use allowlists"
},
\# 裸 except
{
"name": "Bare Except",
"pattern": r'except\s*:',
"severity": "MEDIUM",
"fix": "Catch specific exceptions instead of bare except"
},
\# 不安全的 pickle
{
"name": "Insecure Deserialization",
"pattern": r'pickle\.loads?\s*\(',
"severity": "HIGH",
"fix": "Use json or msgpack instead of pickle for untrusted data"
},
\# 不安全的 YAML 加载
{
"name": "Insecure YAML Load",
"pattern": r'yaml\.load\s*\([^)]*\)(?!.*Loader)',
"severity": "HIGH",
"fix": "Use yaml.load(data, Loader=yaml.SafeLoader)"
},
# 评估表达式
{
"name": "Eval Usage",
"pattern": r'\beval\s*\(',
"severity": "HIGH",
"fix": "Avoid eval() with user input; use ast.literal_eval() for literals"
},
]
def scan_file(filepath: str) -> list[dict]:
"""扫描文件中的安全漏洞"""
source = Path(filepath).read_text(encoding="utf-8", errors="replace")
lines = source.splitlines()
findings = []
for pattern_info in SECURITY_PATTERNS:
matches = list(re.finditer(pattern_info["pattern"], source, re.IGNORECASE))
for match in matches:
# 找到行号
line_num = source[:match.start()].count("\n") + 1
line_content = lines[line_num - 1].strip() if line_num <= len(lines) else ""
findings.append({
"name": pattern_info["name"],
"severity": pattern_info["severity"],
"line": line_num,
"code": line_content[:100],
"fix": pattern_info["fix"]
})
return findings
def main():
if len(sys.argv) < 2:
print("Usage: python security_scan.py <file_path>")
sys.exit(1)
filepath = sys.argv[1]
if not Path(filepath).exists():
print(f"Error: File not found: {filepath}")
sys.exit(1)
findings = scan_file(filepath)
print(f"\n{'='*60}")
print(f" Security Scan: {filepath}")
print(f" Findings: {len(findings)}")
print(f"{'='*60}\n")
severity_icon = {"CRITICAL": "🔴", "HIGH": "🟠", "MEDIUM": "🟡", "LOW": "🟢"}
for finding in sorted(findings, key=lambda x: ["CRITICAL", "HIGH", "MEDIUM", "LOW"].index(x["severity"])):
icon = severity_icon.get(finding["severity"], "⚪")
print(f" {icon} [{finding['severity']}] {finding['name']}")
print(f" Line {finding['line']}: {finding['code']}")
print(f" Fix: {finding['fix']}")
print()
critical_count = sum(1 for f in findings if f["severity"] == "CRITICAL")
sys.exit(1 if critical_count > 0 else 0)
if __name__ == "__main__":
main()
6. 跨平台复用:同一个 SKILL.md 在不同平台如何工作
据《SKILL.md — 에이전트 스킬 포맷》(https://www.mdskills.ai/ko/specs/skill-md),SKILL.md 已被 27+ AI Agent 平台兼容。但各平台的加载机制略有不同:
plaintext
┌──────────────────────────────────────────────────────────────┐
│ SKILL.md 跨平台加载机制 │
├──────────────┬──────────────────────────────────────────────┤
│ 平台 │ 加载方式 │
├──────────────┼──────────────────────────────────────────────┤
│ Claude Code │ .claude/skills/ 目录 │
│ │ 自动发现 + 手动 /skill 命令 │
│ │ YAML frontmatter → 系统提示 │
│ │ Markdown body → 任务匹配时加载 │
├──────────────┼──────────────────────────────────────────────┤
│ OpenClaw │ .agents/skills/ 目录 │
│ │ ClawHub 安装:claw install <skill-name> │
│ │ 自动发现 + 渐进式加载 │
│ │ 支持 scripts/ 自动执行 │
├──────────────┼──────────────────────────────────────────────┤
│ Cursor │ .cursor/rules/ 目录 │
│ │ SKILL.md → 转换为 Cursor Rule 格式 │
│ │ 项目级 + 用户级规则 │
├──────────────┼──────────────────────────────────────────────┤
│ GitHub │ .github/copilot/ 目录 │
│ Copilot │ SKILL.md → Custom Instructions │
│ │ 仓库级配置 │
├──────────────┼──────────────────────────────────────────────┤
│ Codex │ agentskills.io 标准 │
│ (OpenAI) │ /codex 命令加载 │
│ │ 兼容 SKILL.md frontmatter │
├──────────────┼──────────────────────────────────────────────┤
│ Gemini CLI │ .gemini/skills/ 目录 │
│ │ 原生兼容 SKILL.md 格式 │
└──────────────┴──────────────────────────────────────────────┘
6.1 兼容性最佳实践
为了让同一个 SKILL.md 在所有平台正常工作:
Frontmatter 只用标准字段:
name、description、allowed-tools、version、license、compatible-with不使用平台特定语法:避免
<system>标签、平台特定变量Instructions 用纯 Markdown:标题、列表、代码块
平台差异放在
compatible-with中说明:如compatible-with: claude-code, openclaw
7. ClawHub 发布流程:注册→打包→发布→版本管理
据《万字详解:OpenClaw(俗称"龙虾")能做什么》(https://cloud.tencent.cn/developer/article/2647247),ClawHub 是 OpenClaw 的 Skill 市场,截至 2026年3月已有 26,000+ 社区 Skill。
7.1 发布流程
plaintext
┌──────────────────────────────────────────────────────────────┐
│ ClawHub 发布流程 │
│ │
│ 1. 注册 │
│ claw auth login │
│ → 浏览器打开 OAuth 登录页 │
│ → 获取 API Token │
│ │
│ 2. 打包 │
│ claw skill pack deployment-checklist/ │
│ → 生成 deployment-checklist-1.2.0.zip │
│ │
│ 3. 校验 │
│ claw skill validate deployment-checklist/ │
│ → 检查 SKILL.md 格式、scripts 安全性、文件完整性 │
│ │
│ 4. 发布 │
│ claw skill publish deployment-checklist-1.2.0.zip │
│ → 上传到 ClawHub │
│ → 等待审核(通常 1-24 小时) │
│ │
│ 5. 安装验证 │
│ claw install deployment-checklist │
│ → 从 ClawHub 下载安装 │
│ → 验证功能正常 │
└──────────────────────────────────────────────────────────────┘
7.2 版本管理
bash
# 更新版本号
# 在 SKILL.md 的 frontmatter 中修改 version 字段
# version: 1.2.0 → 1.3.0
# 重新打包发布
claw skill pack deployment-checklist/
claw skill publish deployment-checklist-1.3.0.zip
# 用户更新
claw update deployment-checklist
8. Skill 安全审查:供应链攻击风险、YAML 注入、恶意脚本检测
8.1 主要安全风险
plaintext
┌──────────────────────────────────────────────────────────────┐
│ Skill 安全风险矩阵 │
├──────────────┬──────────────────────┬───────────────────────┤
│ 风险类型 │ 攻击方式 │ 危害等级 │
├──────────────┼──────────────────────┼───────────────────────┤
│ YAML 注入 │ 在 frontmatter 中 │ 🔴 高危 │
│ │ 嵌入恶意代码 │ 可注入系统提示 │
├──────────────┼──────────────────────┼───────────────────────┤
│ 恶意脚本 │ scripts/ 中放置 │ 🔴 高危 │
│ │ 后门或数据窃取代码 │ 可获取系统权限 │
├──────────────┼──────────────────────┼───────────────────────┤
│ 供应链攻击 │ 依赖包中植入恶意代码 │ 🟠 中危 │
│ │ (如 typosquatting) │ 可横向扩散 │
├──────────────┼──────────────────────┼───────────────────────┤
│ 过度权限 │ allowed-tools 声明 │ 🟡 低危 │
│ │ 过于宽泛(如裸 Bash) │ 可能执行未授权操作 │
├──────────────┼──────────────────────┼───────────────────────┤
│ Prompt 注入 │ instructions 中 │ 🟠 中危 │
│ │ 嵌入指令覆盖安全策略 │ 可绕过安全限制 │
└──────────────┴──────────────────────┴───────────────────────┘
8.2 安全审查检查清单
python
#!/usr/bin/env python3
"""
Skill 安全审查工具
作者:PySuper | 来源:zhengxingtao.com
"""
import re
import yaml
from pathlib import Path
def audit_skill(skill_dir: str) -> list[dict]:
"""审查 Skill 的安全性"""
skill_path = Path(skill_dir)
skill_md = skill_path / "SKILL.md"
if not skill_md.exists():
return [{"severity": "CRITICAL", "issue": "SKILL.md not found"}]
content = skill_md.read_text()
findings = []
# 1. 检查 YAML 注入
try:
# 提取 frontmatter
fm_match = re.match(r'^---\n(.*?)\n---', content, re.DOTALL)
if fm_match:
fm = yaml.safe_load(fm_match.group(1))
# 检查 XML 标签
if re.search(r'[<>]', fm_match.group(1)):
findings.append({
"severity": "HIGH",
"issue": "XML tags in frontmatter — potential prompt injection",
"fix": "Remove all < and > characters from frontmatter"
})
# 检查 allowed-tools 中的裸 Bash
if "allowed-tools" in fm:
tools = fm["allowed-tools"]
if "Bash" in tools and "Bash(" not in tools:
findings.append({
"severity": "HIGH",
"issue": "Unscoped Bash in allowed-tools — can execute arbitrary commands",
"fix": "Scope Bash: 'Bash(python:*)' or 'Bash(npm:*)'"
})
except yaml.YAMLError as e:
findings.append({
"severity": "MEDIUM",
"issue": f"YAML parse error: {e}",
"fix": "Fix YAML syntax in frontmatter"
})
# 2. 检查 scripts/ 中的可疑代码
scripts_dir = skill_path / "scripts"
if scripts_dir.exists():
for script_file in scripts_dir.iterdir():
if script_file.suffix in (".py", ".sh"):
script_content = script_file.read_text(errors="replace")
# 检查网络调用
if re.search(r'requests\.(get|post|put)|urllib|socket\.connect', script_content):
findings.append({
"severity": "MEDIUM",
"issue": f"Network call detected in {script_file.name}",
"fix": "Ensure network calls are to documented endpoints only"
})
# 检查文件系统越权
if re.search(r'os\.system|subprocess\.(call|run|Popen).*shell\s*=\s*True', script_content):
findings.append({
"severity": "HIGH",
"issue": f"Shell execution in {script_file.name} — command injection risk",
"fix": "Use subprocess with array arguments"
})
# 检查数据外泄
if re.search(r'(send|upload|post).*data|base64\.b64encode', script_content, re.IGNORECASE):
findings.append({
"severity": "MEDIUM",
"issue": f"Potential data exfiltration in {script_file.name}",
"fix": "Review data sending logic for unauthorized data collection"
})
# 3. 检查 Prompt 注入
instructions = content.split("---", 2)[-1] if content.count("---") >= 2 else ""
injection_patterns = [
r"(?i)ignore\s+(all\s+)?previous\s+instructions",
r"(?i)you\s+are\s+now\s+",
r"(?i)forget\s+(your|the)\s+rules",
r"(?i)override\s+security",
]
for pattern in injection_patterns:
if re.search(pattern, instructions):
findings.append({
"severity": "HIGH",
"issue": f"Prompt injection pattern detected: {pattern}",
"fix": "Remove injection-like instructions"
})
return findings
if __name__ == "__main__":
import sys
if len(sys.argv) < 2:
print("Usage: python skill_audit.py <skill_directory>")
sys.exit(1)
results = audit_skill(sys.argv[1])
if not results:
print("✅ No security issues found")
else:
for r in results:
icon = {"CRITICAL": "🔴", "HIGH": "🟠", "MEDIUM": "🟡"}[r["severity"]]
print(f"{icon} [{r['severity']}] {r['issue']}")
print(f" Fix: {r['fix']}\n")
9. 三级渐进加载:从 100 Token 到按需全量
据《Skill再回首—深度解读Anthropic官方最新Skill白皮书》(https://aicoding.juejin.cn/post/7615074040147017738),渐进式披露是 Skill 最精妙的设计:
plaintext
┌──────────────────────────────────────────────────────────────┐
│ 三级渐进加载(Progressive Disclosure) │
│ │
│ Level 0: 发现 (~100 Token) │
│ ┌─────────────────────────────────────────────┐ │
│ │ name: code-review │ │
│ │ description: Performs comprehensive code │ │
│ │ review covering security, performance... │ │
│ │ Trigger with 'review', 'code review' │ │
│ └─────────────────────────────────────────────┘ │
│ → Agent 启动时加载所有 Skill 的 Level 0 │
│ → 100 个 Skill ≈ 10,000 Token(可承受) │
│ → Agent 判断是否需要激活某个 Skill │
│ │
│ Level 1: 激活 (~5,000 Token) │
│ ┌─────────────────────────────────────────────┐ │
│ │ SKILL.md 完整内容 │ │
│ │ - Instructions(步骤) │ │
│ │ - Review Criteria(审查标准) │ │
│ │ - Output Format(输出格式) │ │
│ │ - Error Handling(错误处理) │ │
│ └─────────────────────────────────────────────┘ │
│ → 任务匹配时才加载 │
│ → 通常只有 1-3 个 Skill 同时处于 Level 1 │
│ │
│ Level 2: 执行 (按需) │
│ ┌─────────────────────────────────────────────┐ │
│ │ references/ 目录 │ │
│ │ - owasp-top-10.md(安全参考) │ │
│ │ - style-guides.md(风格指南) │ │
│ │ scripts/ 目录 │ │
│ │ - analyze.py(分析脚本) │ │
│ │ - security_scan.py(安全扫描) │ │
│ └─────────────────────────────────────────────┘ │
│ → Skill 指令引导时才读取 │
│ → 可能完全不加载(如果不需要) │
└──────────────────────────────────────────────────────────────┘
Token 开销对比:
表格
10. OpenClaw vs Hermes 的 Skill 哲学对比
plaintext
┌──────────────────────────────────────────────────────────────┐
│ OpenClaw vs Hermes 的 Skill 哲学 │
├──────────────┬──────────────────────┬───────────────────────┤
│ 维度 │ OpenClaw │ Hermes Agent │
│ │ "手动安装" 哲学 │ "自进化" 哲学 │
├──────────────┼──────────────────────┼───────────────────────┤
│ Skill 来源 │ ClawHub 社区安装 │ 自动从任务中生成 │
│ │ 手动编写 │ GEPA 自我进化 │
├──────────────┼──────────────────────┼───────────────────────┤
│ 加载方式 │ 4级优先级手动配置 │ 自动匹配 + 渐进加载 │
├──────────────┼──────────────────────┼───────────────────────┤
│ Skill 质量 │ 人工审核上架 │ 使用中自动评分修剪 │
│ │ 社区评分 │ Skill Curator 后台优化│
├──────────────┼──────────────────────┼───────────────────────┤
│ 适用场景 │ 明确需求的团队 │ 探索性强的个人 │
│ │ 需要可控可审计 │ 需要 Agent 自主学习 │
├──────────────┼──────────────────────┼───────────────────────┤
│ 风险 │ Skill 可能过时 │ 自动生成的 Skill │
│ │ 需要人工维护更新 │ 可能不够精确 │
├──────────────┼──────────────────────┼───────────────────────┤
│ 类比 │ App Store(应用商店) │ 免疫系统(自适应) │
│ │ 精选、审核、下载 │ 遇到问题 → 产生抗体 │
└──────────────┴──────────────────────┴───────────────────────┘
据《How Hermes Agent Gets Better Over Time》(https://hermes-agent.ai/blog/self-improving-ai-guide),Hermes 的自进化机制是:每 15 次工具调用后,Agent 会暂停自我评估——"我做了什么?什么有效?什么失败?是否值得提炼为 Skill?"如果答案是肯定的,就自动生成 SKILL.md。
11. 踩坑记录
坑1:Skill 触发率太低
问题:写了 Skill 但 Agent 从来不用它。
原因:description 写得不够"激进",Agent 匹配不到。
yaml
# ❌ 太保守
description: "Helps with code review"
# ✅ 更激进的 claiming
description: |
Performs comprehensive code review covering security, performance,
and maintainability. Make sure to use this skill whenever reviewing
ANY code, pull request, or code change. Trigger with 'review',
'code review', 'PR review', 'check code', 'audit'.
坑2:SKILL.md 文件名大小写错误
问题:Skill 文件命名为 skill.md 或 SKILL.MD,Agent 无法发现。
原因:SKILL.md 是大小写敏感的,必须精确匹配。
bash
# ❌ 错误
skill.md SKILL.MD Skill.md
# ✅ 正确
SKILL.md
坑3:allowed-tools 裸 Bash 导致安全警告
问题:安装第三方 Skill 时,平台安全审查拒绝。
yaml
# ❌ 裸 Bash —— 可执行任意命令
allowed-tools: "Read, Write, Bash"
# ✅ 限定范围
allowed-tools: "Read, Write, Bash(python:*), Bash(npm:*)"
坑4:references/ 文件过大导致 Token 爆炸
问题:references/ 中放了一个 50KB 的文档,Agent 读取时 Token 消耗暴增。
解决:
把大文档拆成多个小文件
在 SKILL.md 中明确指导何时读取哪个文件
使用摘要而非原始文档
markdown
## References
For security review guidelines (only read when reviewing Python code):
→ references/owasp-top-10.md
For style guidelines (only read when specifically asked about style):
→ references/style-guides.md
坑5:跨平台兼容性 — 使用了平台特定语法
问题:Skill 在 Claude Code 中工作,但在 Cursor 中无效。
markdown
<!-- ❌ Claude Code 特有语法 -->
<system>
Always respond in Chinese.
</system>
<!-- ✅ 通用 Markdown -->
## Language
Respond in the user's language. If the user writes in Chinese, respond in Chinese.
12. 总结与展望
Agent Skill 的本质
Skill 不是工具,不是插件,不是 Function Call。Skill 是知识封装——它封装了"何时做、怎么做、做到什么标准"的完整知识,让 AI Agent 从"能回答问题"升级为"能执行工作流"。
三层能力栈
plaintext
┌──────────────────────────────────────────────────────────────┐
│ 2026 AI Agent 能力栈 │
│ │
│ Layer 3: Skill(知识封装) │
│ "知道做什么" —— 流程、规则、最佳实践 │
│ → SKILL.md 开放标准 │
│ │
│ Layer 2: MCP(工具连接) │
│ "知道怎么连" —— 标准化协议、发现、调用 │
│ → JSON-RPC 2.0 │
│ │
│ Layer 1: LLM(推理引擎) │
│ "能思考" —— 生成、推理、决策 │
│ → Claude, GPT, Gemini... │
│ │
│ Layer 0: A2A(Agent 互联) │
│ "能协作" —— Agent 间发现、通信、委托 │
│ → Agent Card, Task Lifecycle │
└──────────────────────────────────────────────────────────────┘
未来趋势
Skill 自动生成成为标配:Hermes Agent 证明了 Skill 可以从经验中自动提炼,其他框架也在跟进
Skill 市场爆发:ClawHub 26K+ Skill 只是开始,随着 Agent 普及,Skill 将成为新的"应用生态"
Skill + MCP + A2A 三位一体:Skill 封装知识,MCP 连接工具,A2A 连接 Agent——三者互补,构成完整的 AI Agent 基础设施
本文作者:PySuper | 来源:zhengxingtao.com
参考资源:
AgentSkills.io 官方规范:https://agentskills.io
Anthropic Skill 指南:https://resources.anthropic.com/hubfs/The-Complete-Guide-to-Building-Skill-for-Claude.pdf
SKILL.md Specification:https://github.com/jeremylongshore/claude-code-plugins-plus-skills/wiki/SKILL-md-Specification
评论区