mantle-skill-authoring
Write or fix a Rasa Mantle skill.md. Use when creating a new skill, when a skill's conditional branches never fire, when memory values appear as literal text in replies, or when designing skill activation/routing.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 44
- Forks
- 19
01 前言 Front Matter
- name
- mantle-skill-authoring
- description
- Write or fix a Rasa Mantle skill.md. Use when creating a new skill, when a skill's conditional branches never fire, when memory values appear as literal text in replies, or when designing skill activation/routing.
03 SKILL.md 正文
skill.md — three languages in one file
A skill.md is three different languages stacked, and most authoring bugs come from treating them as one:
- YAML frontmatter — structured config, never prose.
- Markdown body — instruction prose the LLM reads, EXCEPT top-level
if:. :::block … :::regions — YAML again; onlyinstructions:scalar bodies inside them are prose.
1. Frontmatter
---
name: Check Balance
description: >
Tell the caller the balance of one account. Activate for balance, how much
is in my account, or available funds.
import_tools: # shared tools from the project-level tools/ dir
- get_customer_info
tool_constraints: # gate a tool on a memory field being set
- get_recent_transactions:
requires: session.view_transactions.selected_account_id
routing:
engine_managed: true # for openers like session-start skills
---
The description doubles as the activation hint — write the trigger phrases
into it ("Activate for X, Y, or Z"), it is how the router matches requests
to skills.
2. Body prose — what substitutes and what doesn't
@memory.<namespace>.<entry>— exactly three dot-separated parts — is substituted with the live value.@memory.project.customer_nameworks;@memory.customer_nameis dead text delivered to the LLM verbatim.- Raw
session.x.yin prose is never substituted. It belongs inif:conditions andtool_constraints, nowhere else. If you need the value in prose, use the@memoryform.
3. Branching — if: at column 0 only
if: not session.view_transactions.selected_account_id and session.project.default_account_id
The customer has a usual account on file: @memory.project.default_account_label.
Offer that one first by name. If they say yes, set `selected_account_id` via
`set_fields` to @memory.project.default_account_id.
if: session.view_transactions.selected_account_id
Call `get_recent_transactions` for the selected account and present the rows
briefly (date, merchant, amount).
- Conditions reference
session.<skill_id>.<field>(this skill's memory) andsession.project.<field>(project memory), combined withnot/and. - An indented
if:is not parsed as a condition — it stays instruction prose and your branch silently never branches. If you want a conditional inside a paragraph, express it in natural language instead. - Write branch sets that cover the state space: typically
not set and have-default/not set and no-default/set.
4. Deterministic sequences — ordered blocks
For fixed step sequences (e.g. a session opener), skip prose entirely:
:::ordered_block id=main
steps:
- id: identify
execute_tool: get_customer_profile
- id: greet
action: utter_greet
:::
5. Skill-scoped memory — skills/<id>/memory.yml
This is where llm_settable belongs (NOT the root memory.yml):
schema:
public:
account_number:
type: text
description: Account the caller asked about.
llm_settable: true
The LLM writes these via set_fields; instruct it explicitly in prose:
"set selected_account_id via set_fields to the matching id from the tool
result" — and name what it must NOT set or invent.
6. Style rules that ship in every good skill here
- One skill = one user goal. Local tools in
skills/<id>/tools.py; anything two skills need moves totools/+import_tools. - State the negative space: "Never state a balance in that case", "Do not invent accounts". Mantle personas follow prohibitions well when explicit.
- Hand off across skills through project memory, not prose assumptions:
"
fetch_balancereads the signed-in customer from project memory, so it is the authority on whether the caller is verified."
7. Verify
python3 scripts/lint_mantle.py --check nested-if --check skill-prose — then
make validate for the engine's own view.
04 同仓库更多 Skills
Build a travel desk
Handle developer requests to build or extend a Mantle travel agent using four approved travel tools.
Travel briefing
Answer questions about flight status, tonight’s departures, airport weather and currency conversion.
Review Dispute
Ask the outside reviewer about a card dispute, then block the card if the caller confirms. Activate when the caller reports a card transaction they did not make.
Block Card
Block a customer's lost or stolen card. Activate when the caller wants a card blocked.
Block Card
Block a customer's lost or stolen card. Activate when the caller wants a card blocked.
Block Card
Block a customer's lost or stolen card. Activate when the caller wants a card blocked.