prompting

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompting Skill

提示工程技能

When to Activate This Skill

何时启用此技能

  • Prompt engineering questions
  • Context engineering guidance
  • AI agent design
  • Prompt structure help
  • Best practices for LLM prompts
  • Agent configuration
  • 提示工程相关问题
  • 上下文工程指导
  • AI Agent设计
  • 提示结构优化帮助
  • LLM提示最佳实践
  • Agent配置

Core Philosophy

核心哲学

Context engineering = Curating optimal set of tokens during LLM inference
Primary Goal: Find smallest possible set of high-signal tokens that maximize desired outcomes
上下文工程 = 在LLM推理过程中筛选最优token集合
核心目标:找到最小规模的高信号token集合,以最大化预期结果

Key Principles

关键原则

1. Context is Finite Resource

1. 上下文是有限资源

  • LLMs have limited "attention budget"
  • Performance degrades as context grows
  • Every token depletes capacity
  • Treat context as precious
  • LLMs的“注意力预算”有限
  • 随着上下文规模扩大,性能会下降
  • 每个token都会消耗注意力容量
  • 需将上下文视为宝贵资源

2. Optimize Signal-to-Noise

2. 优化信噪比

  • Clear, direct language over verbose explanations
  • Remove redundant information
  • Focus on high-value tokens
  • 使用清晰、直接的语言,避免冗长解释
  • 移除冗余信息
  • 聚焦高价值token

3. Progressive Discovery

3. 渐进式信息发现

  • Use lightweight identifiers vs full data dumps
  • Load detailed info dynamically when needed
  • Just-in-time information loading
  • 使用轻量级标识符替代完整数据转储
  • 在需要时动态加载详细信息
  • 实时按需加载信息

Markdown Structure Standards

Markdown结构标准

Use clear semantic sections:
  • Background Information: Minimal essential context
  • Instructions: Imperative voice, specific, actionable
  • Examples: Show don't tell, concise, representative
  • Constraints: Boundaries, limitations, success criteria
使用清晰的语义化章节:
  • 背景信息:仅保留必要的最小上下文
  • 指令:使用祈使语气,具体且可执行
  • 示例:用示例展示而非文字说明,简洁且具有代表性
  • 约束条件:明确边界、限制与成功标准

Writing Style

写作风格

Clarity Over Completeness

清晰度优先于完整性

✅ Good: "Validate input before processing" ❌ Bad: "You should always make sure to validate..."
✅ 优秀示例:"处理前验证输入" ❌ 反面示例:"你应该始终确保去验证……"

Be Direct

直接明确

✅ Good: "Use calculate_tax tool with amount and jurisdiction" ❌ Bad: "You might want to consider using..."
✅ 优秀示例:"使用calculate_tax工具,传入amount和jurisdiction参数" ❌ 反面示例:"你可能需要考虑使用……"

Use Structured Lists

使用结构化列表

✅ Good: Bulleted constraints ❌ Bad: Paragraph of requirements
✅ 优秀示例:项目符号形式的约束条件 ❌ 反面示例:大段文字描述的需求

Context Management

上下文管理

Just-in-Time Loading

实时按需加载

Don't load full data dumps - use references and load when needed
不要加载完整数据转储——使用引用并在需要时加载

Structured Note-Taking

结构化笔记记录

Persist important info outside context window
将重要信息存储在上下文窗口之外

Sub-Agent Architecture

子Agent架构

Delegate subtasks to specialized agents with minimal context
将子任务委托给具备最小上下文的专用Agent

Best Practices Checklist

最佳实践检查表

  • Uses Markdown headers for organization
  • Clear, direct, minimal language
  • No redundant information
  • Actionable instructions
  • Concrete examples
  • Clear constraints
  • Just-in-time loading when appropriate
  • 使用Markdown标题进行组织
  • 语言清晰、直接、简洁
  • 无冗余信息
  • 指令可执行
  • 示例具体
  • 约束条件明确
  • 适时采用实时按需加载

Anti-Patterns

反模式

❌ Verbose explanations ❌ Historical context dumping ❌ Overlapping tool definitions ❌ Premature information loading ❌ Vague instructions ("might", "could", "should")
❌ 冗长的解释 ❌ 历史上下文无差别转储 ❌ 工具定义重叠 ❌ 提前加载不必要的信息 ❌ 模糊的指令(使用“可能”“也许”“应该”等词汇)

Supplementary Resources

补充资源

For full standards:
read ${PAI_DIR}/skills/prompting/CLAUDE.md
完整标准请查看:
read ${PAI_DIR}/skills/prompting/CLAUDE.md

Based On

基于

Anthropic's "Effective Context Engineering for AI Agents"
Anthropic的《AI Agent有效上下文工程指南》