For translation, open lesson in new tab and use Chrome translate
A skill is a directory containing a SKILL.md file. Skills follow an open standard, which means they are portable across agents and shareable across teams.
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
Each skill lives in its own named directory, and the directory name should match the name field in the frontmatter (this is the Agent Skills spec convention; if they differ, deepagents logs a warning but still loads the skill):
The SKILL.md file has two parts: a YAML frontmatter block at the top, and the skill instructions below it.
When a thread first runs, SkillsMiddleware reads each SKILL.md through the backend and keeps only the frontmatter's name and description. The model loads the full body with read_file when it activates a skill. Write the description to clearly answer when the skill should be used. Keep it brief and specific.
The recognized frontmatter fields are:
| Field | Required | Notes |
|---|---|---|
name |
yes | Lowercase, alphanumeric, hyphens only. Should match the directory name. |
description |
yes | Describes when to use this skill. Kept brief; always in context. |
allowed-tools |
no | Space-separated list of tool names the skill may use. |
compatibility |
no | Environment or version requirements. |
metadata |
no | Arbitrary key-value pairs. |
If a SKILL.md is missing name or description, deepagents skips that skill and logs a warning.
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
Skills use a three-stage pattern to keep the agent's context lean:
1. Discovery
Before the model runs, the SDK parses each skill's frontmatter in code, without any tool call from the model. It then adds every skill's name and description to the system prompt on each model call. The SDK writes this section for you. A simplified version looks like this:
## Skills System
Available skills:
- **qualify-lead**: Use when the user wants to qualify a sales lead or prospect.
-> Read skills/qualify-lead/SKILL.md for full instructions.
- **draft-pitch**: Use when the user wants to write a sales pitch or outreach message.
-> Read skills/draft-pitch/SKILL.md for full instructions.
Both the name and description are always in context, so keep them short and precise. The description in particular should describe only when to use the skill, not what it does internally.
2. Activation
When a task matches a skill's description, the agent calls read_file on the path shown in the system prompt, which brings the full SKILL.md into its context.
3. Execution
The agent follows the instructions in the skill body, calling any tools it needs and using any bundled files referenced in the instructions.
You can see all three stages in a LangSmith trace: the Skills System section appears in every system message; the read_file call marks the moment of activation; and the subsequent tool calls show execution.
Skills go further than static text. An agent can write and edit its own skill files over time, refining them from the preferences and patterns it learns on the job. Skills can also include executable scripts in a scripts/ subdirectory, which the agent can run in a sandbox, enabling more advanced workflows like code generation, data processing, or multi-step automation.
read_file when a task matches its description.New update: pinned skills. To make sure the agent uses a skill (e.g. when the user names the skill), pass the skill's name in pinned_skills. The skill's full SKILL.md is added to the conversation before the next model call, so the agent doesn't have to choose to read it.
agent.invoke({
"messages": [{"role": "user", "content": "Qualify Acme Corp."}],
"pinned_skills": ["qualify-lead"],
})
Added in deepagents 0.7.23. The labs don't use it.
New update: skill tools. A skill can list tools in its frontmatter under metadata.include_tools. The agent only sees those tools after it reads that skill's SKILL.md, or after the skill is pinned. Until then, the tools stay out of the prompt.
metadata:
include_tools: create_customer_request list_customer_requests
The tools themselves are passed to SkillsMiddleware(tools=[...]).
Added in deepagents 0.7.22. The labs don't use it.
Using a skill has three parts.
Each skill is a directory with a SKILL.md file:
skills/
qualify-lead/
SKILL.md
draft-pitch/
SKILL.md
The directory name should match the name field in SKILL.md.
---
name: qualify-lead
description: Use when the user wants to qualify a sales lead or prospect.
---
# Qualify a Lead
Follow these steps...
The description is the trigger. The body is the detailed procedure the agent reads after activation.
Skills are files, so they must be available through the agent's backend. The skills argument points to a directory path in that backend.
from deepagents.backends import FilesystemBackend
backend = FilesystemBackend(root_dir="/path/to/agent-files", virtual_mode=True)
agent = create_deep_agent(
model=model,
backend=backend,
skills=["/skills"],
)
In this example, the backend must contain /skills/qualify-lead/SKILL.md and /skills/draft-pitch/SKILL.md. The agent discovers each skill's name and description, then reads the full SKILL.md through its filesystem tools only when needed.
At runtime, the agent:
read_file on that skill's SKILL.mdIn LangSmith, you can debug this by checking the system prompt for the discovery list, the read_file call for activation, and the later tool calls or final output for execution.

