Skills System Deep-Dive
The Skills System (skills.go) provides a declarative skill definition system that injects specialized capabilities into AntFarm workers and team members.
🎯 Overview
Skills are JSON manifests that define:
- What capabilities a worker receives
- Which tools are enabled
- How the worker should be configured
📁 Structure
Skill Manifest (JSON)
{
"skill_id": "webdev",
"name": "Web Development",
"description": "Full-stack web development with Go and React",
"version": "1.0.0",
"category": "development",
"required_tools": [
"pm_write_file",
"pm_shell",
"pm_grep"
],
"swarm_config": {
"default_ants": 3,
"max_parallel_ants": 5,
"model_tier_preference": "mid-range"
},
"injections": {
"system_prompt_suffix": "You are a web developer specializing in Go and React...",
"context_variables": {
"framework": "standard",
"testing": "required"
},
"tool_examples": [
{
"tool": "pm_write_file",
"description": "Create or modify source files",
"example": "pm_write_file(filename=\"main.go\", content=\"package main\\n...\")"
}
]
}
}
🔧 Key Components
skills.go
SkillManifest: JSON struct for skill definitionSwarmConfiguration: AntFarm worker configSkillInjections: Prompt and tool injectionsSkillCatalog: Global registry of all skillsLoadSkillCatalog(): Load skills from diskInjectSkillIntoSession(): Apply skill to worker
📂 Skill Directory
Skills are stored in:
assistant/skills/
├── webdev.json
├── data-analyst.json
├── security-red-teamer.json
├── network-engineer.json
└── ... (92+ total)
🚀 Skill Injection Flow
1. Worker spawns with skill_id
↓
2. LoadSkillCatalog() loads all skills
↓
3. GetSkill(skill_id) retrieves manifest
↓
4. InjectSkillIntoSession():
- Set ShortTerm("active_skill", skillID)
- Set ShortTerm("skill_prompt_suffix", injections.SystemPromptSuffix)
- Load required_tools (cross-hive tools enabled)
- Override model_tier_preference
↓
5. Worker executes with skill context
🎛️ Swarm Configuration
| Field | Type | Purpose |
|---|---|---|
default_ants |
[]string |
Default worker types to spawn |
model_tier_preference |
string |
Model tier (high-end/mid-range/low-end) |
max_parallel_ants |
int |
Maximum concurrent workers |
🛠️ Cross-Hive Tool Access
Skills enable cross-hive tool access:
- Default: Workers only access
pm_*(AntFarm) tools - Skill-enabled: Workers get
pm_*+bm_*(Business) + existing tools - This allows specialized workers to use appropriate tools from different hives
📋 Key Functions
| Function | Purpose |
|---|---|
LoadSkillCatalog(skillsDir) |
Load all skills from disk |
GetSkill(skillID) |
Retrieve a specific skill |
ListSkills() |
List all available skill IDs |
GetSkillsByCategory(category) |
Filter skills by category |
InjectSkillIntoSession(session, skillID) |
Apply skill to worker |
ValidateSkillManifest(manifest) |
Validate skill JSON |
🎯 Usage with AntFarm
// Spawn worker WITH skill
session, err := NewProjectWorkerSession(
"worker", // worker type
"project-abc", // workspace
"queen-123", // parent session
"webdev", // skill_id ← enables webdev capabilities
)
// The worker now has:
// - System prompt: webdev-specific suffix
// - Tools: pm_write_file, pm_shell, pm_grep (from required_tools)
// - Model: mid-range (from swarm_config.model_tier_preference)
📋 Skill Categories
| Category | Example Skills |
|---|---|
development |
webdev, backend, fullstack, mobile |
analysis |
data-analyst, security-analyst |
operations |
network-engineer, system-admin |
security |
security-red-teamer, penetration-tester |
research |
research-synthesizer, content-researcher |
🔍 Finding Skills
Use MatchSkillsForMission() for AI-driven skill matching:
matches, _ := MatchSkillsForMission(
"Build a secure API endpoint", // mission
"Backend security", // role description
)
// Returns: ["security-red-teamer", "backend"]
📂 Related Documentation
- AntFarm Swarm — Worker execution system
- Dynamic Skill Injection — Runtime skill loading
- Skill Prerequisites — Dependency system