关于 prompt-engineering
这是一项通过 inference.sh CLI 为 LLM、图像和视频生成编写提示词的指南技能,涵盖提示词结构、技巧、模板及模型专属建议。
主要功能
- 01提示词结构与约束设置
- 02角色提示与少样本示例
- 03图像和视频提示词模式
- 04系统提示与结构化输出
- 05模型专属提示建议
适用场景
- 01编写代码审查或分析提示词
- 02构思含构图细节的图像提示词
- 03描述视频镜头和摄像机运动
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ inference-sh/ skills --skill prompt-engineering安装后在 Claude Code 中输入/prompt-engineering确认已加载。
详细介绍
安装 belt CLI 技能:
npx skills add belt-sh/cli
提示词工程指南
通过 inference.sh CLI 掌握 AI 模型的提示词工程。

快速开始
需要 inference.sh CLI(
belt)。安装说明
belt login
# Well-structured LLM prompt
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "You are a senior software engineer. Review this code for security vulnerabilities:\n\n```python\nuser_input = request.args.get(\"query\")\nresult = db.execute(f\"SELECT * FROM users WHERE name = {user_input}\")\n```\n\nProvide specific issues and fixes."
}'
大模型提示
基本结构
[Role/Context] + [Task] + [Constraints] + [Output Format]
角色提示
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "You are an expert data scientist with 15 years of experience in machine learning. Explain gradient descent to a beginner, using simple analogies."
}'
明确任务
# Bad: vague
"Help me with my code"
# Good: specific
"Debug this Python function that should return the sum of even numbers from a list, but returns 0 for all inputs:
def sum_evens(numbers):
total = 0
for n in numbers:
if n % 2 == 0:
total += n
return total
Identify the bug and provide the corrected code."
思维链
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "Solve this step by step:\n\nA store sells apples for $2 each and oranges for $3 each. If someone buys 5 fruits and spends $12, how many of each fruit did they buy?\n\nThink through this step by step before giving the final answer."
}'
少样本示例
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "Convert these sentences to formal business English:\n\nExample 1:\nInput: gonna send u the report tmrw\nOutput: I will send you the report tomorrow.\n\nExample 2:\nInput: cant make the meeting, something came up\nOutput: I apologize, but I will be unable to attend the meeting due to an unforeseen circumstance.\n\nNow convert:\nInput: hey can we push the deadline back a bit?"
}'
输出格式规范
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "Analyze the sentiment of these customer reviews. Return a JSON array with objects containing \"text\", \"sentiment\" (positive/negative/neutral), and \"confidence\" (0-1).\n\nReviews:\n1. \"Great product, fast shipping!\"\n2. \"Meh, its okay I guess\"\n3. \"Worst purchase ever, total waste of money\"\n\nReturn only valid JSON, no explanation."
}'
设定约束
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "Summarize this article in exactly 3 bullet points. Each bullet must be under 20 words. Focus only on actionable insights, not background information.\n\n[article text]"
}'
图像生成提示
基本结构
[Subject] + [Style] + [Composition] + [Lighting] + [Technical]
主体描述
# Bad: vague
"a cat"
# Good: specific
belt app run falai/flux-dev --input '{
"prompt": "A fluffy orange tabby cat with green eyes, sitting on a vintage leather armchair"
}'
风格关键词
belt app run falai/flux-dev --input '{
"prompt": "Portrait photograph of a woman, shot on Kodak Portra 400 film, soft natural lighting, shallow depth of field, nostalgic mood, analog photography aesthetic"
}'
构图控制
belt app run falai/flux-dev --input '{
"prompt": "Wide establishing shot of a cyberpunk city skyline at night, rule of thirds composition, neon signs in foreground, towering skyscrapers in background, rain-slicked streets"
}'
质量关键词
photorealistic, 8K, ultra detailed, sharp focus, professional,
masterpiece, high quality, best quality, intricate details
负面提示词
belt app run falai/flux-dev --input '{
"prompt": "Professional headshot portrait, clean background",
"negative_prompt": "blurry, distorted, extra limbs, watermark, text, low quality, cartoon, anime"
}'
视频提示
基本结构
[Shot Type] + [Subject] + [Action] + [Setting] + [Style]
摄像机运动
belt app run google/veo-3-1-fast --input '{
"prompt": "Slow tracking shot following a woman walking through a sunlit forest, golden hour lighting, shallow depth of field, cinematic, 4K"
}'
动作描述
belt app run google/veo-3-1-fast --input '{
"prompt": "Close-up of hands kneading bread dough on a wooden surface, flour dust floating in morning light, slow motion, cozy baking aesthetic"
}'
时间关键词
slow motion, timelapse, real-time, smooth motion,
continuous shot, quick cuts, frozen moment
高级技巧
系统提示词
belt app run openrouter/claude-sonnet-45 --input '{
"system": "You are a helpful coding assistant. Always provide code with comments. If you are unsure about something, say so rather than guessing.",
"prompt": "Write a Python function to validate email addresses using regex."
}'
结构化输出
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "Extract information from this text and return as JSON:\n\n\"John Smith, CEO of TechCorp, announced yesterday that the company raised $50 million in Series B funding. The round was led by Venture Partners.\"\n\nSchema:\n{\n \"person\": string,\n \"title\": string,\n \"company\": string,\n \"event\": string,\n \"amount\": string,\n \"investor\": string\n}"
}'
迭代优化
# Start broad
belt app run falai/flux-dev --input '{
"prompt": "A castle on a hill"
}'
# Add specifics
belt app run falai/flux-dev --input '{
"prompt": "A medieval stone castle on a grassy hill"
}'
# Add style
belt app run falai/flux-dev --input '{
"prompt": "A medieval stone castle on a grassy hill, dramatic sunset sky, fantasy art style, epic composition"
}'
# Add technical
belt app run falai/flux-dev --input '{
"prompt": "A medieval stone castle on a grassy hill, dramatic sunset sky, fantasy art style by Greg Rutkowski, epic composition, 8K, highly detailed"
}'
多轮推理
# First: analyze
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "Analyze this business problem: Our e-commerce site has a 70% cart abandonment rate. List potential causes."
}'
# Second: prioritize
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "Given these causes of cart abandonment: [previous output], rank them by likely impact and ease of fixing. Format as a priority matrix."
}'
# Third: action plan
belt app run openrouter/claude-sonnet-45 --input '{
"prompt": "For the top 3 causes identified, provide specific A/B tests we can run to validate and fix each issue."
}'
特定模型的技巧
Claude
- 擅长理解细致的指令
- 对角色扮演响应良好
- 善于遵循复杂约束
- 偏好明确的输出格式
GPT-4
- 擅长代码生成
- 能很好地利用示例
- 擅长结构化输出
- 对“让我们一步一步思考”这类提示有响应
FLUX
- 详细描述主体
- 风格参考效果良好
- 光照关键词很重要
- 支持负面提示词
Veo
- 使用摄像机运动关键词
- 电影化语言效果良好
- 动作描述很重要
- 加入时间背景
常见错误
| 错误 | 问题 | 修正方法 |
|---|---|---|
| 过于含糊 | 输出不可预测 | 补充具体信息 |
| 过于冗长 | 模型容易偏离重点 | 优先提供关键信息 |
| 相互矛盾 | 令模型困惑 | 删除矛盾内容 |
| 未指定格式 | 输出不一致 | 指定格式 |
| 没有示例 | 预期不明确 | 添加少样本示例 |
提示词模板
代码审查
Review this [language] code for:
1. Bugs and logic errors
2. Security vulnerabilities
3. Performance issues
4. Code style/best practices
Code:
[code]
For each issue found, provide:
- Line number
- Issue description
- Severity (high/medium/low)
- Suggested fix
内容创作
Write a [content type] about [topic].
Audience: [target audience]
Tone: [formal/casual/professional]
Length: [word count]
Key points to cover:
1. [point 1]
2. [point 2]
3. [point 3]
Include: [specific elements]
Avoid: [things to exclude]
图像生成
[Subject with details], [setting/background], [lighting type],
[art style or photography style], [composition], [quality keywords]
相关技能
# Video prompting guide
npx skills add inference-sh/skills@video-prompting-guide
# LLM models
npx skills add inference-sh/skills@llm-models
# Image generation
npx skills add inference-sh/skills@ai-image-generation
# Full platform skill
npx skills add inference-sh/skills@infsh-cli
浏览所有应用:belt app list
评论
支持 Markdown