Skills Description Optimization Techniques
The description field is the sole criterion for Skill triggering.
A well-written description allows a Skill to be triggered at the right time and avoids interfering with Claude in irrelevant scenarios.
The Role and Limitations of Description
When deciding whether to use a Skill, Claude only reads the description field and does not read the SKILL.md body in advance.
This means the description needs to accomplish two things at once: explain what the Skill can do and indicate when it should be used.
The ideal length of a description is 50-150 words. Too short leads to inaccurate triggering; too long may exceed context limits and make it hard for Claude to scan and compare quickly.
The Four-Element Structure of Description
| Element | Purpose | Example |
|---|---|---|
| One-sentence core function | State most directly what the Skill is | "Process tabular data in Excel and CSV formats" |
| Enumeration of specific capabilities | List 3-5 typical operations | "Including data cleaning, statistical analysis, and chart generation" |
| Triggering scenario description | Tell Claude when it should be used | "Trigger when the user mentions data analysis, reports, or statistics" |
| Promoting statement (optional) | Solve the "low trigger rate" problem | "Even if the user does not explicitly mention the format, use it whenever tabular data is involved" |
---
name: data-analyzer
description: >
处理 Excel(.xlsx)和 CSV 格式的表格数据,包括数据读取、
清洗去重、统计分析(均值/中位数/分布)、生成可视化报告。
当用户需要分析数据文件、生成统计报告、处理表格、
查找数据规律时应优先使用此 Skill,即使用户只是上传了
一个数据文件并询问"帮我看看这个"。
---
Common Description Writing Problems
| Problem | Example (incorrect) | Correction direction |
|---|---|---|
| Only writing functions, not triggering scenarios | "A tool for analyzing data" | Add "trigger when the user..." |
| Description too broad | "A general tool for processing files" | List specific file types and operations |
| Using the Skill's internal implementation terminology | "Call pandas for analysis" | Change to a business description from the user's perspective |
| Unclear boundaries with other Skills | Two Skills both write "process documents" | Clearly distinguish each one's file types or operation types |
Using Automated Tools to Optimize the Description
skill-creator provides an automatic description optimization script that finds the wording with the highest trigger rate through iterative testing.
Step One: Prepare test cases
Example
[
{
"id"
:
"should_trigger_01"
,
"prompt"
:
"Help me analyze runoob_sales.csv and find the monthly sales trend"
,
"expected"
:
true
,
"note"
:
"A typical data analysis request"
}
,
{
"id"
:
"should_trigger_02"
,
"prompt"
:
"Which columns in this Excel file have empty values? Help me count them"
,
"expected"
:
true
,
"note"
:
"Involves data quality checking"
}
,
{
"id"
:
"should_not_trigger_01"
,
"prompt"
:
"What is the difference between Excel and CSV?"
,
"expected"
:
false
,
"note"
:
"Knowledge Q&A, no Skill needed"
}
,
{
"id"
:
"should_not_trigger_02"
,
"prompt"
:
"Help me write an email"
,
"expected"
:
false
,
"note"
:
"A completely unrelated task"
}
]
Step Two: Run the optimization loop
Example
Run automatic description optimization
The script automatically: evaluate -> modify -> re-evaluate, looping 5 times
python
-m
scripts.run_loop \
--eval-set
evals
/
trigger-eval.json \
--skill-path
data-analyzer
/
\
--model
claude-sonnet-
4
20250514
\
--max-iterations
5
\
--verbose
迭代 1:训练集得分 0.62,测试集得分 0.60
迭代 2:训练集得分 0.75,测试集得分 0.72
迭代 3:训练集得分 0.87,测试集得分 0.85
迭代 4:训练集得分 0.90,测试集得分 0.88
迭代 5:训练集得分 0.91,测试集得分 0.89
最优 description(测试集得分 0.89)已保存。
Step Three: Apply the optimal result
Example
The script outputs the best_description field; replace the description in SKILL.md with it
Before optimization
grep
"description:"
data-analyzer
/
SKILL.md
Manually or via a script, replace with the content of best_description
Repackage the Skill after replacement
python
-m
scripts.package_skill data-analyzer
/
A/B Comparison Testing
When unsure which wording is better, you can perform a blind comparison test on two versions of the description.
Example
Version A: current description
Version B: candidate new description
Run evaluations separately
python
-m
scripts.run_eval \
--eval-set
evals
/
trigger-eval.json \
--skill-path
data-analyzer-v1
/
\
--output
evals
/
results_v1.json
python
-m
scripts.run_eval \
--eval-set
evals
/
trigger-eval.json \
--skill-path
data-analyzer-v2
/
\
--output
evals
/
results_v2.json
Generate a comparison report
python eval-viewer
/
generate_review.py \
--results
evals
/
results_v1.json evals
/
results_v2.json \
--compare
\
--output
evals
/
comparison.html
Evaluation should be based on test set scores rather than training set scores. A high training set score but a low test set score indicates the description overfits the test cases and may perform worse in real scenarios.