Files
nexus/wiki/concepts/Agent-Skill-设计模式.md

53 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: agent-skill-design-patterns
title: "Agent Skill 设计模式"
type: concept
tags: [Agent, Skill, 设计模式]
sources: [Google-5-Agent-Skill-design-patterns-2026-03-19]
last_updated: 2026-04-17
---
## Summary
Google 发布的 5 种 Agent Skill 设计模式,用于指导如何构建真正可靠的 agent。
## Definition
Agent Skill 设计模式是 Google Cloud 总结的 5 种经过验证的 skill 构建模式,每种都有完整的 ADK 代码示例。
## Five Patterns
### 1. Tool Wrapper
让 agent 快速成为某个领域的专家。通过监听特定库关键词,当用户开始使用特定技术时才动态加载相关文档。
### 2. Generator
从模板生成结构化输出。通过"填空"流程解决 agent 每次运行生成文档结构不一致的问题。
### 3. Reviewer
把检查清单和检查逻辑分开。审查标准存放在 references 目录agent 动态加载特定审查标准并强制输出结构化结果。
### 4. Inversion
agent 先问用户再做。通过明确、不可协商的门控指令,确保 agent 逐个阶段提问,等待用户答案后再进入下一个阶段。
### 5. Pipeline
带硬性检查点的严格工作流。强制执行顺序工作流,在关键节点设置硬性检查点,确保无法绕过复杂任务直接给出未验证的最终结果。
## Selection Guide
每种模式有其应用场景:
- Tool Wrapper需要快速成为某领域专家时
- Generator需要强制一致的输出格式时
- Reviewer需要不同专项审计时
- Inversion需要用户参与每个阶段时
- Pipeline需要严格工作流和检查点时
## Combination
5 种模式并非互斥,可以组合使用:
- Pipeline 可以在最后包含 Reviewer 步骤来 double-check 成果
- Generator 可以在最开始依赖 Inversion 来收集必要变量
## Related Concepts
- [[Tool Wrapper]]
- [[Generator]]
- [[Reviewer]]
- [[Inversion]]
- [[Pipeline]]
- [[SkillToolset]]
- [[渐进式披露]]