跳到正文
Skillpedia
提示词与 LLM48k · #5089

llm-prompt-optimizer

它能做什么

这个工具可以优化你给人工智能(AI)的指令。它能把模糊的请求变得清晰、高效,确保 AI 准确理解你的需求,并给出更好的结果。

适用场景

  • ✓当 AI 给出令人困惑或错误的回答时。
  • ✓当你需要 AI 以特定格式(比如列表或表格)输出内容时。
  • ✓当你希望 AI 说话更直接,少说一些“废话”时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/llm-prompt-optimizer/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/llm-prompt-optimizer/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“帮我优化下面这条给 AI 的提示词:“聊聊狗。””

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会分析你的原始请求,并运用已知的“提示词工程”技巧。它会补充一些细节,比如 AI 应该扮演什么角色、需要哪些背景信息、遵守哪些规则,以及回答应该采用什么格式。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

LLM Prompt Optimizer

Overview

This skill transforms weak, vague, or inconsistent prompts into precision-engineered instructions that reliably produce high-quality outputs from any LLM (Claude, Gemini, GPT-4, Llama, etc.). It applies systematic prompt engineering frameworks — from zero-shot to few-shot, chain-of-thought, and structured output patterns.

When to Use This Skill

  • Use when a prompt returns inconsistent, vague, or hallucinated results
  • Use when you need structured/JSON output from an LLM reliably
  • Use when designing system prompts for AI agents or chatbots
  • Use when you want to reduce token usage without sacrificing quality
  • Use when implementing chain-of-thought reasoning for complex tasks
  • Use when prompts work on one model but fail on another

Step-by-Step Guide

1. Diagnose the Weak Prompt

Before optimizing, identify which problem pattern applies:

Problem Symptom Fix
Too vague Generic, unhelpful answers Add role + context + constraints
No structure Unformatted, hard-to-parse output Specify output format explicitly
Hallucination Confident wrong answers Add "say I don't know if unsure"
Inconsistent Different answers each run Add few-shot examples
Too long Verbose, padded responses Add length constraints

2. Apply the RSCIT Framework

Every optimized prompt should have:

  • R — Role: Who is the AI in this interaction?
  • S — Situation: What context does it need?
  • C — Constraints: What are the rules and limits?
  • I — Instructions: What exactly should it do?
  • T — Template: What should the output look like?

Before (weak prompt):

Explain machine learning.

After (optimized prompt):

You are a senior ML engineer explaining concepts to a junior developer.

Context: The developer has 1 year of Python experience but no ML background.

Task: Explain supervised machine learning in simple terms.

Constraints:
- Use an analogy from everyday life
- Maximum 200 words
- No mathematical formulas
- End with one actionable next step

Format: Plain prose, no bullet points.

3. Chain-of-Thought (CoT) Pattern

For reasoning tasks, instruct the model to think step-by-step:

Solve this problem step by step, showing your work at each stage.
Only provide the final answer after completing all reasoning steps.

Problem: [your problem here]

Thinking process:
Step 1: [identify what's given]
Step 2: [identify what's needed]
Step 3: [apply logic or formula]
Step 4: [verify the answer]

Final Answer:

4. Few-Shot Examples Pattern

Provide 2-3 examples to establish the pattern:

Classify the sentiment of customer reviews as POSITIVE, NEGATIVE, or NEUTRAL.

Examples:
Review: "This product exceeded my expectations!" -> POSITIVE
Review: "It arrived broken and support was useless." -> NEGATIVE  
Review: "Product works as described, nothing special." -> NEUTRAL

Now classify:
Review: "[your review here]" ->

5. Structured JSON Output Pattern

Extract the following information from the text below and return it as valid JSON only.
Do not include any explanation or markdown — just the raw JSON object.

Schema:
{
  "name": string,
  "email": string | null,
  "company": string | null,
  "role": string | null
}

Text: [input text here]

6. Reduce Hallucination Pattern

Answer the following question based ONLY on the provided context.
If the answer is not contained in the context, respond with exactly: "I don't have enough information to answer this."
Do not make up or infer information not present in the context.

Context:
[your context here]

Question: [your question here]

7. Prompt Compression Techniques

Reduce token count without losing effectiveness:

# Verbose (expensive)
"Please carefully analyze the following code and provide a detailed explanation of 
what it does, how it works, and any potential issues you might find."

# Compressed (efficient, same quality)
"Analyze this code: explain what it does, how it works, and flag any issues."

Best Practices

  • ✅ Do: Always specify the output format (JSON, markdown, plain text, bullet list)
  • ✅ Do: Use delimiters (```, ---) to separate instructions from content
  • ✅ Do: Test prompts with edge cases (empty input, unusual data)
  • ✅ Do: Version your system prompts in source control

…

常见问题

什么是“提示词工程”?

它是一门编写清晰、有效指令的技巧,让人工智能能够理解任务,并以最佳方式完成任务。

为什么 AI 有时会“编造”内容(也就是幻觉)?

当请求不够清楚,或者 AI 没有掌握正确的信息时,就可能出现这种情况。精心设计的提示词有助于避免这个问题。

什么是 Token?

Token 是 AI 处理文本时使用的基本单位。提示词越简短、越直接,消耗的 Token 就越少,成本也可能更低。

详情

作者的原始描述

Use when improving prompts for any LLM. Applies proven prompt engineering techniques to boost output quality, reduce hallucinations, and cut token usage.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5089
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能