Files
nexus/wiki/concepts/Generator.md

49 lines
1.2 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: generator
title: "Generator"
type: concept
tags: [Agent, Skill, 设计模式]
sources: []
last_updated: 2026-03-19
---
# Generator
通过模板和变量填充流程从用户需求生成结构化、一致性输出的Skill设计模式。
## 定义
Generator模式利用预定义的输出模板和样式指南由Agent扮演项目经理角色通过"收集缺失变量→填充模板→输出结果"的流程,保证每次运行生成格式完全一致的文档或代码。
## 机制
- assets/目录存放输出模板
- references/目录存放样式指南
- SKILL.md作为协调器指导Agent加载模板、读取指南、收集变量、填充内容
- 变量未齐全时Agent主动向用户询问
## 适用场景
- 统一API文档生成
- 标准化commit信息格式
- 项目脚手架初始化
- 报告/简报批量生成
## 优点
- 输出格式完全一致可预期
- 模板与内容分离,便于更新样式
- 变量收集机制确保信息完整
## 缺点
- 模板维护成本较高
- 变量收集可能增加交互轮次
- 不适合高度创造性任务
## 关系
- 上位概念:[[AgentSkill设计模式]]
- 可组合:[[Inversion]]用Inversion收集变量
- 可组合:[[Reviewer]]用Reviewer检查输出