Agent Skills#

The MS-Agent Skill Module provides a knowledge-driven approach to extending LLM agent capabilities. Instead of building a separate execution pipeline, skills are treated as procedural knowledge β€” they describe how to do something, and the model itself executes the steps using its standard tools (code execution, file I/O, web search, etc.).

Architecture#

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Skill Sources│────▢│ SkillCatalog │────▢│PromptInjector     β”‚
  β”‚ local / MS / β”‚     β”‚ load, filter,β”‚     β”‚ always skills:     β”‚
  β”‚ git          β”‚     β”‚ cache        β”‚     β”‚   full body inject β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚ all skills:        β”‚
                             β”‚             β”‚   name+desc index  β”‚
                             β”‚             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚SkillToolSet │────▢│   ToolManager    β”‚
                      β”‚ skills_list β”‚     β”‚ unified registry β”‚
                      β”‚ skill_view  β”‚     β”‚ (MCP + built-in  β”‚
                      β”‚ skill_manageβ”‚     β”‚  + skill tools)  β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                   β”‚
                                                   β–Ό
                                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                          β”‚    LLM Agent   β”‚
                                          β”‚    step() loop β”‚
                                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

How Skills Work#

  1. System prompt includes a lightweight index of all enabled skills (name + description, ~30 tokens each). Skills marked always: true have their full body injected.

  2. When the model encounters a relevant task, it calls skill_view(skill_id) to load the complete instructions.

  3. The model follows those instructions using its existing tools (code_executor, web_search, file_system, etc.).

  4. All results flow through standard role: tool messages β€” no special routing, no short-circuiting.

Three-Level Progressive Disclosure#

Level

Content

Cost

Source

L1

Name + one-line description

~30 tokens/skill

System prompt (automatic)

L2

Full SKILL.md body

On demand

skill_view tool call

L3

Referenced scripts, templates, docs

On demand

skill_view with file_path

Key Features#

  • Skill as Knowledge: Skills guide the model; execution uses existing tools. No separate pipeline, no subprocess isolation needed.

  • Unified Tool Integration: Skill tools (skills_list, skill_view, skill_manage) are registered through the standard ToolManager alongside MCP and built-in tools.

  • Multi-Source Loading: Load skills from local directories, ModelScope repositories, or Git URLs via SkillCatalog.

  • Three-Tier Priority: Built-in skills < user home skills < workspace skills. Same-name skills at higher tiers override lower ones.

  • Always-Active Skills: Mark critical skills with always: true to inject their full content into the system prompt.

  • Hot Reload: SkillCatalog supports reloading individual skills or full refresh. Changes are immediately visible via tool calls.

  • Runtime Self-Evolution: When enable_manage: true, the model can create, edit, and delete skills during a conversation.

  • Zero Overhead When Disabled: No skills: config β†’ no skill tools registered, no prompt injection, no performance impact.

Skill Directory Structure#

my-skill/
β”œβ”€β”€ SKILL.md              # Required: entry point
β”œβ”€β”€ scripts/              # Optional: executable scripts
β”‚   └── search.py
β”œβ”€β”€ references/           # Optional: reference documents
β”‚   └── api-docs.md
β”œβ”€β”€ templates/            # Optional: template files
β”‚   └── report.html
└── assets/               # Optional: static resources
    └── config.yaml

SKILL.md Format#

---
name: paper-finder                  # required, hyphen-case, ≀64 chars
description: "Search academic papers"  # required, ≀1024 chars
version: "1.0.0"                    # optional
author: "team-name"                 # optional
tags: [research, papers]            # optional, for filtering
always: false                       # optional, true β†’ full body in prompt
requires:                           # optional, dependency declaration
  tools: [web_search, terminal]
  env: [ARXIV_API_KEY]
---

# Paper Finder

## When to Use
Use this skill when asked to find or analyze academic papers.

## Steps
1. Search arXiv using `web_search`
2. Parse results with `code_executor`
3. Summarize findings for the user

Quick Start#

Using LLMAgent#

import asyncio
from omegaconf import DictConfig
from ms_agent.agent import LLMAgent

config = DictConfig({
    'llm': {
        'model': 'qwen-max',
        'api_base': 'https://dashscope.aliyuncs.com/compatible-mode/v1',
    },
    'tools': {
        'code_executor': {'implementation': 'python_env'},
    },
    'skills': {
        'path': ['./skills'],
        'auto_discover': True,
    },
})

agent = LLMAgent(config, tag='skill-agent')

async def main():
    result = await agent.run('Search for papers on multi-modal RAG')
    print(result[-1].content)

asyncio.run(main())

Programmatic Usage#

from ms_agent.skill import SkillCatalog, SkillPromptInjector, SkillToolSet

catalog = SkillCatalog()
catalog.load_from_config(skills_config)

injector = SkillPromptInjector(catalog)
prompt_section = injector.build_skill_prompt_section()

toolset = SkillToolSet(config, catalog, enable_manage=True)

Configuration#

# agent.yaml
skills:
  # Source paths (local dirs, ModelScope repos, or mixed)
  path:
    - ./skills
    - ms-agent/research_skills

  # Or structured sources
  sources:
    - type: local
      path: ./skills
    - type: modelscope
      repo_id: ms-agent/research_skills
      revision: v1.0

  auto_discover: true       # scan CWD/skills/ automatically
  enable_manage: false       # enable skill_manage tool

  # Filtering (three-value semantics)
  # whitelist: null          # null = all enabled (default)
  # whitelist: []            # [] = all disabled
  # whitelist: [paper-finder]  # specific skills only
  disabled: []               # disable specific skills

Core Components#

Component

Description

SkillCatalog

Multi-source skill loader with priority-based override, caching, whitelist/disabled filtering, and hot reload

SkillPromptInjector

Builds the skill section for system prompt injection (always-skill bodies + summary index)

SkillToolSet

ToolBase subclass providing skills_list, skill_view, skill_manage as registered tools

SkillLoader

Low-level disk parser for SKILL.md directories (preserved from v1)

SkillSchema

Data model for a parsed skill (preserved from v1)

Comparison with Previous Version (v1)#

Aspect

v1 (AutoSkills pipeline)

v2 (Knowledge + Tools)

Execution

Separate pipeline: LLM analysis β†’ DAG β†’ subprocess

Standard agent loop β€” model uses tools directly

Dispatch

do_skill() short-circuits the agent loop

No special branch; skills are standard tools

Context

4-level LLM-driven progressive analysis

3-level disclosure: prompt β†’ skill_view β†’ file

Tool coexistence

Skills and MCP tools mutually exclusive

All tools coexist in same loop

Streaming

Not supported in skill mode

Naturally supported

Dependencies

FAISS, Docker, sentence-transformers

None (pure Python)

Removed

AutoSkills, DAGExecutor, SkillAnalyzer, SkillContainer, Spec

β€”

Added

β€”

SkillCatalog, SkillPromptInjector, SkillToolSet

References#