llm-prompt-optimizer
Skill này làm gì
Công cụ này cải thiện chỉ dẫn bạn đưa cho trí tuệ nhân tạo (AI). Nó biến yêu cầu mơ hồ thành yêu cầu rõ ràng và hiệu quả, giúp AI hiểu chính xác điều bạn muốn và cho kết quả tốt hơn.
Khi nào nên dùng
- ✓Khi AI đưa ra câu trả lời khó hiểu hoặc sai.
- ✓Khi bạn cần AI trình bày phản hồi theo một định dạng cụ thể (như danh sách hoặc bảng).
- ✓Khi bạn muốn AI trả lời trực tiếp hơn và bớt 'lời thừa'.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/llm-prompt-optimizer/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Cải thiện prompt này cho AI: 'Nói về chó.'”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ phân tích yêu cầu gốc của bạn và áp dụng các kỹ thuật 'prompt engineering' đã biết. Nó bổ sung các chi tiết như AI nên đóng vai trò gì, bối cảnh, quy tắc và cách trình bày phản hồi.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
…
Câu hỏi thường gặp
'Prompt engineering' là gì?
Đó là nghệ thuật viết chỉ dẫn rõ ràng và hiệu quả để trí tuệ nhân tạo hiểu và thực hiện tác vụ theo cách tốt nhất có thể.
Vì sao AI đôi khi 'bịa chuyện' (hallucinate)?
Điều này có thể xảy ra khi yêu cầu chưa đủ rõ ràng hoặc AI không có thông tin chính xác. Các prompt được viết tốt giúp ngăn chặn điều này.
'Tokens' là gì?
Tokens là đơn vị cơ bản mà AI dùng để xử lý văn bản. Prompt ngắn và trực tiếp hơn dùng ít token hơn, có thể tốn ít chi phí hơn.
Chi tiết
Mô tả gốc của tác giả
Use when improving prompts for any LLM. Applies proven prompt engineering techniques to boost output quality, reduce hallucinations, and cut token usage.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #5089
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
writing-skills
311kDạy agent của bạn viết skill mới và kiểm thử từng skill trước, kiểm tra xem skill có thực sự thay đổi cách agent hành xử hay không.
writing-for-agents
310kGiải thích cách viết hướng dẫn rõ ràng cho agent AI, gồm skill, tệp AGENTS.md và CLAUDE.md, để agent cư xử nhất quán.
bengali-nlp
280kGiúp agent của bạn xử lý văn bản tiếng Bengali, hỗ trợ hiểu ngôn ngữ này, chuẩn hóa văn bản và xử lý các đặc điểm riêng của nó.