Table of Contents

Understanding Agent Skills in LM-Kit.NET


TL;DR

Agent Skills is an open standard for defining modular, reusable AI capabilities through structured instruction files. In LM-Kit.NET, skills are loaded via AgentSkill and managed through the SkillRegistry, enabling agents to dynamically acquire specialized behaviors, domain expertise, or workflow capabilities without code changes. Skills follow a progressive disclosure pattern using SKILL.md files that combine YAML metadata with Markdown instructions.


What are Agent Skills?

Definition: Agent Skills represent a standardized approach to packaging AI agent capabilities as portable, self-contained instruction sets. Each skill defines what an agent can do, how it should behave, and what tools or context it needs, all expressed in a format that both humans and AI systems can understand.

The Agent Skills standard emerged from the need to share and reuse agent behaviors across different systems, models, and platforms. Rather than hardcoding agent capabilities into application logic, skills externalize these definitions into structured files that can be version-controlled, shared, and composed.


The SKILL.md File Format

Agent Skills use a simple but powerful file format that combines:

YAML Frontmatter (Metadata)

---
name: Code Review Assistant
description: Reviews code for bugs, security issues, and best practices
version: 1.0.0
author: LM-Kit
tags: [development, code-review, security]
tools:
  - file_system
  - code_analysis
context:
  - programming_languages
  - security_guidelines
---

Markdown Body (Instructions)

The body contains natural language instructions that guide agent behavior:

# Code Review Assistant

## Your Role
You are an expert code reviewer with deep knowledge of software engineering best practices, security vulnerabilities, and clean code principles.

## Guidelines
1. Focus on actionable feedback, not stylistic preferences
2. Prioritize security issues over minor optimizations
3. Explain the "why" behind each suggestion

## Review Process
- First, understand the code's purpose
- Identify potential bugs and edge cases
- Check for security vulnerabilities
- Suggest improvements with examples

The Role of Agent Skills in LM-Kit.NET

  1. Modular Capability Design Skills separate "what the agent knows" from "how the agent works." This allows you to swap, update, or combine skills without modifying application code.

  2. Progressive Disclosure Skills support progressive disclosure, where basic capabilities are always available, but advanced features can be unlocked based on context or user permissions.

  3. Domain Expertise Packaging Package specialized knowledge (legal, medical, financial, technical) as skills that can be loaded on demand, keeping agents focused and efficient.

  4. Write Once, Use Everywhere A skill written for one LM-Kit.NET application works in any other, and skills can be shared across teams, organizations, or the broader community.

  5. Version Control and Governance Skills are text files that fit naturally into version control systems, enabling review processes, rollbacks, and audit trails for AI behavior changes.


Practical Usage in LM-Kit.NET SDK

LM-Kit.NET provides a complete skill management system through the LMKit.Agents.Skills namespace.

Loading Skills

using LMKit.Agents.Skills;

// Load all skills from a directory
var registry = new SkillRegistry();
registry.LoadFromDirectory("./skills");

// Access individual skills
var skill = registry.Get("code-review");
Console.WriteLine($"Skill: {skill.Name}");
Console.WriteLine($"Description: {skill.Description}");

Two Activation Modes

LM-Kit supports two distinct ways to activate skills. Understanding the difference is essential:

Mode 1: Manual Activation (SkillActivator)

Your application controls which skill is active. You use SkillActivator to format the skill's instructions and inject them into the conversation prompt. The model receives enriched prompts but never knows about the skill system.

using LMKit.Model;
using LMKit.Agents.Skills;
using LMKit.TextGeneration;

var registry = new SkillRegistry();
registry.LoadFromDirectory("./skills");
var activator = new SkillActivator(registry);

using LM model = LM.LoadFromModelID("gemma3:12b");
var chat = new MultiTurnConversation(model);

// Activate a skill and inject its instructions
var skill = registry.Get("explain");
string instructions = activator.FormatForInjection(skill, SkillInjectionMode.UserMessage);
string prompt = instructions + "\n\n---\n\nUser request: blockchain";
var result = chat.Submit(prompt);

Best for: menu-driven apps, predictable skill selection, when the application (not the model) should control activation.

Mode 2: Model-Driven Activation (SkillTool)

A SkillTool is registered as a callable function. The model reads the tool description (which lists all available skills), and decides when to call activate_skill based on the user's request. No slash commands or manual injection needed.

using LMKit.Model;
using LMKit.Agents.Skills;
using LMKit.TextGeneration;

var registry = new SkillRegistry();
registry.LoadFromDirectory("./skills");

using LM model = LM.LoadFromModelID("gemma3:12b");
var chat = new MultiTurnConversation(model);

// Register SkillTool: the model can now call activate_skill on its own
chat.Tools.Register(new SkillTool(registry));

// Just chat naturally. The model activates skills autonomously.
var result = chat.Submit("explain what blockchain is");

Best for: autonomous agents, conversational UIs, scenarios where the AI should pick the right skill for the job.

Comparison

Aspect Manual (SkillActivator) Model-Driven (SkillTool)
Who activates? Application code Model via function calling
Requires tool calling? No Yes
Model awareness Sees enriched prompts Sees available tools
Control level Full application control Model decides autonomously

Creating Skills Programmatically

using LMKit.Agents.Skills;

var skill = new SkillBuilder()
    .WithName("customer-support")
    .WithDescription("Handles customer inquiries with empathy and efficiency")
    .WithVersion("1.0.0")
    .WithInstructions(@"
        You are a helpful customer support agent.

        ## Guidelines
        - Always greet customers warmly
        - Acknowledge their concerns before providing solutions
        - Escalate complex issues to human agents when needed")
    .Build();

registry.Register(skill);

Key Concepts

  • Skill File (SKILL.md): A Markdown file with YAML frontmatter that defines an agent's capabilities, required tools, and behavioral instructions.

  • Progressive Disclosure: The pattern of revealing capabilities incrementally based on context, permissions, or user needs.

  • SkillRegistry: A collection manager in LM-Kit.NET that indexes, searches, and provides access to multiple skills.

  • AgentSkill: The class representing a parsed skill definition in LM-Kit.NET, with properties for metadata and instructions.

  • SkillActivator: Formats skill instructions for injection into conversations. Used in manual activation mode, where the application controls which skill is active.

  • SkillTool: An ITool implementation that exposes skills to the model through function calling. Used in model-driven activation mode, where the model discovers and activates skills autonomously.

  • Skill Composition: Combining multiple skills to create agents with compound capabilities (e.g., code review + security audit).


Key Terms

  • Skill Metadata: Structured information (name, version, tags, dependencies) in the YAML frontmatter.

  • Skill Instructions: Natural language guidance in the Markdown body that shapes agent behavior.

  • Tool Requirements: The list of tools a skill expects to be available for full functionality.

  • Context Requirements: Information or knowledge bases the skill needs to operate effectively.

  • Skill Tags: Labels for categorizing and discovering skills within a registry.


Practical Use Cases for Agent Skills

  • Domain Expert Agents: Package legal, medical, or financial expertise as skills that specialized agents can load
  • Role-Based Assistants: Define different personas (teacher, coach, analyst) as interchangeable skills
  • Workflow Automation: Create skills for specific business processes (invoice processing, report generation)
  • Quality Assurance: Build reusable review and validation skills for code, documents, or data
  • Compliance and Governance: Define skills that encode regulatory requirements and best practices
  • Multi-Tenant Applications: Load different skill sets based on customer, department, or use case

  • AI Agents: The autonomous systems that execute skills to accomplish goals
  • AI Agent Tools: External capabilities that skills can require and utilize
  • AI Agent Memory: Persistent knowledge that skills can leverage for context-aware behavior
  • AI Agent Planning: How skills integrate with planning strategies for multi-step execution
  • Function Calling: The mechanism skills use to invoke registered tools

Summary

Agent Skills provide a standardized, portable way to define AI agent capabilities through structured SKILL.md files that combine YAML metadata with Markdown instructions. In LM-Kit.NET, the AgentSkill class loads and represents these definitions, while SkillRegistry manages collections of skills for discovery and composition. This approach enables modular agent design where capabilities can be shared, versioned, and composed without code changes, making it easier to build specialized agents, maintain governance over AI behavior, and share expertise across teams and applications.

Share