
Make your AI skills more predictable with scripts
An AI skill gives an agent the resources it needs to complete a specific job. For example, a "website-design" skill gives an agent the ability to design websites.
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Dhruv Dang Principal Software Engineer, Steadily
An AI skill gives an agent the resources it needs to complete a specific job. For example, a "website-design" skill gives an agent the ability to design websites.
A skill is implemented as a folder containing a SKILL.md file with a name, description, and instructions. It can also contain scripts, reference documents, and other resources. Agents can load the instructions when they're relevant and run the bundled scripts when needed.
For example, the docx skill by Anthropic bundles scripts and instructions to give agents the ability to edit Microsoft Word documents.
Let's imagine we run a HealthTech company that serves Canadian pharmacies with 10 to 100 employees, and we use a skill to find potential customers. Let's refactor it.
Here's how our find-leads skill's instructions are defined in SKILL.md:
name: find-leads description: Find and save potential customers that match our target criteria.
Find Canadian pharmacies with 10 to 100 employees.
Search the web for potential customers. For each candidate, collect its name, website, country, employee count, available contact details, and the source URLs supporting those details.
Save companies that match our criteria to our CRM.
While this skill explains the job, it doesn't define how to:
We could simply add more instructions, but we’d still be relying on the agent to fill in any gaps with its own judgement. If we make these tasks explicit in code, the agent no longer has to guess how we want them done.
So, let’s expand our skill by giving it three scripts:
find-leads/ ├── SKILL.md └── scripts/ ├── web_search.js ├── qualify_lead.js └── store_lead.js
Each script handles a specific task:
As you can see, the introduction of these scripts gives us a lot more control over how the agent acts in its lead generation process by letting us encode business rules in each of them. However, we still need to instruct our agent to use these scripts in SKILL.md. Here’s an updated set of instructions doing just that:
name: find-leads description: Find and save potential customers using the bundled lead-generation scripts.
Find Canadian pharmacies with 10 to 100 employees. Use the bundled scripts for searching, qualification, and storage.
Run the commands below from this skill's directory.
-
Search with:
./scripts/web_search.js "<search query>" -
Investigate candidates and prepare a JSON file for each lead. Include its name, website, country, employee count, available contact details, and supporting source URLs. Leave unknown fields null.
-
Qualify each candidate with:
./scripts/qualify_lead.js "<path to lead JSON file>" -
Only save candidates classified as qualified, using:
./scripts/store_lead.js "<path to lead JSON file>" -
Report what was saved, disqualified, or left unknown. Explain any script failures instead of claiming success.
Notice how the updated instructions read much more like a defined process. The agent still does what it's good at: choosing search queries, investigating candidates, and turning messy web pages into structured lead details. The scripts handle the steps where we've already decided how the work should be done. The result is a more predictable lead generation workflow, and one we can improve over time. As we measure the quality of the leads it produces, we can refine the scripts accordingly.
This version is also easier to change than the original. Each part of the process now lives in one place. To add an external lead generation service, we update web_search.js. To start targeting pharmacies in the US, we update qualify_lead.js. If we switch CRMs, we update store_lead.js. The skill is more efficient, too: the agent no longer spends tokens and time working out how to search, qualify, and save leads, because the scripts already do that work.
Note: I chose not to show the implementation of this example’s scripts in this edition as I felt it was out of scope. But if you’re interested in building a system like this for your business and would like to collaborate, just reply to this email and let me know.
To apply this concept in your own AI practice, have a look through your skills, prompt library, or chat history. Find a task you often repeat and ask: which parts should work the same way every time? Here are a few ideas:
You can also build agents by combining skills. For example, an agent focused on social media marketing could research topics, draft campaigns, schedule posts, deploy custom landing pages, and save campaign performance to memory.
Which skills would have the greatest impact on your business? How could you break each one down into a process, and which steps could you implement as scripts?
Skills let you customize what your agent can do. Bundling scripts with a skill gives you more control over how specific tasks are performed. In our lead-generation example, the agent handles work that benefits from judgement, such as researching and interpreting candidates, while three scripts manage searching, qualification, and storage. This made the skill’s behaviour more predictable and, ultimately, the agent more reliable.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。