Skip to main content
Agent Skills is a lightweight, markdown-based framework introduced by Anthropic for defining modular, reusable agent capabilities. Skills enable you to specialize agents without modifying code by loading skill definitions from simple SKILL.md files.

What are Agent Skills?

Agent Skills are:
  • Markdown-based: Written in simple Markdown format with YAML frontmatter
  • Modular: Each skill is a self-contained capability
  • Reusable: Skills can be shared across agents and projects
  • Context-aware: Automatically loaded based on task similarity
  • Code-free: No code changes needed to add new capabilities

Skills Directory Structure

SKILL.md Format

Basic Structure

Each SKILL.md file has two parts:
  1. YAML Frontmatter: Metadata about the skill
  2. Markdown Content: Instructions and methodology

Example: Financial Analysis Skill

Using Agent Skills

Dynamic Loading (Task-Based, Automatic)

Setting skills_dir on an agent enables dynamic, task-based skill loading automatically. Every call to agent.run(task) selects the skills whose description is similar enough to the current task: cosine similarity over word counts of the task and the description, with a threshold of 0.3 (a skill is selected when its score is at least the threshold). The selected skills are sent with every LLM call of that run as an extra system message, placed after the agent’s system prompt. agent.system_prompt itself is never changed. A run that selects no skills sends none.
After a run, agent.skills_metadata lists the skills the last matching run selected.
Matching compares words, not meaning, so a task that paraphrases a skill can score below the threshold. Check the scores with DynamicSkillsLoader("./skills").get_similarity_scores(task) from swarms.structs.dynamic_skills_loader, and write descriptions that use the words your tasks use.

Loading Every Skill on Every Run

run() always selects skills by similarity. To send every skill regardless of the task, set the threshold to 0 before the first run:
Calling agent.handle_skills() with no task selects every skill, but the next run() selects again by similarity and replaces that selection. The skills loader is built on the first run and reused; assign agent.skills_dir again to pick up skill files added later.

Skills from Several Directories

skills_dir also takes a list. Directories are read in order. When two directories hold a skill with the same name, the skill from the later directory is used and a warning names both paths.

Creating Custom Skills

Step 1: Create Directory

Step 2: Write SKILL.md

Step 3: Use the Skill

Skill Examples

Data Visualization Skill

Dynamic Skills Loader

Best Practices

1. Keep Skills Focused

2. Include Examples

Always provide concrete examples in your skills:

3. Use Clear Instructions

4. Provide Guidelines

Sharing Skills

Skills can be easily shared across projects and teams:

Next Steps

Structured Outputs

Get structured responses from agents

Creating Agents

Learn how to create agents

Reference

  • Skills handling: swarms/structs/agent.py (handle_skills stores the selected section; call_llm sends it with every request) plus swarms/agents/skills_manager.py (SkillsManager._static_prompt, SkillsManager._dynamic_prompt) for the tiered static/dynamic loading logic. See the SkillsManager reference
  • Dynamic skills loader and multi-directory loading: swarms/structs/dynamic_skills_loader.py
  • Example skills: examples/single_agent/capabilities/skills/, including multiple_skill_dirs/
  • Anthropic Agent Skills: Agent Skills announcement