Skip to content

Commit 8b2fba2

Browse files
committed
[DOCS][Improve agent skills docs]
1 parent b1b4e7f commit 8b2fba2

File tree

6 files changed

+104
-1433
lines changed

6 files changed

+104
-1433
lines changed

docs/mkdocs.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,8 @@ nav:
375375
- Agent Examples:
376376
- Overview: "examples/basic_examples_overview.md"
377377
- Basic Agent: "swarms/examples/basic_agent.md"
378-
- Agent Skills:
379-
- Overview: "swarms/examples/agent_skills_overview.md"
380-
- Basic Skills Usage: "swarms/examples/agent_with_skills.md"
381-
- Creating Custom Skills: "swarms/examples/agent_with_custom_skill.md"
382-
- Multiple Skills: "swarms/examples/agent_with_multiple_skills.md"
383-
- Autonomous Agent: "swarms/examples/autonomous_agent_tutorial.md"
378+
- Agent Skills: "swarms/examples/agent_skills_overview.md"
379+
- Autonomous Agent: "sswarms/examples/autonomous_agent_tutorial.md"
384380
- Agent Handoff: "swarms/examples/agent_handoff_tutorial.md"
385381
- Autosave: "swarms/examples/autosave_tutorial.md"
386382
- Tool Usage:
Lines changed: 102 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,162 @@
1-
# Agent Skills Overview
1+
# Agent Skills
22

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.
44

5-
## What are Agent Skills?
5+
## How It Works
66

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
810

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
1319

1420
## Quick Example
1521

1622
```python
1723
from swarms import Agent
1824

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(
2032
agent_name="Financial Analyst",
2133
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
2435
)
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
2838
```
2939

30-
## SKILL.md Format
40+
## Skill Schema
3141

32-
Skills use a simple structure:
42+
Skills use a simple markdown format with YAML frontmatter:
3343

34-
```yaml
44+
```markdown
3545
---
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
3848
---
3949

40-
# Skill Instructions
50+
# Financial Analysis Skill
4151

42-
Detailed guidance for the agent...
52+
When performing financial analysis, follow these systematic steps:
4353

44-
## Guidelines
45-
- Key principles
46-
- Best practices
54+
## Core Methodology
4755

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
5264

53-
## Directory Structure
65+
### 3. Valuation Models
66+
- DCF: Project cash flows and discount to present value
67+
- Comparables: Compare to similar companies
5468

69+
## Guidelines
70+
- Use conservative assumptions when uncertain
71+
- Cross-validate with multiple methods
72+
- Clearly document all assumptions
5573
```
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
5685
skills/
5786
├── financial-analysis/
5887
│ └── SKILL.md
5988
├── code-review/
6089
│ └── SKILL.md
61-
└── customer-support/
90+
└── data-visualization/
6291
└── SKILL.md
6392
```
6493

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
7695

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
7898

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+
)
80105

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+
```
82109

83-
## Example Skills Included
110+
## Built-in Examples
84111

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" |
86117

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
113119

114-
## Common Use Cases
120+
1. Create a folder: `mkdir my-skills/customer-support`
121+
2. Add `SKILL.md`:
115122

116-
### 1. Domain Expertise
123+
```markdown
124+
---
125+
name: customer-support
126+
description: Handle customer inquiries with empathy and efficiency
127+
---
117128

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
126130

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
128136

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
136141
```
137142

138-
### 3. Communication Styles
143+
1. Use with agent:
139144

140-
Define tone and formatting:
141145
```python
142-
# Customer support with brand voice
143146
agent = Agent(
144147
agent_name="Support Agent",
145-
skills_dir="./skills/support"
148+
model_name="gpt-4o",
149+
skills_dir="./my-skills"
146150
)
147151
```
148152

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-
165153
## Compatibility
166154

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.
170156

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.
175158

176159
## Resources
177160

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

Comments
 (0)