Loading...
Loading...
精通AI模型的提示词工程:涵盖LLM、图像生成器、视频模型。相关技术:思维链、少样本提示、系统提示词、负面提示词。涉及模型:Claude、GPT-4、Gemini、FLUX、Veo、Stable Diffusion提示词。用途:获得更优质的AI输出、一致的结果、处理复杂任务、优化性能。相关关键词:提示词工程、提示词编写方法、优质提示词、提示词技巧、提示词指南、LLM提示词、图像提示词、AI提示词、提示词优化、提示词模板、提示词结构、高效提示词、提示词技术
npx skill4agent add skill-zero/s prompt-engineering
curl -fsSL https://cli.inference.sh | sh && infsh login
# 结构清晰的LLM提示词
infsh 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."
}'[角色/上下文] + [任务] + [约束条件] + [输出格式]infsh 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."
}'# 反面示例:模糊
"Help me with my code"
# 正面示例:具体
"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."infsh 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."
}'infsh 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?"
}'infsh 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."
}'infsh 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]"
}'[主体] + [风格] + [构图] + [光线] + [技术参数]# 反面示例:模糊
"a cat"
# 正面示例:具体
infsh app run falai/flux-dev --input '{
"prompt": "A fluffy orange tabby cat with green eyes, sitting on a vintage leather armchair"
}'infsh 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"
}'infsh 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 detailsinfsh app run falai/flux-dev --input '{
"prompt": "Professional headshot portrait, clean background",
"negative_prompt": "blurry, distorted, extra limbs, watermark, text, low quality, cartoon, anime"
}'[镜头类型] + [主体] + [动作] + [场景] + [风格]infsh 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"
}'infsh 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 momentinfsh 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."
}'infsh 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}"
}'# 初始版本:宽泛
infsh app run falai/flux-dev --input '{
"prompt": "A castle on a hill"
}'
# 添加细节
infsh app run falai/flux-dev --input '{
"prompt": "A medieval stone castle on a grassy hill"
}'
# 添加风格
infsh app run falai/flux-dev --input '{
"prompt": "A medieval stone castle on a grassy hill, dramatic sunset sky, fantasy art style, epic composition"
}'
# 添加技术参数
infsh 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"
}'# 第一步:分析
infsh 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."
}'
# 第二步:优先级排序
infsh 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."
}'
# 第三步:行动计划
infsh 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."
}'| 错误类型 | 问题 | 解决方法 |
|---|---|---|
| 过于模糊 | 输出不可预测 | 添加细节 |
| 过于冗长 | 模型失去焦点 | 优先保留关键信息 |
| 相互矛盾 | 让模型困惑 | 移除矛盾内容 |
| 未指定格式 | 输出不一致 | 明确指定格式 |
| 未提供示例 | 期望不清晰 | 添加少样本示例 |
审查这段[语言]代码,重点关注:
1. 漏洞和逻辑错误
2. 安全隐患
3. 性能问题
4. 代码风格/最佳实践
代码:
[code]
针对发现的每个问题,提供:
- 行号
- 问题描述
- 严重程度(高/中/低)
- 修复建议撰写一篇[内容类型]关于[主题]。
受众:[目标受众]
语气:[正式/随意/专业]
篇幅:[字数]
需涵盖的关键点:
1. [要点1]
2. [要点2]
3. [要点3]
需包含:[特定元素]
需避免:[排除内容][带细节的主体], [场景/背景], [光线类型],
[艺术风格或摄影风格], [构图], [画质关键词]# 视频提示词指南
npx skills add inference-sh/skills@video-prompting-guide
# LLM模型
npx skills add inference-sh/skills@llm-models
# 图像生成
npx skills add inference-sh/skills@ai-image-generation
# 完整平台技能
npx skills add inference-sh/skills@inference-shinfsh app list