LangChain Blog
How Stripe built their Knowledge AI Platform on Deep Agents
Stripe's internal agent, Kai, runs 1,000+ skills across 100+ teams, using skill selection to decide which of 500+ internal tools get loaded into context. Past a few hundred skills, description-based discovery alone starts to degrade, so Kai adds a second gating pass, using each skill's allowedTools list to filter which tools actually load.
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
SKILL.md: YAML frontmatter (name, description) plus markdown instructions. Skills follow the open Agent Skills spec, so they're portable across agents.read_file to load the full body when a task matches, then follows it.description to say when to use the skill, since it's what the agent matches against.skills argument points at a directory in that backend.read_file call is activation, and the tool calls after it are execution.Documentation:
Go deeper: read the source (optional)
The lesson shows how to use this. To see how it's implemented, start with these files:
middleware/skills.py: how skills are discovered and added to the system promptA skill is a directory containing a SKILL.md file. Skills follow an open standard, which means they are portable across agents and shareable across teams.
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
Each skill lives in its own named directory, and the directory name should match the name field in the frontmatter (this is the Agent Skills spec convention; if they differ, deepagents logs a warning but still loads the skill):
The SKILL.md file has two parts: a YAML frontmatter block at the top, and the skill instructions below it.
When a thread first runs, SkillsMiddleware reads each SKILL.md through the backend and keeps only the frontmatter's name and description. The model loads the full body with read_file when it activates a skill. Write the description to clearly answer when the skill should be used. Keep it brief and specific.
The recognized frontmatter fields are:
| Field | Required | Notes |
|---|---|---|
name |
yes | Lowercase, alphanumeric, hyphens only. Should match the directory name. |
description |
yes | Describes when to use this skill. Kept brief; always in context. |
allowed-tools |
no | Space-separated list of tool names the skill may use. |
compatibility |
no | Environment or version requirements. |
metadata |
no | Arbitrary key-value pairs. |
If a SKILL.md is missing name or description, deepagents skips that skill and logs a warning.
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
Skills use a three-stage pattern to keep the agent's context lean:
1. Discovery
Before the model runs, the SDK parses each skill's frontmatter in code, without any tool call from the model. It then adds every skill's name and description to the system prompt on each model call. The SDK writes this section for you. A simplified version looks like this:
## Skills System
Available skills:
- **qualify-lead**: Use when the user wants to qualify a sales lead or prospect.
-> Read skills/qualify-lead/SKILL.md for full instructions.
- **draft-pitch**: Use when the user wants to write a sales pitch or outreach message.
-> Read skills/draft-pitch/SKILL.md for full instructions.
Both the name and description are always in context, so keep them short and precise. The description in particular should describe only when to use the skill, not what it does internally.
2. Activation
When a task matches a skill's description, the agent calls read_file on the path shown in the system prompt, which brings the full SKILL.md into its context.
3. Execution
The agent follows the instructions in the skill body, calling any tools it needs and using any bundled files referenced in the instructions.
You can see all three stages in a LangSmith trace: the Skills System section appears in every system message; the read_file call marks the moment of activation; and the subsequent tool calls show execution.
Skills go further than static text. An agent can write and edit its own skill files over time, refining them from the preferences and patterns it learns on the job. Skills can also include executable scripts in a scripts/ subdirectory, which the agent can run in a sandbox, enabling more advanced workflows like code generation, data processing, or multi-step automation.
read_file when a task matches its description.New update: pinned skills and skill tools. The Python SDK can now force a skill's SKILL.md into the conversation (pinned_skills), and can hide a skill's tools until the agent reads that skill (metadata.include_tools). Neither is in the TypeScript SDK yet.
Using a skill has three parts.
Each skill is a directory with a SKILL.md file:
skills/
qualify-lead/
SKILL.md
draft-pitch/
SKILL.md
The directory name should match the name field in SKILL.md.
---
name: qualify-lead
description: Use when the user wants to qualify a sales lead or prospect.
---
# Qualify a Lead
Follow these steps...
The description is the trigger. The body is the detailed procedure the agent reads after activation.
Skills are files, so they must be available through the agent's backend. The skills argument points to a directory path in that backend.
import { createDeepAgent, FilesystemBackend } from "deepagents";
const backend = new FilesystemBackend({ rootDir: "/path/to/agent-files", virtualMode: true });
const agent = createDeepAgent({
model,
backend,
skills: ["/skills"],
});
In this example, the backend must contain /skills/qualify-lead/SKILL.md and /skills/draft-pitch/SKILL.md. The agent discovers each skill's name and description, then reads the full SKILL.md through its filesystem tools only when needed.
At runtime, the agent:
read_file on that skill's SKILL.mdIn LangSmith, you can debug this by checking the system prompt for the discovery list, the read_file call for activation, and the later tool calls or final output for execution.

