Semantic Kernel Prompts: Complete Guide to All Types with Examples for .NET AI Apps
When building AI-native applications with Semantic Kernel, prompts are the instructions you give to an LLM like GPT-4 to generate intelligent responses.
This post is your complete guide to all prompt types in Semantic Kernel โ including how to define, use, and invoke them in your .NET app.
๐ What is a Prompt in Semantic Kernel?
A prompt is a reusable, structured instruction that tells the AI model what to do. Prompts can be used inside:
- Plugins (skills)
- Agent logic
- Planners
- Workflows
๐ฆ Types of Prompts in Semantic Kernel
Below are all supported types, with examples:
1. ๐งพ Plain Text Prompt
Basic prompts stored inline or in .txt
files.
|
|
๐ File: summarize.skprompt.txt
๐ฅ Input passed using the {{$input}}
placeholder.
โ Best for: Simple templated prompts.
2. โ๏ธ Semantic Function Prompt (C# Inline)
Prompts defined in C# using CreateFunctionFromPrompt
.
|
|
โ Best for: Quick integration into business logic.
3. ๐ง YAML Prompt Template
Advanced prompts with metadata, inputs, defaults, and model configs.
|
|
โ Best for: Structured, reusable prompts with input schemas.
4. ๐ ๏ธ Prompt with System Role (LLM Behavior Control)
You can set the system role using execution settings.
|
|
โ Best for: Controlling model persona or behavior.
5. ๐งฉ Composite Prompt (Chain Multiple Inputs)
|
|
โ Best for: Multi-section emails, reports, or formatted outputs.
6. ๐ Function-Calling Prompt with Plugin Integration
Use a prompt that calls a plugin like MathPlugin
.
|
|
Prompt:
|
|
The LLM auto-selects add(7, 5)
via function calling behind the scenes.
โ Best for: Allowing LLMs to use your business logic.
7. ๐งญ Step Prompt in a Workflow (Process Framework)
Used inside .yaml
workflows:
|
|
โ Best for: Guided multi-step user flows and automations.
โ Pro Tips for Prompt Design
- Use clear, task-specific language
- Add instructions + examples when possible
- Use
{{variable}}
for flexibility - Lower
temperature
for consistency; raise it for creativity - Test different wording with real user inputs
๐ Learn More
๐ฌ Got a unique use-case or prompt format you’re working on? Drop it in the comments or tag me โ let’s learn together!
If this helped you, donโt forget to โค๏ธ, ๐ฆ, or share it with your .NET AI builder friends!