‹ 首页

few-shot-patterns

@owl-listener · 收录于 5 天前 · 上游提交 1 个月前

Crafting examples that steer AI behavior effectively.

适合你,如果需要通过示例让AI更准确地完成任务

/ 通过 npx 安装 校验哈希
npx oh-my-skill add owl-listener/ai-design-skills/few-shot-patterns
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- owl-listener/ai-design-skills/few-shot-patterns
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify owl-listener/ai-design-skills/few-shot-patterns
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
144GitHub stars
~575上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 f41b650 · 表述以原文为准
它做什么

你给Claude一些输入-输出的例子,它会学会这些例子的模式,然后按相同模式处理你的新输入。示例越好,输出越好。

什么时候触发

当你只靠指令说不清楚,需要展示格式、风格或处理特殊情况的例子时,就可以用这个方法。

装好后可以这样说
提供示例后,Claude会模仿格式。
示例展示风格,Claude应用。
示例包含边缘情况,Claude学会区分。
技能原文 SKILL.md作者撰写 · MIT · f41b650

Few-Shot Patterns

Few-shot prompting provides examples of input-output pairs that demonstrate the desired behavior. The AI learns the pattern from the examples and applies it to new inputs. The quality of examples directly determines the quality of outputs.

Why Examples Work

Examples communicate what instructions alone cannot:

  • Implicit patterns: The AI picks up on format, style, and reasoning patterns from examples without being told explicitly
  • Ambiguity resolution: When instructions could be interpreted multiple ways, examples show which interpretation you want
  • Quality calibration: Examples set the bar for output quality, length, and depth
  • Edge case handling: Examples of tricky cases teach the AI how to handle similar situations
Example Design Principles

Diversity: Examples should cover different scenarios, not repeat the same type

  • Include easy cases, hard cases, and edge cases
  • Vary the input format and content
  • Show different valid output formats if applicable

Clarity: Each example should demonstrate one clear pattern

  • Avoid examples that could be interpreted multiple ways
  • Make the mapping from input to output obvious
  • Remove irrelevant variation between examples

Quality: Examples set the ceiling for output quality

  • Every example should be one you'd be happy to ship
  • If the example has a flaw, the AI will replicate that flaw
  • Invest time in crafting examples — they're worth more than instructions

Ordering: The position of examples matters

  • Put the most representative example first
  • Put edge cases after common cases
  • End with an example closest to the expected input type
How Many Examples
  • Zero-shot: No examples. Relies entirely on instructions. Good for simple, well-understood tasks.
  • One-shot: Single example. Enough when the pattern is straightforward.
  • Few-shot (3-5): Multiple examples. Best for complex patterns or nuanced quality requirements.
  • Many-shot (5+): Diminishing returns but useful for highly variable tasks or when consistency is critical.

Balance example count against context window cost. More examples means less room for other context.

Anti-Patterns
  • Identical examples: All examples are basically the same, teaching nothing about variation
  • Perfect-only examples: No examples of how to handle imperfect inputs or edge cases
  • Contradictory examples: Examples that demonstrate inconsistent patterns
  • Low-quality examples: Sloppy examples produce sloppy outputs
  • Outdated examples: Examples that no longer reflect current requirements
Design Artefacts
  • Example libraries per task type
  • Example quality rubrics
  • Example selection guidelines
  • Example maintenance and update schedules
  • Example effectiveness testing results
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。