Skip to content

Prompts

Understanding prompts and prompt engineering in PromptKit.

A prompt is the text input sent to an LLM. It tells the model what to do and provides context for generating a response.

User: What's the capital of France?
LLM Response: The capital of France is Paris.
System: You are a helpful assistant. Be concise.
User: What's the capital of France?
LLM Response: Paris.

Prompts consist of messages with different roles:

  • System: Instructions for the AI’s behavior
  • User: Input from the end user
  • Assistant: Previous AI responses (for context)
  • Tool: Results from function calls

Example in PromptKit:

messages := []types.Message{
{Role: "system", Content: "You are a helpful assistant"},
{Role: "user", Content: "Hello"},
{Role: "assistant", Content: "Hi! How can I help?"},
{Role: "user", Content: "What's 2+2?"},
}

System prompts set the AI’s behavior:

Good system prompt:

You are a customer support agent for TechCorp.
Guidelines:
- Be professional and empathetic
- Keep responses under 100 words
- Reference documentation when possible
- Escalate complex issues to human agents
Available resources:
- Help docs: https://help.techcorp.com
- Status page: https://status.techcorp.com

Poor system prompt:

Be helpful.

Bad:

Write something about dogs.

Good:

Write a 3-sentence summary about Golden Retrievers.
Include: origin, temperament, and typical uses.

Provide examples to guide the model:

Convert user questions to support ticket categories.
Examples:
Q: "I can't log in" → Category: Authentication
Q: "My credit card was declined" → Category: Billing
Q: "The app crashed" → Category: Technical
Q: "I forgot my password" → Category: ?

Ask the model to explain its reasoning:

Solve this math problem step-by-step:
If Alice has 3 apples and Bob gives her 5 more, how many does Alice have?
Let's solve this step by step:
1. Alice starts with: 3 apples
2. Bob gives her: 5 apples
3. Total: 3 + 5 = 8 apples
Answer: 8 apples

Assign a specific role:

You are an experienced software architect reviewing code.
Focus on:
- Design patterns
- Scalability
- Maintainability
Review this code:
[code here]

Runtime uses prompts with templates:

templates := template.NewRegistry()
templates.RegisterTemplate("support", &template.PromptTemplate{
SystemPrompt: "You are a support agent. Be helpful.",
Variables: map[string]string{
"company": "TechCorp",
},
})
pipe := pipeline.NewPipeline(
middleware.TemplateMiddleware(templates, nil),
middleware.ProviderMiddleware(provider, nil, nil, nil),
)
result, _ := pipe.Execute(ctx, "user", "Help me")

SDK simplifies prompt management:

conv := sdk.NewConversation(provider, &sdk.ConversationConfig{
SystemPrompt: "You are a helpful assistant",
Model: "gpt-4o-mini",
})
response, _ := conv.Send(ctx, "Hello")

PackC packages prompts for distribution:

# support.prompt
system: |
You are a for .
Be professional and concise.
user: |

Pack and use:

Terminal window
packc pack prompts/ -o support.pack
pack, _ := packc.LoadPack("support.pack")
template := pack.Templates["support"]

PromptArena tests prompts:

tests:
- name: Support Query
prompt: "How do I reset my password?"
assertions:
- type: contains
value: "password reset"
- type: max_length
value: 200

Be specific - Clear instructions get better results
Provide context - Give the model relevant information
Use examples - Show what you want
Set constraints - Specify format, length, tone
Test variations - Try different phrasings
Version prompts - Track changes over time

Don’t be vague - “Be helpful” isn’t enough
Don’t assume knowledge - Provide necessary context
Don’t skip system prompts - They guide behavior
Don’t ignore length - Longer ≠ better
Don’t forget to test - Use PromptArena

Task: Extract customer email from support ticket
Input: "Hi, my email is john@example.com and I need help"
Output: john@example.com
Input: "Please contact me at support@company.com"
Output:
You are a friendly chatbot. Maintain context across messages.
Be:
- Conversational and warm
- Helpful and informative
- Concise (under 50 words per response)
Analyze the following text and provide:
1. Main topic
2. Sentiment (positive/negative/neutral)
3. Key entities mentioned
4. Confidence score (0-1)
Text: [input]
Write a creative product description for:
Product:
Features:
Target audience:
Style: Engaging and persuasive
Length: 50-100 words
  • Store prompts in version control
  • Use meaningful names
  • Document prompt purpose
  • Track performance metrics
  • Test with PromptArena
  • Try edge cases
  • Measure quality
  • Compare variations
  • Load from PackC files
  • Use templates for flexibility
  • Monitor performance
  • Version prompts

Solution: Add more specific instructions and examples

Solution: Specify exact format in prompt

Before:

List the items.

After:

List the items in JSON format:
{"items": ["item1", "item2"]}

Solution: Emphasize important instructions

IMPORTANT: Always include sources.
NEVER make up information.
[rest of prompt]

Solution: Set length constraints

Answer in exactly 2 sentences. Be concise.

Prompts are the foundation of LLM applications. Good prompts:

  • Provide clear instructions
  • Include relevant context
  • Use examples when helpful
  • Set appropriate constraints
  • Are tested and versioned