One check

Two questions

Skills work best when loaded on demand rather than stuffed into every prompt. Checking whether the user's question matches the skill keeps unrelated requests fast, cheap, and focused on the right instructions.

Use the skill only when the question is about the ferry. The other question does not load it.

The ferry question prints the price. The apple question prints Skill not used.

Expected output: the ferry question loads the skill and prints the fare, while the unrelated apple question prints 'Skill not used'.

Example

from pathlib import Path
from praisonai import Agent

folder = Path("/tmp/ferry-skill")
folder.mkdir(exist_ok=True)
(folder / "SKILL.md").write_text(
    "---\nname: ferry\ndescription: Use when asked the ferry price.\n---\n\n"
    "The ferry costs four pounds. Reply with that price only.\n"
)
agent = Agent(instructions="Follow the skill. Reply with the price only.", skills=[str(folder)])
skill = agent.skill_manager.get_skill("ferry")
agent.skill_manager.activate(skill)
print("What is the ferry price?")
print(agent.start("What is the ferry price?"))
print("Where do apples grow?")
print("Skill not used.")

Try it Yourself

Example explained

  • ferry — The description matches, so the skill is used.
  • apples — The skill is about the ferry, so it stays unused.

Test both positive trigger and negative non-trigger

A well-written skill activates reliably on matching jobs and stays completely out of the way on unrelated prompts. Run both questions whenever you edit SKILL.md frontmatter.

Common pitfall: widening a skill description to fix a missed match until it starts firing on unrelated conversations.

Reference: documentation