prompt-engineering
Prompt Engineering Guide
Master prompt engineering for AI models via inference.sh CLI.

Quick Start
Requires inference.sh CLI (
infsh). Install instructions
infsh login
# Well-structured LLM prompt
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."
}'
LLM Prompting
Basic Structure
[Role/Context] + [Task] + [Constraints] + [Output Format]
Role Prompting
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."
}'
Task Clarity
# 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."
Chain-of-Thought
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."
}'
Few-Shot Examples
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?"
}'
Output Format Specification
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."
}'
Constraint Setting
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]"
}'
Image Generation Prompting
Basic Structure
[Subject] + [Style] + [Composition] + [Lighting] + [Technical]
Subject Description
# Bad: vague
"a cat"
# Good: specific
infsh app run falai/flux-dev --input '{
"prompt": "A fluffy orange tabby cat with green eyes, sitting on a vintage leather armchair"
}'
Style Keywords
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"
}'
Composition Control
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"
}'
Quality Keywords
photorealistic, 8K, ultra detailed, sharp focus, professional,
masterpiece, high quality, best quality, intricate details
Negative Prompts
infsh app run falai/flux-dev --input '{
"prompt": "Professional headshot portrait, clean background",
"negative_prompt": "blurry, distorted, extra limbs, watermark, text, low quality, cartoon, anime"
}'
Video Prompting
Basic Structure
[Shot Type] + [Subject] + [Action] + [Setting] + [Style]
Camera Movement
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"
}'
Action Description
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"
}'
Temporal Keywords
slow motion, timelapse, real-time, smooth motion,
continuous shot, quick cuts, frozen moment
Advanced Techniques
System Prompts
infsh 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."
}'
Structured Output
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}"
}'
Iterative Refinement
# Start broad
infsh app run falai/flux-dev --input '{
"prompt": "A castle on a hill"
}'
# Add specifics
infsh app run falai/flux-dev --input '{
"prompt": "A medieval stone castle on a grassy hill"
}'
# Add style
infsh 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
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"
}'
Multi-Turn Reasoning
# First: analyze
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."
}'
# Second: prioritize
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."
}'
# Third: action plan
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."
}'
Model-Specific Tips
Claude
- Excels at nuanced instructions
- Responds well to role-playing
- Good at following complex constraints
- Prefers explicit output formats
GPT-4
- Strong at code generation
- Works well with examples
- Good structured output
- Responds to "let's think step by step"
FLUX
- Detailed subject descriptions
- Style references work well
- Lighting keywords important
- Negative prompts supported
Veo
- Camera movement keywords
- Cinematic language works well
- Action descriptions important
- Include temporal context
Common Mistakes
| Mistake | Problem | Fix |
|---|---|---|
| Too vague | Unpredictable output | Add specifics |
| Too long | Model loses focus | Prioritize key info |
| Conflicting | Confuses model | Remove contradictions |
| No format | Inconsistent output | Specify format |
| No examples | Unclear expectations | Add few-shot |
Prompt Templates
Code Review
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
Content Writing
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]
Image Generation
[Subject with details], [setting/background], [lighting type],
[art style or photography style], [composition], [quality keywords]
Related Skills
# 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
Browse all apps: infsh app list
More from inference-sh/agent-skills
agent-tools
Run 250+ AI apps via inference.sh CLI - image generation, video creation, LLMs, search, 3D, Twitter automation. Models: FLUX, Veo, Gemini, Grok, Claude, Seedance, OmniHuman, Tavily, Exa, OpenRouter, and many more. Use when running AI apps, generating images/videos, calling LLMs, web search, or automating Twitter. Triggers: inference.sh, infsh, ai model, run ai, serverless ai, ai api, flux, veo, claude api, image generation, video generation, openrouter, tavily, exa search, twitter api, grok
44agent-browser
Browser automation for AI agents via inference.sh. Navigate web pages, interact with elements using @e refs, take screenshots, record video. Capabilities: web scraping, form filling, clicking, typing, drag-drop, file upload, JavaScript execution. Use for: web automation, data extraction, testing, agent browsing, research. Triggers: browser, web automation, scrape, navigate, click, fill form, screenshot, browse web, playwright, headless browser, web agent, surf internet, record video
40ai-image-generation
Generate AI images with FLUX, Gemini, Grok, Seedream, Reve and 50+ models via inference.sh CLI. Models: FLUX Dev LoRA, FLUX.2 Klein LoRA, Gemini 3 Pro Image, Grok Imagine, Seedream 4.5, Reve, ImagineArt. Capabilities: text-to-image, image-to-image, inpainting, LoRA, image editing, upscaling, text rendering. Use for: AI art, product mockups, concept art, social media graphics, marketing visuals, illustrations. Triggers: flux, image generation, ai image, text to image, stable diffusion, generate image, ai art, midjourney alternative, dall-e alternative, text2img, t2i, image generator, ai picture, create image with ai, generative ai, ai illustration, grok image, gemini image
33ai-video-generation
Generate AI videos with Google Veo, Seedance, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 1.5 Pro, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, lipsync, avatar animation, video upscaling, foley sound. Use for: social media videos, marketing content, explainer videos, product demos, AI avatars. Triggers: video generation, ai video, text to video, image to video, veo, animate image, video from image, ai animation, video generator, generate video, t2v, i2v, ai video maker, create video with ai, runway alternative, pika alternative, sora alternative, kling alternative
31twitter-automation
Automate Twitter/X with posting, engagement, and user management via inference.sh CLI. Apps: x/post-tweet, x/post-create (with media), x/post-like, x/post-retweet, x/dm-send, x/user-follow. Capabilities: post tweets, schedule content, like posts, retweet, send DMs, follow users, get profiles. Use for: social media automation, content scheduling, engagement bots, audience growth, X API. Triggers: twitter api, x api, tweet automation, post to twitter, twitter bot, social media automation, x automation, tweet scheduler, twitter integration, post tweet, twitter post, x post, send tweet
30javascript-sdk
JavaScript/TypeScript SDK for inference.sh - run AI apps, build agents, integrate 250+ models. Package: @inferencesh/sdk (npm install). Full TypeScript support, streaming, file uploads. Build agents with template or ad-hoc patterns, tool builder API, skills, human approval. Use for: JavaScript integration, TypeScript, Node.js, React, Next.js, frontend apps. Triggers: javascript sdk, typescript sdk, npm install, node.js api, js client, react ai, next.js ai, frontend sdk, @inferencesh/sdk, typescript agent, browser sdk, js integration
30