调教AI别再靠感觉!这套Prompt工程方法论让模型乖乖听话

你平时调教 AI 是不是全凭感觉?「写得不错」「再详细点」——这种玄学调法,累死模型也救不回来。

今天推荐一个我最近挖到的宝藏 Skill:prompt-engineering,来自 GitHub 9.2k star 的超全 Claude Code 技能库 rohunvora/my-claude-skills。这个子 Skill 专门解决一个问题——怎么系统性地写好 Prompt。

核心模式一:Few-Shot Learning

与其解释规则,不如给例子。这是提升输出一致性的王炸手法。

Extract key information from support tickets:
Input: "My login doesn't work and I keep getting error 403"
Output: {"issue": "authentication", "error_code": "403", "priority": "high"}
Input: "Feature request: add dark mode to settings"
Output: {"issue": "feature_request", "error_code": null, "priority": "low"}
Now process: "Can't upload files larger than 10MB, getting timeout"

2-5 个例子,格式一致性直接拉满。生产环境里用来对齐模型输出格式,屡试不爽。

核心模式二:Chain-of-Thought

「让我们一步步思考」——这句话加上去,复杂问题的准确率能提升 30-50%。

Analyze this bug report and determine root cause.
Think step by step:
1. What is the expected behavior?
2. What is the actual behavior?
3. What changed recently that could cause this?
4. What components are involved?
5. What is the most likely root cause?
Bug: "Users can't save drafts after the cache update deployed yesterday"

数学推导、多步逻辑分析必备。谁用谁知道。

核心模式三:渐进式复杂度

不要一上来就写超级复杂 Prompt。先从 Level 1 开始,逐步加约束:

  • Level 1:直接指令 → 「总结这篇文章」
  • Level 2:加约束 → 「用 3 个要点总结,重点是关键发现」
  • Level 3:加推理链 → 「先识别主要发现,再总结」
  • Level 4:加示例 → 附 2-3 个输入输出对

这套方法论被做成 Claude Code Skill 后,你可以在任何 Agent 对话里直接激活使用。

适用场景

  • 写生产级 Prompt 模板(代码审查、客服对话、数据提取)
  • 调教 LLM 输出格式一致性
  • 复杂推理任务(Bug 分析、技术方案设计)
  • 多人协作时统一 Prompt 规范

GitHub 仓库是一个集合,包含 22 个 Claude Code 技能(上下文工程、UX 设计、多 Agent 编排等),prompt-engineering 是其中最核心的一个。

GitHub:https://github.com/rohunvora/my-claude-skills

调教 AI 这件事,真的可以很系统。别再靠感觉了。


GitHub: https://github.com/rohunvora/my-claude-skills

评论区

0 条评论

登录后可评论。

白鹿 1227 阅读