|
1 | | -# Agent Skills Overview |
| 1 | +# Agent Skills |
2 | 2 |
|
3 | | -Agent Skills is a simple, powerful way to specialize agents using markdown files. This guide covers everything you need to know to use skills in your Swarms agents. |
| 3 | +Agent Skills let you specialize AI agents using simple markdown files. Add domain expertise to your agents without writing code - just create `SKILL.md` files in a directory. |
4 | 4 |
|
5 | | -## What are Agent Skills? |
| 5 | +## How It Works |
6 | 6 |
|
7 | | -Agent Skills are modular capabilities defined in `SKILL.md` files that guide agent behavior. They enable you to: |
| 7 | +1. **Create Skills**: Write `SKILL.md` files with instructions for specific tasks |
| 8 | +2. **Load Directory**: Point your agent to a skills folder |
| 9 | +3. **Automatic Application**: Agent uses relevant skills based on your prompts |
8 | 10 |
|
9 | | -- **Specialize agents** without modifying code |
10 | | -- **Share expertise** across your team through skill libraries |
11 | | -- **Maintain consistency** in how agents perform tasks |
12 | | -- **Rapidly iterate** by editing markdown instead of rebuilding prompts |
| 11 | +## Performance Benefits |
| 12 | + |
| 13 | +Skills dramatically improve agent performance by: |
| 14 | + |
| 15 | +- **Domain Expertise**: Agents follow proven methodologies instead of generic responses |
| 16 | +- **Consistency**: Same approach every time for similar tasks |
| 17 | +- **Specialization**: Focus on specific domains rather than being general-purpose |
| 18 | +- **Rapid Iteration**: Edit markdown files instead of retraining models |
13 | 19 |
|
14 | 20 | ## Quick Example |
15 | 21 |
|
16 | 22 | ```python |
17 | 23 | from swarms import Agent |
18 | 24 |
|
19 | | -agent = Agent( |
| 25 | +# Without skills - generic response |
| 26 | +basic_agent = Agent(agent_name="Assistant", model_name="gpt-4o") |
| 27 | +basic_response = basic_agent.run("How do I analyze company financials?") |
| 28 | +# → Generic explanation |
| 29 | + |
| 30 | +# With skills - specialized response |
| 31 | +skilled_agent = Agent( |
20 | 32 | agent_name="Financial Analyst", |
21 | 33 | model_name="gpt-4o", |
22 | | - skills_dir="./example_skills", # ← Just add this parameter! |
23 | | - max_loops=1 |
| 34 | + skills_dir="./skills" # Contains financial-analysis skill |
24 | 35 | ) |
25 | | - |
26 | | -# Agent automatically follows financial-analysis skill instructions |
27 | | -response = agent.run("Perform a DCF valuation for Tesla") |
| 36 | +skilled_response = skilled_agent.run("How do I analyze company financials?") |
| 37 | +# → Structured DCF methodology with specific steps |
28 | 38 | ``` |
29 | 39 |
|
30 | | -## SKILL.md Format |
| 40 | +## Skill Schema |
31 | 41 |
|
32 | | -Skills use a simple structure: |
| 42 | +Skills use a simple markdown format with YAML frontmatter: |
33 | 43 |
|
34 | | -```yaml |
| 44 | +```markdown |
35 | 45 | --- |
36 | | -name: my-skill |
37 | | -description: What this skill does |
| 46 | +name: financial-analysis |
| 47 | +description: Perform comprehensive financial analysis including DCF modeling and ratio analysis |
38 | 48 | --- |
39 | 49 |
|
40 | | -# Skill Instructions |
| 50 | +# Financial Analysis Skill |
41 | 51 |
|
42 | | -Detailed guidance for the agent... |
| 52 | +When performing financial analysis, follow these systematic steps: |
43 | 53 |
|
44 | | -## Guidelines |
45 | | -- Key principles |
46 | | -- Best practices |
| 54 | +## Core Methodology |
47 | 55 |
|
48 | | -## Examples |
49 | | -- Example use case 1 |
50 | | -- Example use case 2 |
51 | | -``` |
| 56 | +### 1. Data Collection |
| 57 | +- Gather income statement, balance sheet, cash flow |
| 58 | +- Verify data accuracy and completeness |
| 59 | + |
| 60 | +### 2. Financial Ratios |
| 61 | +Calculate key ratios: |
| 62 | +- EBITDA margin = (EBITDA / Revenue) × 100 |
| 63 | +- Current ratio = Current Assets / Current Liabilities |
52 | 64 |
|
53 | | -## Directory Structure |
| 65 | +### 3. Valuation Models |
| 66 | +- DCF: Project cash flows and discount to present value |
| 67 | +- Comparables: Compare to similar companies |
54 | 68 |
|
| 69 | +## Guidelines |
| 70 | +- Use conservative assumptions when uncertain |
| 71 | +- Cross-validate with multiple methods |
| 72 | +- Clearly document all assumptions |
55 | 73 | ``` |
| 74 | + |
| 75 | +### Required Fields |
| 76 | + |
| 77 | +| Field | Type | Description | |
| 78 | +|-------------|--------|--------------------------------------| |
| 79 | +| `name` | string | Unique skill identifier | |
| 80 | +| `description` | string | What the skill does and when to use it | |
| 81 | + |
| 82 | +### Directory Structure |
| 83 | + |
| 84 | +```text |
56 | 85 | skills/ |
57 | 86 | ├── financial-analysis/ |
58 | 87 | │ └── SKILL.md |
59 | 88 | ├── code-review/ |
60 | 89 | │ └── SKILL.md |
61 | | -└── customer-support/ |
| 90 | +└── data-visualization/ |
62 | 91 | └── SKILL.md |
63 | 92 | ``` |
64 | 93 |
|
65 | | -## Core Concepts |
66 | | - |
67 | | -### 1. Skill Loading |
68 | | - |
69 | | -When you specify `skills_dir`, Swarms: |
70 | | -1. Scans for subdirectories containing `SKILL.md` |
71 | | -2. Parses YAML frontmatter (name, description) |
72 | | -3. Loads full markdown content |
73 | | -4. Injects into agent's system prompt |
74 | | - |
75 | | -### 2. Skill Activation |
| 94 | +## Usage |
76 | 95 |
|
77 | | -Skills are **always active** once loaded. The agent sees all skill instructions and applies them when relevant to the task. |
| 96 | +```python |
| 97 | +from swarms import Agent |
78 | 98 |
|
79 | | -### 3. Multiple Skills |
| 99 | +# Basic usage - load all skills from directory |
| 100 | +agent = Agent( |
| 101 | + agent_name="Specialist", |
| 102 | + model_name="gpt-4o", |
| 103 | + skills_dir="./skills" # Points to folder with SKILL.md files |
| 104 | +) |
80 | 105 |
|
81 | | -Agents can have multiple skills loaded simultaneously. They'll intelligently apply the right guidance based on the task. |
| 106 | +# Agent automatically uses relevant skills |
| 107 | +response = agent.run("Analyze this company's financial statements") |
| 108 | +``` |
82 | 109 |
|
83 | | -## Example Skills Included |
| 110 | +## Built-in Examples |
84 | 111 |
|
85 | | -Swarms includes 3 production-ready skills: |
| 112 | +| Skill | What it does | Example Prompt | |
| 113 | +|----------------------|---------------------------------------------|---------------------------------| |
| 114 | +| **financial-analysis** | DCF valuation, ratio analysis, financial modeling | "Perform DCF analysis on Tesla" | |
| 115 | +| **code-review** | Security checks, performance optimization, best practices | "Review this Python code for issues" | |
| 116 | +| **data-visualization** | Chart selection, design principles, storytelling | "Best chart for showing sales trends" | |
86 | 117 |
|
87 | | -### Financial Analysis |
88 | | -```bash |
89 | | -example_skills/financial-analysis/SKILL.md |
90 | | -``` |
91 | | -- DCF valuation methodology |
92 | | -- Financial ratio analysis |
93 | | -- Sensitivity analysis frameworks |
94 | | -- Investment recommendations |
95 | | - |
96 | | -### Code Review |
97 | | -```bash |
98 | | -example_skills/code-review/SKILL.md |
99 | | -``` |
100 | | -- Security vulnerability detection |
101 | | -- Performance optimization checks |
102 | | -- Best practices enforcement |
103 | | -- Maintainability assessment |
104 | | - |
105 | | -### Data Visualization |
106 | | -```bash |
107 | | -example_skills/data-visualization/SKILL.md |
108 | | -``` |
109 | | -- Chart type selection |
110 | | -- Design principles |
111 | | -- Color best practices |
112 | | -- Storytelling frameworks |
| 118 | +## Creating Custom Skills |
113 | 119 |
|
114 | | -## Common Use Cases |
| 120 | +1. Create a folder: `mkdir my-skills/customer-support` |
| 121 | +2. Add `SKILL.md`: |
115 | 122 |
|
116 | | -### 1. Domain Expertise |
| 123 | +```markdown |
| 124 | +--- |
| 125 | +name: customer-support |
| 126 | +description: Handle customer inquiries with empathy and efficiency |
| 127 | +--- |
117 | 128 |
|
118 | | -Add specialized knowledge: |
119 | | -```python |
120 | | -# Financial analysis agent |
121 | | -agent = Agent( |
122 | | - agent_name="Finance Expert", |
123 | | - skills_dir="./skills/finance" |
124 | | -) |
125 | | -``` |
| 129 | +# Customer Support Skill |
126 | 130 |
|
127 | | -### 2. Process Enforcement |
| 131 | +## Approach |
| 132 | +1. Acknowledge the issue |
| 133 | +2. Ask clarifying questions |
| 134 | +3. Provide clear solutions |
| 135 | +4. Offer follow-up help |
128 | 136 |
|
129 | | -Ensure consistent methodologies: |
130 | | -```python |
131 | | -# Code review with company standards |
132 | | -agent = Agent( |
133 | | - agent_name="Code Reviewer", |
134 | | - skills_dir="./skills/code-standards" |
135 | | -) |
| 137 | +## Tone |
| 138 | +- Professional yet friendly |
| 139 | +- Patient and understanding |
| 140 | +- Solution-oriented |
136 | 141 | ``` |
137 | 142 |
|
138 | | -### 3. Communication Styles |
| 143 | +1. Use with agent: |
139 | 144 |
|
140 | | -Define tone and formatting: |
141 | 145 | ```python |
142 | | -# Customer support with brand voice |
143 | 146 | agent = Agent( |
144 | 147 | agent_name="Support Agent", |
145 | | - skills_dir="./skills/support" |
| 148 | + model_name="gpt-4o", |
| 149 | + skills_dir="./my-skills" |
146 | 150 | ) |
147 | 151 | ``` |
148 | 152 |
|
149 | | -## Next Steps |
150 | | - |
151 | | -Explore the example guides: |
152 | | - |
153 | | -1. **[Basic Skills Usage](/swarms/examples/agent_with_skills/)** - Start here for your first skill |
154 | | -2. **[Creating Custom Skills](/swarms/examples/agent_with_custom_skill/)** - Build your own skills |
155 | | -3. **[Multiple Skills](/swarms/examples/agent_with_multiple_skills/)** - Use multiple skills together |
156 | | - |
157 | | -## Key Benefits |
158 | | - |
159 | | -- ✅ **Simple**: Just markdown files, no code needed |
160 | | -- ✅ **Portable**: Standard format works across platforms |
161 | | -- ✅ **Version Control**: Skills are just files - track with git |
162 | | -- ✅ **Reusable**: Share skills across your organization |
163 | | -- ✅ **Claude Code Compatible**: Works with Anthropic's ecosystem |
164 | | - |
165 | 153 | ## Compatibility |
166 | 154 |
|
167 | | -Swarms Agent Skills implementation follows [Anthropic's Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) standard, ensuring compatibility with Claude Code and other tools that use the same format. |
168 | | - |
169 | | -### What This Means |
| 155 | +Agent Skills follow [Anthropic's Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) standard, ensuring compatibility with Claude Code and other compliant tools. |
170 | 156 |
|
171 | | -- Skills created for Swarms work with Claude Code |
172 | | -- Skills from Claude Code work with Swarms |
173 | | -- Same `SKILL.md` format across platforms |
174 | | -- Part of an emerging ecosystem standard |
| 157 | +Skills created for Swarms work with Claude Code, and vice versa. |
175 | 158 |
|
176 | 159 | ## Resources |
177 | 160 |
|
178 | | -- [Main Agent Skills Documentation](/swarms/agents/agent_skills/) |
179 | | -- [Anthropic Agent Skills Blog](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) |
180 | | -- [Official GitHub Repository](https://github.com/anthropics/skills) |
181 | | -- [Code Examples](https://github.com/kyegomez/swarms/tree/master/examples/single_agent) |
| 161 | +- [Anthropic Agent Skills Specification](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) |
| 162 | +- [Code Examples](https://github.com/kyegomez/swarms/tree/master/examples/single_agent/agent_skill_examples) |
0 commit comments