Can I Share and Distribute Agent Skills Across Projects?
TL;DR
Yes. Agent Skills are plain text files (SKILL.md + optional resources), making them trivially shareable. Load skills from local directories, HTTP URLs, or GitHub repositories. Create skills programmatically with SkillBuilder. Skills support semantic versioning, validation, and bundled resources (scripts, templates, references). Because skills contain no compiled code, they work across any LM-Kit.NET project without recompilation.
Skill File Structure
A skill is a directory containing a SKILL.md file and optional resource subdirectories:
my-skill/
├── SKILL.md ← Required (YAML frontmatter + Markdown instructions)
├── references/ ← Optional: documentation, API specs
│ └── style-guide.md
├── scripts/ ← Optional: executable code
│ └── validate.py
├── assets/ ← Optional: templates, images, data files
│ └── email-template.html
└── examples/ ← Optional: sample inputs/outputs
└── sample-output.txt
Loading Skills
From a Local Directory
using LMKit.Agents.Skills;
var registry = new SkillRegistry();
// Load all skills from a directory (each subdirectory = one skill)
registry.LoadFromDirectory("./skills");
// Load from multiple directories
registry.LoadFromDirectories(new[] { "./skills", "./shared-skills", "./team-skills" });
// Load a single skill
var skill = AgentSkill.Load("./skills/code-review");
registry.Register(skill);
From a GitHub Repository
// Load a skill directly from GitHub
await registry.LoadFromGitHubAsync(
owner: "my-org",
repo: "ai-skills-library",
path: "skills/email-writer",
branch: "main"
);
From an HTTP URL
// Load from any HTTPS endpoint
await registry.LoadFromUrlAsync("https://skills.example.com/code-review/SKILL.md");
Creating Skills Programmatically
Use SkillBuilder to create skills in code without writing SKILL.md files:
using LMKit.Agents.Skills;
var skill = new SkillBuilder()
.WithName("data-analyst")
.WithDescription("Analyzes datasets and produces statistical summaries")
.WithVersion("2.1.0")
.WithInstructions("""
# Data Analyst
When the user provides a dataset or asks an analytical question:
1. Identify the data format and key columns
2. Calculate relevant statistics (mean, median, distribution)
3. Highlight anomalies or trends
4. Present findings in a clear table format
""")
.WithAuthor("Data Team")
.WithTags("analytics", "statistics", "data")
.Build();
registry.Register(skill);
// Or save to disk for sharing
new SkillBuilder()
.WithName("data-analyst")
.WithDescription("Analyzes datasets and produces statistical summaries")
.WithInstructions("...")
.SaveToFile("./skills/data-analyst"); // Creates SKILL.md in the directory
Skill Versioning
Skills support semantic versioning in their YAML frontmatter:
---
name: "code-review"
description: "Reviews code for bugs, style, and performance issues"
version: "2.3.1"
---
When registering skills, you can control overwrite behavior:
// Overwrite existing skill with same name
registry.LoadAndRegister("./skills/code-review", overwrite: true);
// Fail if skill already registered
registry.LoadAndRegister("./skills/code-review", overwrite: false);
Skill Validation
Validate skills against the Agent Skills specification before deployment:
// Validate a single skill
if (!skill.Validate(out var errors))
{
foreach (var error in errors)
Console.WriteLine($" Validation error: {error}");
}
// Validate all skills in a registry
if (!registry.ValidateAll(out var invalidSkills))
{
foreach (var kvp in invalidSkills)
Console.WriteLine($"{kvp.Key}: {string.Join("; ", kvp.Value)}");
}
Validation checks: name format (lowercase, hyphens, max 64 chars), description length (max 1024 chars), non-empty instructions, and metadata constraints.
Skill Resources
Skills can bundle supporting files. Resources are lazy-loaded on first access:
// Access all resources
foreach (var resource in skill.Resources)
Console.WriteLine($"{resource.Type}: {resource.RelativePath}");
// Filter by type
var templates = skill.GetResources(SkillResourceType.Asset);
var docs = skill.GetResources(SkillResourceType.Reference);
// Get specific resource content
if (skill.HasResource("references/api-spec.md"))
{
string content = skill.GetResource("references/api-spec.md").GetContent();
}
Distribution Patterns
| Pattern | Best For |
|---|---|
| Git repository | Team collaboration, version control, pull request reviews |
| GitHub direct loading | Open-source skill libraries, community sharing |
| HTTP URL | Centralized skill servers, enterprise distribution |
| NuGet package | Bundling skills alongside .NET libraries |
| Local directory | Development, testing, air-gapped environments |
📚 Related Content
- What are Agent Skills and how do they differ from tools?: Conceptual overview of skills vs tools.
- How does the model decide which skill to activate?: Manual and model-driven activation modes.
- Add Skills to Your AI Assistant: Step-by-step implementation guide.