prompt-engineering-patterns by sickn33/antigravity-awesome-skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill prompt-engineering-patterns掌握高级提示工程技术,以最大化大型语言模型的性能、可靠性和可控性。
resources/implementation-playbook.md。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
from prompt_optimizer import PromptTemplate, FewShotSelector
# 定义结构化提示模板
template = PromptTemplate(
system="You are an expert SQL developer. Generate efficient, secure SQL queries.",
instruction="Convert the following natural language query to SQL:\n{query}",
few_shot_examples=True,
output_format="SQL code block with explanatory comments"
)
# 配置少样本学习
selector = FewShotSelector(
examples_db="sql_examples.jsonl",
selection_strategy="semantic_similarity",
max_examples=3
)
# 生成优化后的提示
prompt = template.render(
query="Find all users who registered in the last 30 days",
examples=selector.select(query="user registration date filter")
)
从简单的提示开始,仅在需要时增加复杂性:
级别 1:直接指令
级别 2:添加约束
级别 3:添加推理
级别 4:添加示例
[System Context] → [Task Instruction] → [Examples] → [Input Data] → [Output Format]
构建能够优雅处理失败的提示:
# 将检索到的上下文与提示工程相结合
prompt = f"""Given the following context:
{retrieved_context}
{few_shot_examples}
Question: {user_question}
Provide a detailed answer based solely on the context above. If the context doesn't contain enough information, explicitly state what's missing."""
# 添加自我验证步骤
prompt = f"""{main_task_prompt}
After generating your response, verify it meets these criteria:
1. Answers the question directly
2. Uses only information from provided context
3. Cites specific sources
4. Acknowledges any uncertainty
If verification fails, revise your response."""
为你的提示跟踪以下关键绩效指标:
每周安装量
173
代码仓库
GitHub 星标数
27.4K
首次出现
2026年1月28日
安全审计
安装于
opencode159
gemini-cli157
github-copilot151
codex150
cursor142
kimi-cli139
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability.
resources/implementation-playbook.md.from prompt_optimizer import PromptTemplate, FewShotSelector
# Define a structured prompt template
template = PromptTemplate(
system="You are an expert SQL developer. Generate efficient, secure SQL queries.",
instruction="Convert the following natural language query to SQL:\n{query}",
few_shot_examples=True,
output_format="SQL code block with explanatory comments"
)
# Configure few-shot learning
selector = FewShotSelector(
examples_db="sql_examples.jsonl",
selection_strategy="semantic_similarity",
max_examples=3
)
# Generate optimized prompt
prompt = template.render(
query="Find all users who registered in the last 30 days",
examples=selector.select(query="user registration date filter")
)
Start with simple prompts, add complexity only when needed:
Level 1 : Direct instruction
Level 2 : Add constraints
Level 3 : Add reasoning
Level 4 : Add examples
[System Context] → [Task Instruction] → [Examples] → [Input Data] → [Output Format]
Build prompts that gracefully handle failures:
# Combine retrieved context with prompt engineering
prompt = f"""Given the following context:
{retrieved_context}
{few_shot_examples}
Question: {user_question}
Provide a detailed answer based solely on the context above. If the context doesn't contain enough information, explicitly state what's missing."""
# Add self-verification step
prompt = f"""{main_task_prompt}
After generating your response, verify it meets these criteria:
1. Answers the question directly
2. Uses only information from provided context
3. Cites specific sources
4. Acknowledges any uncertainty
If verification fails, revise your response."""
Track these KPIs for your prompts:
Weekly Installs
173
Repository
GitHub Stars
27.4K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode159
gemini-cli157
github-copilot151
codex150
cursor142
kimi-cli139
AI 代码实施计划编写技能 | 自动化开发任务分解与 TDD 流程规划工具
49,000 周安装
网站可抓取性优化指南:robots.txt、网站结构、内部链接与AI爬虫优化
328 周安装
customaize-agent:create-command - 创建与管理AI助手命令的元命令工具
327 周安装
鱼骨图因果分析工具 - 系统化问题根源诊断与解决方案优先级排序
333 周安装
会话记录器:自动保存AI对话历史到Markdown文件,提升开发与知识管理效率
331 周安装
iOS应用自动化截图与上传流程:Xcode构建、AXe驱动、asc上传全攻略
331 周安装
NeuralMemory记忆演化专家:AI智能体记忆优化、性能调优与知识库管理工具
333 周安装