技能 prompt-engineering-patterns
📝

prompt-engineering-patterns

安全

應用提示工程模式

也可从以下获取: wshobson

使用經過驗證的提示工程技術來改善 LLM 輸出。本技能提供思維鏈推理、少量學習和模板系統的模式,使 AI 互動更加可靠且可控。

支持: Claude Codex Code(CC)
🥇 85 黄金
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“prompt-engineering-patterns”。 Design a prompt that helps users write professional emails

预期结果:

具有角色定義、語氣指南和格式部分的結構化電子郵件撰寫模板,可產生一致、專業的電子郵件輸出。

正在使用“prompt-engineering-patterns”。 How can I improve code review quality with AI?

预期结果:

一個少量樣本提示,提供程式碼審查範例,其中包含常見錯誤模式、安全考量和最佳實踐,引導 AI 提供徹底且具建設性的回饋。

安全审计

安全
v1 • 2/24/2026

All 216 static findings are false positives. The flagged files are markdown documentation (.md) and example JSON files containing educational content about prompt engineering techniques. The scanner incorrectly interprets backticks in markdown code blocks as shell commands, text references to cryptographic terms as weak crypto implementations, and tutorial references to system commands as reconnaissance. This is a documentation skill with no executable security issues.

9
已扫描文件
2,696
分析行数
4
发现项
1
审计总数
低风险问题 (4)
False Positive: Ruby/Shell Backtick Detection in Documentation
Static scanner flagged 170 instances of 'Ruby/shell backtick execution' in markdown files. These are false positives - the backticks are markdown code block delimiters showing Python/code examples in documentation, not actual shell commands. Files affected: SKILL.md, references/*.md, assets/*.md
False Positive: Weak Cryptographic Algorithm References
Static scanner flagged 39 instances of 'Weak cryptographic algorithm' in documentation files. These are false positives - the files contain educational content explaining prompt engineering patterns, with text examples mentioning cryptographic concepts in context of AI safety, not actual crypto implementations.
False Positive: System/Network Reconnaissance in Tutorials
Static scanner flagged 'System reconnaissance' and 'Network reconnaissance' patterns in markdown documentation. These are false positives - the files contain educational tutorials that reference system commands and networking concepts as part of prompt engineering examples, not actual reconnaissance tools.
False Positive: Filesystem Path Traversal in Documentation
Static scanner flagged 'Path traversal sequence' in references/prompt-optimization.md and scripts/optimize-prompt.py. The markdown file contains text explaining path handling concepts in prompts. The Python script is a utility for prompt optimization with legitimate file operations.
审计者: claude

质量评分

82
架构
100
可维护性
87
内容
47
社区
97
安全
100
规范符合性

你能构建什么

構建可靠的 AI 產品

為 AI 驅動的應用程式設計具有一致輸出格式和錯誤處理模式的生產就緒提示系統。

改善程式碼生成

應用結構化提示技術,從 Claude 或 Codex 獲得更好的程式碼補全和生成結果。

建立 AI 培訓教材

開發全面的提示庫和模板,以促進團隊範圍內的 AI 採用和最佳實踐。

试试这些提示

思維鏈推理
Solve this problem step by step:

Problem: {problem}

Think through each step carefully:
1. [First step]
2. [Second step]
3. [Third step]

Final answer:
少量樣本分類
Classify the following input into one of these categories: {categories}

Examples:
{examples}

Now classify this:
Input: {input}

Category:
系統提示模板
You are {role}. Your task is {task}.

Guidelines:
- {guideline1}
- {guideline2}
- {guideline3}

Output format:
{output_format}
迭代優化
Initial request: {request}

Current draft: {draft}

Feedback to address:
{feedback}

Please revise the draft based on this feedback:

最佳实践

  • 在系統提示中從清晰的角色定義開始,以建立 AI 行為邊界
  • 在少量樣本提示中使用涵蓋邊緣案例的具體、多樣化範例
  • 測試多個查詢變體的提示,以確保一致的輸出

避免

  • 使用模糊的指令如「要有幫助」而沒有具體的行為指南
  • 用過多的範例使提示過載,超出上下文視窗限制
  • 假設提示在不同 LLM 模型上能以相同方式運作而未經測試

常见问题

什麼是思維鏈提示?
思維鏈提示鼓勵 LLMs 逐步展示其推理過程,提高複雜數學、邏輯和推理任務的準確性。
少量學習應該包含多少個範例?
大多數任務使用 2-5 個範例效果良好。在上下文視窗限制下平衡範例多樣性。過多的範例會降低回覆品質。
我可以將這些模式與 Claude Code 一起使用嗎?
是的,這些模式適用於 Claude、Claude Code、Codex 和大多數現代 LLM。Claude Code 可以直接執行提示模板。
如何調試產生不一致輸出的提示?
新增明確的輸出格式約束,包含更多多樣化的範例,並使用逐步推理使 AI 處理過程更加透明。
系統提示和用戶提示有什麼區別?
系統提示在對話開始時定義 AI 助手的角色和行為。用戶提示包含每次互動的具體任務或問題。
如何處理提示注入風險?
使用清晰的指令邊界,驗證用戶輸入,並避免將不受信任的內容直接連接到提示中。使用不同部分結構化提示,分離指令和用戶數據。