LangChain Blog
How Stripe built their Knowledge AI Platform on Deep Agents
Stripe's internal agent, Kai, runs 1,000+ skills across 100+ teams, using skill selection to decide which of 500+ internal tools get loaded into context. Past a few hundred skills, description-based discovery alone starts to degrade, so Kai adds a second gating pass, using each skill's allowedTools list to filter which tools actually load.
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
SKILL.md: YAML frontmatter (name, description) plus markdown instructions. Skills follow the open Agent Skills spec, so they're portable across agents.read_file to load the full body when a task matches, then follows it.description to say when to use the skill, since it's what the agent matches against.skills argument points at a directory in that backend.read_file call is activation, and the tool calls after it are execution.Documentation:
Go deeper: read the source (optional)
The lesson shows how to use this. To see how it's implemented, start with these files:
middleware/skills.ts: how skills are discovered and added to the system promptThe video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
Inspect your own run in LangSmith. Notice the skill descriptions are visible upfront, but the matching SKILL.md is only read once the agent decides it needs it.
This lab uses a sales assistant with two skills: one for qualifying leads and one for drafting pitches. Using two skills makes the discovery and activation stages visible: both descriptions are always in the system prompt, but only the relevant skill's SKILL.md is read when needed.
All files are already in the repo under python/m3/. Open m3.2_scratch_agent_skills.py and run it directly, or use a coding agent to explore the setup.
qualify-lead/SKILL.mdLocated at python/m3/skills/qualify-lead/SKILL.md:
---
name: qualify-lead
description: Use when the user wants to qualify a sales lead or prospect.
---
# Qualify a Lead
Use the BANT framework to qualify the prospect systematically.
**Step 1: Budget**: Ask what budget range they are working with and how purchasing decisions are made in their organisation.
**Step 2: Authority**: Confirm whether you are speaking with the decision maker. If not, ask who is and whether they can be involved.
**Step 3: Need**: Understand the specific pain point. What problem are they trying to solve? What happens if it stays unsolved?
**Step 4: Timeline**: Ask when they are looking to make a decision and when they would need the solution running.
## Output
After gathering responses, classify the lead and summarise your findings:
- **Qualified**: clear budget, authority confirmed, defined need, decision within 90 days
- **Nurture**: one or more gaps; recommend a follow-up in 30 days
- **Disqualify**: no budget, no authority, or no real need identified
draft-pitch/SKILL.mdLocated at python/m3/skills/draft-pitch/SKILL.md:
---
name: draft-pitch
description: Use when the user wants to write a sales pitch or outreach message for a prospect.
---
# Draft a Sales Pitch
Follow these steps to write a concise, effective pitch.
**Step 1: Research**: Ask for the prospect's company name, their role, and any context about their situation or pain points.
**Step 2: Hook**: Open with one sentence that names the problem they are likely experiencing.
**Step 3: Value proposition**: One to two sentences explaining what the product does and who it is for.
**Step 4: Social proof**: One brief example: "We helped [similar company] achieve [specific result]."
**Step 5: Call to action**: End with a specific, low-friction ask; a 15-minute call or a short reply.
Keep the final pitch under 150 words.
m3.2_scratch_agent_skills.pyHere's how python/m3/m3.2_scratch_agent_skills.py wires the skills into the agent:
# python/m3/m3.2_scratch_agent_skills.py
from pathlib import Path
from deepagents import create_deep_agent
from deepagents.backends.filesystem import FilesystemBackend
from models import model
m3_dir = Path(__file__).parent
backend = FilesystemBackend(root_dir=str(m3_dir), virtual_mode=True)
agent = create_deep_agent(
model=model,
name="Sales_Assistant",
backend=backend,
skills=["/skills"],
system_prompt="You are a sales assistant.",
)
result = agent.invoke({"messages": [{"role": "user", "content": "Qualify this lead: Acme Corp, 200-person logistics company. I spoke with Sarah Chen, VP of Sales: she's the decision maker. They have $45k budgeted for CRM this year. Main pain: deals are slipping through the cracks due to poor pipeline visibility. They want a solution live by end of Q3."}]})
print(result["messages"][-1].text)
Try swapping in either question to see both skills activate:
"Qualify this lead: Acme Corp, 200-person logistics company. I spoke with Sarah Chen, VP of Sales: she's the decision maker. They have $45k budgeted for CRM this year. Main pain: deals are slipping through the cracks due to poor pipeline visibility. They want a solution live by end of Q3.""Write a cold outreach message for a prospect at a mid-size logistics company."Before running it, make sure your model API key from setup is available in the Python environment.
From the repo root:
cd python
uv run ./m3/m3.2_scratch_agent_skills.py
Open the run and check the system message on the first LLM call. You should see a Skills System section listing both skill names and descriptions, but no body content from either SKILL.md. This is discovery.
To see activation, turn on Hidden runs in LangSmith to show the full execution tree, including middleware. Find the read_file entry nested inside FilesystemMiddleware and click into it, then open the Output tab. You will see the full body of whichever skill matched: the BANT steps for a qualify-lead request, or the pitch steps for a draft-pitch request. That is activation: the agent loaded exactly one skill body, on demand, because the task matched its description.
Try both questions in two separate runs and compare which skill body appears in the read_file output.
read_file is called. Write the description to clearly answer: "In what situation should this skill be used?" Keep it brief and specific.
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
Inspect your own run in LangSmith. Notice the skill descriptions are visible upfront, but the matching SKILL.md is only read once the agent decides it needs it.
This lab uses a sales assistant with two skills: one for qualifying leads and one for drafting pitches. Using two skills makes the discovery and activation stages visible: both descriptions are always in the system prompt, but only the relevant skill's SKILL.md is read when needed.
All files are already in the repo under typescript/m3/. Open m3.2_scratch_agent_skills.ts and run it directly, or use a coding agent to explore the setup.
qualify-lead/SKILL.mdLocated at typescript/m3/skills/qualify-lead/SKILL.md:
---
name: qualify-lead
description: Use when the user wants to qualify a sales lead or prospect.
---
# Qualify a Lead
Use the BANT framework to qualify the prospect systematically.
**Step 1: Budget**: Ask what budget range they are working with and how purchasing decisions are made in their organisation.
**Step 2: Authority**: Confirm whether you are speaking with the decision maker. If not, ask who is and whether they can be involved.
**Step 3: Need**: Understand the specific pain point. What problem are they trying to solve? What happens if it stays unsolved?
**Step 4: Timeline**: Ask when they are looking to make a decision and when they would need the solution running.
## Output
After gathering responses, classify the lead and summarise your findings:
- **Qualified**: clear budget, authority confirmed, defined need, decision within 90 days
- **Nurture**: one or more gaps; recommend a follow-up in 30 days
- **Disqualify**: no budget, no authority, or no real need identified
draft-pitch/SKILL.mdLocated at typescript/m3/skills/draft-pitch/SKILL.md:
---
name: draft-pitch
description: Use when the user wants to write a sales pitch or outreach message for a prospect.
---
# Draft a Sales Pitch
Follow these steps to write a concise, effective pitch.
**Step 1: Research**: Ask for the prospect's company name, their role, and any context about their situation or pain points.
**Step 2: Hook**: Open with one sentence that names the problem they are likely experiencing.
**Step 3: Value proposition**: One to two sentences explaining what the product does and who it is for.
**Step 4: Social proof**: One brief example: "We helped [similar company] achieve [specific result]."
**Step 5: Call to action**: End with a specific, low-friction ask; a 15-minute call or a short reply.
Keep the final pitch under 150 words.
m3.2_scratch_agent_skills.tsHere's how typescript/m3/m3.2_scratch_agent_skills.ts wires the skills into the agent:
// typescript/m3/m3.2_scratch_agent_skills.ts
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { context } from "langchain";
import { createDeepAgent, FilesystemBackend } from "deepagents";
import { model } from "../models.js";
const m3Dir = dirname(fileURLToPath(import.meta.url));
const backend = new FilesystemBackend({ rootDir: m3Dir, virtualMode: true });
const agent = createDeepAgent({
model,
name: "Sales_Assistant",
backend,
skills: ["/skills"],
systemPrompt: "You are a sales assistant.",
});
const result = await agent.invoke({
messages: [
{
role: "user",
content: context`
Qualify this lead: Acme Corp, 200-person logistics company. I spoke with
Sarah Chen, VP of Sales: she's the decision maker. They have $45k budgeted
for CRM this year. Main pain: deals are slipping through the cracks due to
poor pipeline visibility. They want a solution live by end of Q3.`,
},
],
});
console.log(result.messages.at(-1)?.text);
Try swapping in either question to see both skills activate:
"Qualify this lead: Acme Corp, 200-person logistics company. I spoke with Sarah Chen, VP of Sales: she's the decision maker. They have $45k budgeted for CRM this year. Main pain: deals are slipping through the cracks due to poor pipeline visibility. They want a solution live by end of Q3.""Write a cold outreach message for a prospect at a mid-size logistics company."Before running it, make sure your model API key from setup is available in the TypeScript environment.
From the repo root:
cd typescript
pnpm tsx ./m3/m3.2_scratch_agent_skills.ts
Open the run and check the system message on the first LLM call. You should see a Skills System section listing both skill names and descriptions, but no body content from either SKILL.md. This is discovery.
To see activation, turn on Hidden runs in LangSmith to show the full execution tree, including middleware. Find the read_file entry nested inside FilesystemMiddleware and click into it, then open the Output tab. You will see the full body of whichever skill matched: the BANT steps for a qualify-lead request, or the pitch steps for a draft-pitch request. That is activation: the agent loaded exactly one skill body, on demand, because the task matched its description.
Try both questions in two separate runs and compare which skill body appears in the read_file output.
read_file is called. Write the description to clearly answer: "In what situation should this skill be used?" Keep it brief and specific.
The lab's two skills, qualify-lead and draft-pitch, are each a single flat SKILL.md file with everything inline. This homework asks you to go one step further: write a skill for a topic or workflow of your choosing (not sales) that bundles a second file, reference.md (holding details the agent needs but that aren't written into SKILL.md itself), then confirm from the trace that the agent actually called read_file on that second file before answering.
Open python/m3/m3.2_homework.py.
SKILL.md content, frontmatter and all, for a workflow of your choosing (planning a workout, reviewing a resume, triaging a bug report, etc.). It must instruct the agent to read reference.md for specific details and must not restate those details inline. The name field in your frontmatter must exactly match SKILL_NAME in the file.reference.md's content, the specific facts, numbers, or template your SKILL.md points to and depends on.description.The script checks the returned messages for a read_file call on your reference.md path and prints whether it found one.
cd python
uv run ./m3/m3.2_homework.py
Stuck, or want to see the finished shape before you start? m3.2_homework_filled.py is a reference copy with every TODO filled in (using a workout-planning skill and a hype personal-trainer persona); run it the same way to see what "done" looks like end to end.
Try to avoid peeking unless you're really stuck. You'll get more out of this by working through the TODOs yourself first.
What you'll build: a skill for a new topic of your choosing (e.g. a trip-planning checklist, a code-review rubric, a meal-prep guide...), with none of the wiring given.
Requirements:
backend (a FilesystemBackend pointed at a real directory, not a temp one) and pick the skills directory layout yourself.skills=[...] shorthand on create_deep_agent, or with SkillsMiddleware(backend=..., sources=[...]) via middleware=[...] for per-source display labels. Write this in a new file under python/m3/.scripts/ subdirectory with a helper script, an extra reference doc, or a config file.SKILL.md by absolute path (the same way it points to reference.md).SKILL.md to just read and reason about the script instead.# Example skill directory layout
skills/
your-skill/
SKILL.md
reference.md
scripts/
helper.py
The lab's two skills, qualify-lead and draft-pitch, are each a single flat SKILL.md file with everything inline. This homework asks you to go one step further: write a skill for a topic or workflow of your choosing (not sales) that bundles a second file, reference.md (holding details the agent needs but that aren't written into SKILL.md itself), then confirm from the trace that the agent actually called read_file on that second file before answering.
Open typescript/m3/m3.2_homework.ts.
SKILL.md content, frontmatter and all, for a workflow of your choosing (planning a workout, reviewing a resume, triaging a bug report, etc.). It must instruct the agent to read reference.md for specific details and must not restate those details inline. The name field in your frontmatter must exactly match SKILL_NAME in the file.reference.md's content, the specific facts, numbers, or template your SKILL.md points to and depends on.description.The script checks the returned messages for a read_file call on your reference.md path and prints whether it found one.
cd typescript
pnpm tsx ./m3/m3.2_homework.ts
Stuck, or want to see the finished shape before you start? m3.2_homework_filled.ts is a reference copy with every TODO filled in (using a workout-planning skill and a hype personal-trainer persona); run it the same way to see what "done" looks like end to end.
Try to avoid peeking unless you're really stuck. You'll get more out of this by working through the TODOs yourself first.
What you'll build: a skill for a new topic of your choosing (e.g. a trip-planning checklist, a code-review rubric, a meal-prep guide...), with none of the wiring given.
Requirements:
backend (a FilesystemBackend pointed at a real directory, not a temp one) and pick the skills directory layout yourself.skills: [...] shorthand on createDeepAgent, or with SkillsMiddleware({ backend, sources }) via middleware: [...] for per-source display labels. Write this in a new file under typescript/m3/.scripts/ subdirectory with a helper script, an extra reference doc, or a config file.SKILL.md by absolute path (the same way it points to reference.md).SKILL.md to just read and reason about the script instead.# Example skill directory layout
skills/
your-skill/
SKILL.md
reference.md
scripts/
helper.py