Skip to content

Conversation

@Steve-Dusty
Copy link
Contributor

@Steve-Dusty Steve-Dusty commented Jan 14, 2026

Summary

Integrates Anthropic's Agent Skills framework into the Swarms Agent class, enabling modular, reusable
capabilities defined in markdown files. This allows developers to create skill libraries and specialize agents
without modifying code.

What Changed

Core Implementation (~150 lines)

  • Added skills_dir parameter to Agent.__init__()
  • Added load_skills_metadata() method to parse SKILL.md files
  • Added _build_skills_prompt() method to inject skills into system prompt
  • Added load_full_skill() method for programmatic skill access
  • Updated Agent docstrings and method documentation

Configuration

  • Added .gitignore patterns for user skill directories
  • Keeps example_skills/ in repo, ignores skills/, my_skills/, custom_skills/, etc.

Examples & Documentation

  • Created 3 example skills: financial-analysis, code-review, data-visualization
  • Added 3 usage examples in /examples/single_agent/
  • Created test suite with 100% pass rate

Why

Aligns Swarms with Anthropic's Agent Skills standard (December 2024), providing:

  • Modularity: Skills are separate markdown files, easy to create and share
  • Reusability: Build skill libraries for common tasks
  • Portability: Standard SKILL.md format works across platforms
  • Simplicity: No code changes needed to add new capabilities

SKILL.md Format

---
name: skill-name
description: What this skill does
---

# Skill Name

Instructions for the agent to follow...

Usage

from swarms import Agent

agent = Agent(
    agent_name="Financial Analyst",
    model_name="gpt-4o",
    skills_dir="./example_skills",  # ← Single parameter
    max_loops=1
)

# Agent automatically follows skill instructions
response = agent.run("Perform a DCF analysis")

Testing

# Run test suite
python3 test_agent_skills.py

# Try examples
python3 examples/single_agent/agent_with_skills.py
python3 examples/single_agent/agent_with_custom_skill.py
python3 examples/single_agent/agent_with_multiple_skills.py

Backward Compatibility

✅ Zero breaking changes - agents without skills_dir work exactly as before.

Files Changed

- swarms/structs/agent.py (~150 lines added)
- .gitignore (7 lines added)
- example_skills/ (3 example skills)
- examples/single_agent/ (3 new examples)
- test_agent_skills.py (test suite)

References

- https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
- https://github.com/anthropics/skills
- https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview

<!-- readthedocs-preview swarms start -->
----
📚 Documentation preview 📚: https://swarms--1298.org.readthedocs.build/en/1298/

<!-- readthedocs-preview swarms end -->

skills: List of skill metadata dicts from load_skills_metadata()
Returns:
Formatted skills prompt section to append to system_prompt

Check failure

Code scanning / Pyre

Incompatible variable type Error

Incompatible variable type [9]: file_path is declared to have type str but is used as type None.
@kyegomez
Copy link
Owner

@Steve-Dusty make an example file in mkdocs.yml provide reference for claude code's compatability and showcase that we are compatible

@kyegomez kyegomez merged commit 3649274 into kyegomez:master Jan 14, 2026
7 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants