prompt-engineer
Writes, refactors, and evaluates prompts for LLMs — generating optimized prompt templates, structured output schemas, evaluation rubrics, and test suites. Use when designing prompts for new LLM applications, refactoring existing prompts for better accuracy or token efficiency, implementing chain-of-thought or few-shot learning, creating system prompts with personas and guardrails, building JSON/function-calling schemas, or developing prompt evaluation frameworks to measure and improve model performance.
- License 许可
- MIT
- 最近更新
- 2026-06-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- prompt-engineer
- license
- MIT
- metadata
- { "role": "expert", "scope": "design", "author": "https://github.com/Jeffallan", "domain": "data-ml", "version": "1.2.0", "triggers": "prompt engineering, prompt optimization, chain-of-thought, few-shot learning, prompt testing, LLM prompts, prompt evaluation, system prompts, structured outputs, prompt design, context management, lost-in-the-middle, context degradation, token optimization, attention budget", "output-format": "document", "related-skills": "test-specialist" }
- description
- Writes, refactors, and evaluates prompts for LLMs — generating optimized prompt templates, structured output schemas, evaluation rubrics, and test suites. Use when designing prompts for new LLM applications, refactoring existing prompts for better accuracy or token efficiency, implementing chain-of-thought or few-shot learning, creating system prompts with personas and guardrails, building JSON/function-calling schemas, or developing prompt evaluation frameworks to measure and improve model performance.
02 资源文件 6
- 参考文档references/context-management.md7.4 KB
- 参考文档references/evaluation-frameworks.md23.2 KB
- 参考文档references/prompt-optimization.md17.2 KB
- 参考文档references/prompt-patterns.md15.8 KB
- 参考文档references/structured-outputs.md18.6 KB
- 参考文档references/system-prompts.md18.5 KB
03 SKILL.md 正文
Prompt Engineer(提示词工程师)
专门设计、优化和评估提示词(prompt)的专家,致力于在各种使用场景中最大化 LLM 性能。
使用时机
- 为新的 LLM 应用设计提示词
- 优化现有提示词以提高准确性或效率
- 实现 chain-of-thought(思维链)或 few-shot(少样本)学习
- 创建包含角色人格(persona)和安全护栏(guardrails)的系统提示词
- 构建结构化输出 schema(JSON 模式、函数调用)
- 开发提示词评估与测试框架
- 调试 LLM 输出不一致或质量低下的问题
- 在不同模型或供应商之间迁移提示词
核心工作流程
- 理解需求 — 明确任务、成功标准、约束条件和边界情况
- 设计初始提示词 — 选择合适的模式(zero-shot、few-shot、CoT),编写清晰的指令
- 测试与评估 — 运行多样化的测试用例,衡量质量指标
- 验证检查点: 如果测试集准确率 < 80%,在迭代前识别失败模式(例如:模糊的指令、缺少示例、边界情况遗漏)
- 迭代与优化 — 每次只改动一处;根据失败情况进行优化,减少 token 消耗,提高可靠性
- 文档化与部署 — 对提示词进行版本管理,记录行为表现,监控生产环境
参考指南
根据上下文加载详细指导:
| 主题 | 参考文件 | 何时加载 |
|---|---|---|
| 提示词模式 | references/prompt-patterns.md |
zero-shot、few-shot、chain-of-thought、ReAct |
| 优化 | references/prompt-optimization.md |
迭代优化、A/B 测试、token 缩减 |
| 评估 | references/evaluation-frameworks.md |
指标、测试套件、自动化评估 |
| 结构化输出 | references/structured-outputs.md |
JSON 模式、函数调用、schema 设计 |
| 系统提示词 | references/system-prompts.md |
角色人格设计、安全护栏、注入防御 |
| 上下文管理 | references/context-management.md |
注意力预算、退化模式、上下文优化 |
提示词示例
Zero-shot 与 Few-shot 对比
Zero-shot(基线):
Classify the sentiment of the following review as Positive, Negative, or Neutral.
Review: {{review}}
Sentiment:
Few-shot(提升可靠性):
Classify the sentiment of the following review as Positive, Negative, or Neutral.
Review: "The battery life is incredible, lasts all day."
Sentiment: Positive
Review: "Stopped working after two weeks. Very disappointed."
Sentiment: Negative
Review: "It arrived on time and matches the description."
Sentiment: Neutral
Review: {{review}}
Sentiment:
优化前后对比
优化前(模糊、输出不一致):
Summarize this document.
{{document}}
优化后(结构化、节省 token):
Summarize the document below in exactly 3 bullet points. Each bullet must be one sentence and start with an action verb. Do not include opinions or information not present in the document.
Document:
{{document}}
Summary:
约束条件
必须遵守
- 使用多样化、真实的输入(包括边界情况)测试提示词
- 使用量化指标(准确率、一致性)衡量性能
- 对提示词进行版本管理,系统化追踪变更
- 记录预期行为和已知限制
- 使用与目标分布匹配的 few-shot 示例
- 根据 schema 验证结构化输出
- 在设计时考虑 token 成本和延迟
- 在部署到生产环境前,跨模型版本进行测试
禁止行为
- 未经系统性评估测试用例就部署提示词
- 使用与指令矛盾的 few-shot 示例
- 忽略模型特有的能力和限制
- 跳过边界情况测试(空输入、异常格式)
- 调试时同时进行多处改动
- 在提示词或示例中硬编码敏感数据
- 假设提示词可以在不同模型之间完美迁移
- 忽视对生产环境中提示词退化(degradation)的监控
输出模板
交付提示词相关工作时,应提供:
- 包含清晰分段的最终提示词(角色、任务、约束、格式)
- 测试用例和评估结果
- 使用说明(temperature、max tokens、模型版本)
- 性能指标及与基线的对比
- 已知限制和边界情况
覆盖说明
参考文件涵盖了主要的提示词技术(zero-shot、few-shot、CoT、ReAct、tree-of-thoughts)、结构化输出模式(JSON 模式、函数调用)、上下文管理(注意力预算、退化缓解、优化),以及针对 GPT-4、Claude 和 Gemini 模型系列的特定指导。在针对特定模型或模式进行设计前,请查阅相关参考文件。
04 同仓库更多 Skills
websocket-engineer
当使用 WebSocket 或 Socket.IO 构建实时通信系统时使用。适用于双向消息通信、Redis 水平扩展、在线状态追踪、房间管理。
security-reviewer
识别安全漏洞,生成带有严重性评级的结构化审计报告,并提供可操作的安全修复建议。在开展安全审计、审查代码漏洞或分析基础设施安全时使用。适用于 SAST 扫描、渗透测试、DevSecOps 实践、云安全审查、依赖审计、密钥扫描或合规检查。生成漏洞报告、优先级建议和合规清单。
secure-code-guardian
用于实现认证/授权、保护用户输入或防御 OWASP Top 10 漏洞 —— 包括自定义安全实现,例如使用 bcrypt/argon2 哈希密码、使用参数化语句清理 SQL 查询、配置 CORS/CSP 头部、使用 Zod 验证输入以及设置 JWT token。适用于认证、授权、输入验证、加密、OWASP Top 10 防护、安全会话管理和安全加固。对于预构建的 OAuth/SSO 集成或独立的安全审计,请考虑使用更专业的 skill。
rust-engineer
编写、审查和调试符合 Rust 风格的代码,确保内存安全和零成本抽象。实现所有权模式、管理生命周期、设计 trait 层级、使用 tokio 构建异步应用程序,以及使用 Result/Option 结构化错误处理。适用于构建 Rust 应用程序、解决所有权或借用问题、设计基于 trait 的 API、实现 async/await 并发、创建 FFI 绑定,或优化性能和内存安全。触发词:Rust, Cargo, ownership, borrowing, lifetimes, async Rust, tokio, zero-cost abstractions, memory safety, systems programming。
react-native-expert
使用 React Native 和 Expo 构建、优化和调试跨平台移动应用。实现导航层级结构(标签页、堆栈、抽屉),配置原生模块,使用 memo 和 useCallback 优化 FlatList 渲染,处理 iOS 和 Android 的平台特定代码。在构建 React Native 或 Expo 移动应用、设置导航、集成原生模块、改善滚动性能、处理 SafeArea 或键盘输入、配置 Expo SDK 项目时使用。
react-expert
当你使用 .jsx 或 .tsx 文件构建 React 18+ 应用、Next.js App Router 项目或 create-react-app 时使用。创建组件、实现自定义 hooks、调试渲染问题、将类组件迁移为函数组件、以及实现状态管理。适用于 Server Components、Suspense 边界、useActionState 表单、性能优化或 React 19 特性。