![AI Code Review Image]()
Introduction
In Part 2, we built a modular AI Agent architecture with reusable skills.
However, there was still one major problem:
Prompt logic was hardcoded in C#.
This becomes difficult to maintain as the number of skills grows.
Modern AI Agent systems solve this by moving prompts into external markdown-based skill files.
This creates:
In this article, we’ll connect skills.md files to our C# AI Agent.
What Is skills.md?
A skills.md file defines:
Purpose
Rules
Instructions
Examples
Expected outputs
Example:
# Code Review Skill
You are a senior C# code reviewer.
Review ONLY the changed code.
Focus on:
- Bugs
- Security
- Performance
Git Diff:
{{GIT_DIFF}}
This becomes a reusable AI capability.
Recommended Folder Structure
/Skills
/code-review.md
/security-review.md
/fix-generator.md
Step 1 — Load Skill File
public class SkillLoader
{
public static string LoadSkill(string skillName)
{
string path = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"Skills",
$"{skillName}.md");
return File.ReadAllText(path);
}
}
Step 2 — Replace Variables
public static class PromptBuilder
{
public static string Build(
string template,
Dictionary<string, string> variables)
{
foreach (var variable in variables)
{
template = template.Replace(
$"{{{{{variable.Key}}}}}",
variable.Value);
}
return template;
}
}
Step 3 — Build Dynamic Prompt
string template =
SkillLoader.LoadSkill("code-review");
string diff =
await GitHelper.GetDiffAsync();
string prompt =
PromptBuilder.Build(
template,
new Dictionary<string, string>
{
["GIT_DIFF"] = diff
});
Now prompts are completely externalized.
Step 4 — Send to LLM
string result =
await aiService.ReviewAsync(prompt);
Console.WriteLine(result);
Benefits of skills.md
Reusable Skills
The same skill can be used by:
VS Code
PR Review
CLI Tools
CI/CD Pipelines
Easier Prompt Engineering
Prompt updates no longer require code changes.
Better Agent Planning
Agents can dynamically select skills.
Example:
If auth files changed
→ Use security-review.md
Versioning
Prompts become version-controlled assets.
Recommended Enterprise Structure
/Skills
/CodeReview
skill.md
examples.md
config.json
/SecurityReview
skill.md
/FixGenerator
skill.md
Final Thoughts
Across this 3-part series, we built a complete evolution path:
Part 1
Part 2
Part 3
This architecture provides:
Modularity
Scalability
Maintainability
Reusable AI capabilities
The future of developer tooling is moving toward intelligent AI Agents that:
And C# provides an excellent ecosystem for building these systems at enterprise scale.
Summary
This article demonstrated how to externalize AI prompts using skills.md files in a C# AI Agent architecture. By moving prompt logic outside the application code, developers can build modular, reusable, maintainable, and scalable AI systems with better prompt management, easier updates, and improved enterprise-level flexibility.