
最近在折腾 AI 编程工具,发现一个很现实的问题:这些 Agent 们写代码确实快,但普遍喜欢"抄近路"——跳过需求确认、跳过测试、跳过代码审查,怎么省事怎么来。今天聊的这个项目,就是来解决这个问题的。
这是"每日一开源项目"系列的第 58 篇,今天聊聊 Agent Skills。
如果说上期介绍的 Symphony 解决的是"如何大规模运行 AI Agent",那 Agent Skills 要解决的是更根本的问题:怎么让 AI 编程助手真正像个资深工程师一样干活?
这个项目来自 Addy Osmani——Google Chrome 的工程总监、前端领域的老牌人物、《Learning JavaScript Design Patterns》的作者。他对 AI 工具的观察一针见血:AI Agent 喜欢走捷径。跳过规格说明(spec)、跳过测试、跳过安全审查——只要交出"看起来能跑"的代码就行。Agent Skills 存在的意义,就是把资深工程师 20 多年的工程素养编码成可执行的工作流,让 AI 不再耍小聪明。
Agent Skills 是一个纯文本(Markdown)格式的工程工作流集合。它不是框架,不是 SDK——而是一套可以直接加载到 AI 工具中的"认知协议"。当你把这些技能加载到 Claude Code 或 Cursor 中后,AI 不会再一上来就埋头写代码,而是会先问:需求确认了吗?任务分解了吗?测试通过了吗?
核心理念源自 Google 内部工程文化:Hyrum 法则(隐式接口依赖最终会被利用)、测试金字塔、主分支开发(Trunk-Based Development),以及最重要的——把代码视为负债,而非资产。
Agent Skills 的核心价值在于:把隐性的工程素养转化为显式的、AI 可执行的逐级检查清单。
当一个普通 AI 助手被要求"修个 bug"时,它写完代码就说"搞定了"。而加载了 Agent Skills 的 AI 会这样走流程:问题确认 → 根因分析 → 最小复现 → 修复 → 测试覆盖 → 代码审查 → 文档更新——每个步骤都有明确的验证标准。
个人开发者提升 AI 协作质量
团队标准化 AI 使用规范
自动化 Agent 流水线的质量门禁
AI 编程教育和培训
方式一:Claude Code 插件市场(推荐)
# Execute inside a Claude Code session
/plugin marketplace add addyosmani/agent-skills
/plugin install agent-skills@addy-agent-skills
安装完成后直接使用斜杠命令:
# Define requirements
/spec I need a user authentication feature with OAuth 2.0 support # Plan tasks
/plan # Start implementation
/build # Verify functionality
/test # Code review
/review # Reduce complexity
/code-simplify # Deploy
/ship
方式二:本地克隆(适用于所有工具)
# Clone the repository
git clone https://github.com/addyosmani/agent-skills.git # Load in Claude Code
claude --plugin-dir /path/to/agent-skills # Load in Gemini CLI
gemini skills install https://github.com/addyosmani/agent-skills.git --path skills
方式三:在 CLAUDE.md 中直接引用
# CLAUDE.md
Load the following skills for this project:
- skills/build/incremental-implementation
- skills/verify/test-driven-development
- skills/review/code-review-and-quality
20 个专业技能
7 个斜杠命令
/spec、/plan、/build、/test、/review、/code-simplify、/ship——把复杂工作流压缩成单条命令。3 个专家 Agent 人格
code-reviewer、test-engineer、security-auditor——让 AI 从专业视角来审视你的代码。Anti-Rationalization 设计
/spec 把需求锁死。"
验证优先
工具无关
4 份参考检查清单
| 特性 | Agent Skills | 通用系统提示词 | 规则文件(.cursorrules) |
|---|---|---|---|
| 结构化程度 | 完整的步骤与检查点工作流 | 自由文本,AI 理解差异大 | 聚焦于代码风格规则 |
| 工程深度 | 完整生命周期(从 spec 到 ship) | 通常只覆盖代码生成 | 主要用于约束格式 |
| 反捷径机制 | 内置借口-反驳对照表 | 无 | 无 |
| 多工具支持 | 7+ 个主流 AI 工具 | 工具专属 | 工具专属 |
| 可维护性 | 版本化的 Markdown,可通过 PR 更新 | 分散在各种配置中 | 单个仓库级文件 |
为什么选 Agent Skills?
以 skills/build/incremental-implementation/SKILL.md 为例,每个技能文件都遵循一致的结构:
---
name: incremental-implementation
description: Build features in small, testable increments
triggers: - "start implementation" - "begin coding" - "implement feature"
--- ## Overview
[Purpose and scope of the skill] ## When to Use
[Specific scenarios that trigger this skill] ## Process
[Step-by-step workflow with explicit deliverables at each step] ### Step 1: Understand the task
- Confirm whether a spec already exists
- Clarify implementation boundaries (in scope / out of scope)
... ## Rationalizations (Excuses & Rebuttals)
Common Excuse Why It Doesn't Hold "The feature is simple, just write it" Simplicity is subjective; no spec means no acceptance criteria "I'll add tests afterward" Test debt almost never gets paid back
## Red Flags
[Warning signs of workflow deviation, e.g., a single commit over 400 lines] ## Verification
[Proof required to confirm this skill was properly executed]
这个结构的精妙之处在于:这不是写给人看的文档,而是写给 AI 执行的程序。每个字段都在约束 AI 的行为边界。
Define → Plan → Build → Verify → Review → Ship ↓ ↓ ↓ ↓ ↓ ↓
/spec /plan /build /test /review /ship ↓ ↓ ↓ ↓ ↓ ↓
Lock Req Decomp Increm Prove Quality Safe Tasks Impl Tests Gates Deploy
每个阶段都有对应的具体技能支撑:
Define(定义):idea-refine、spec-driven-development
Plan(规划):planning-and-task-breakdown
Build(构建):incremental-implementation、test-driven-development、frontend-ui-engineering、source-driven-development、documentation-as-code、code-as-liability
Verify(验证):browser-testing-with-devtools、debugging-and-error-recovery
Review(审查):code-review-and-quality、security-and-hardening、performance-optimization、change-sizing
Ship(发布):git-workflow-and-versioning、ci-cd-and-automation、shipping-and-launch、trunk-based-development、code-deprecation
这是 Agent Skills 最具创意的设计之一。不让同一个 AI 又写代码又审查代码,而是让它"变身"成专职专家:
security-auditor 人格示例:
You are a security auditor. Your ONLY job is to find vulnerabilities.
Do NOT suggest new features. Do NOT improve code quality.
Focus EXCLUSIVELY on:
- Input validation gaps
- Authentication/Authorization flaws
- Injection vulnerabilities (SQL, XSS, SSTI...)
- Exposed secrets or credentials
- Insecure dependencies
当你调用 security-auditor 人格来审查代码时,AI 会完全进入安全专家视角——不会被功能实现分散注意力。在 AI 使用层面应用单一职责原则(SRP),效果出奇地好。
这是项目最独特的创新点。每个技能文件都包含"借口-反驳"对照表,专门针对 AI(和人类)在压力下常有的逃避行为:
| 常见 AI 借口 | 工程素养反驳 |
|---|---|
| "这个功能很简单,直接写就行" | 简单是主观的;没有 spec 就意味着没有验收标准 |
| "测试后面再加" | 测试债务几乎永远不会还清 |
| "这只是临时的解决方案" | "临时"方案的平均寿命往往会超出所有人的预期 |
| "PR 已经很大了,再加点没关系" | 大 PR 会造成审查盲点,是合并冲突的源头 |
| "性能优化可以等" | "以后"通常意味着永远不会 |
如果 AI 编程工具让你写代码的速度提升了 10 倍,Agent Skills 确保你写出来的东西质量也提升 10 倍。
原文链接:https://dev.to/...