@buaa_smat/hometrans 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,196 @@
1
+ > ## Documentation Index
2
+ > Fetch the complete documentation index at: https://agentskills.io/llms.txt
3
+ > Use this file to discover all available pages before exploring further.
4
+
5
+ # Optimizing skill descriptions
6
+
7
+ > How to improve your skill's description so it triggers reliably on relevant prompts.
8
+
9
+ A skill only helps if it gets activated. The `description` field in your `SKILL.md` frontmatter is the primary mechanism agents use to decide whether to load a skill for a given task. An under-specified description means the skill won't trigger when it should; an over-broad description means it triggers when it shouldn't.
10
+
11
+ This guide covers how to systematically test and improve your skill's description for triggering accuracy.
12
+
13
+ ## How skill triggering works
14
+
15
+ Agents use [progressive disclosure](/specification#progressive-disclosure) to manage context. At startup, they load only the `name` and `description` of each available skill — just enough to decide when a skill might be relevant. When a user's task matches a description, the agent reads the full `SKILL.md` into context and follows its instructions.
16
+
17
+ This means the description carries the entire burden of triggering. If the description doesn't convey when the skill is useful, the agent won't know to reach for it.
18
+
19
+ One important nuance: agents typically only consult skills for tasks that require knowledge or capabilities beyond what they can handle alone. A simple, one-step request like "read this PDF" may not trigger a PDF skill even if the description matches perfectly, because the agent can handle it with basic tools. Tasks that involve specialized knowledge — an unfamiliar API, a domain-specific workflow, or an uncommon format — are where a well-written description can make the difference.
20
+
21
+ ## Writing effective descriptions
22
+
23
+ Before testing, it helps to know what a good description looks like. A few principles:
24
+
25
+ * **Use imperative phrasing.** Frame the description as an instruction to the agent: "Use this skill when..." rather than "This skill does..." The agent is deciding whether to act, so tell it when to act.
26
+ * **Focus on user intent, not implementation.** Describe what the user is trying to achieve, not the skill's internal mechanics. The agent matches against what the user asked for.
27
+ * **Err on the side of being pushy.** Explicitly list contexts where the skill applies, including cases where the user doesn't name the domain directly: "even if they don't explicitly mention 'CSV' or 'analysis.'"
28
+ * **Keep it concise.** A few sentences to a short paragraph is usually right — long enough to cover the skill's scope, short enough that it doesn't bloat the agent's context across many skills. The [specification](/specification#description-field) enforces a hard limit of 1024 characters.
29
+
30
+ ## Designing trigger eval queries
31
+
32
+ To test triggering, you need a set of eval queries — realistic user prompts labeled with whether they should or shouldn't trigger your skill.
33
+
34
+ ```json eval_queries.json theme={null}
35
+ [
36
+ { "query": "I've got a spreadsheet in ~/data/q4_results.xlsx with revenue in col C and expenses in col D — can you add a profit margin column and highlight anything under 10%?", "should_trigger": true },
37
+ { "query": "whats the quickest way to convert this json file to yaml", "should_trigger": false }
38
+ ]
39
+ ```
40
+
41
+ Aim for about 20 queries: 8-10 that should trigger and 8-10 that shouldn't.
42
+
43
+ ### Should-trigger queries
44
+
45
+ These test whether the description captures the skill's scope. Vary them along several axes:
46
+
47
+ * **Phrasing**: some formal, some casual, some with typos or abbreviations.
48
+ * **Explicitness**: some name the skill's domain directly ("analyze this CSV"), others describe the need without naming it ("my boss wants a chart from this data file").
49
+ * **Detail**: mix terse prompts with context-heavy ones — a short "analyze my sales CSV and make a chart" alongside a longer message with file paths, column names, and backstory.
50
+ * **Complexity**: vary the number of steps and decision points. Include single-step tasks alongside multi-step workflows to test whether the agent can discern the skill is relevant when the task it addresses is buried in a larger chain.
51
+
52
+ The most useful should-trigger queries are ones where the skill would help but the connection isn't obvious from the query alone. These are the cases where description wording makes the difference — if the query already asks for exactly what the skill does, any reasonable description would trigger.
53
+
54
+ ### Should-not-trigger queries
55
+
56
+ The most valuable negative test cases are **near-misses** — queries that share keywords or concepts with your skill but actually need something different. These test whether the description is precise, not just broad.
57
+
58
+ For a CSV analysis skill, weak negative examples would be:
59
+
60
+ * `"Write a fibonacci function"` — obviously irrelevant, tests nothing.
61
+ * `"What's the weather today?"` — no keyword overlap, too easy.
62
+
63
+ Strong negative examples:
64
+
65
+ * `"I need to update the formulas in my Excel budget spreadsheet"` — shares "spreadsheet" and "data" concepts, but needs Excel editing, not CSV analysis.
66
+ * `"can you write a python script that reads a csv and uploads each row to our postgres database"` — involves CSV, but the task is database ETL, not analysis.
67
+
68
+ ### Tips for realism
69
+
70
+ Real user prompts contain context that generic test queries lack. Include:
71
+
72
+ * File paths (`~/Downloads/report_final_v2.xlsx`)
73
+ * Personal context (`"my manager asked me to..."`)
74
+ * Specific details (column names, company names, data values)
75
+ * Casual language, abbreviations, and occasional typos
76
+
77
+ ## Testing whether a description triggers
78
+
79
+ The basic approach: run each query through your agent with the skill installed and observe whether the agent invokes it. Make sure the skill is registered and discoverable by your agent — how this works varies by client (e.g., a skills directory, a configuration file, or a CLI flag).
80
+
81
+ Most agent clients provide some form of observability — execution logs, tool call histories, or verbose output — that lets you see which skills were consulted during a run. Check your client's documentation for details. The skill triggered if the agent loaded your skill's `SKILL.md`; it didn't trigger if the agent proceeded without consulting it.
82
+
83
+ A query "passes" if:
84
+
85
+ * `should_trigger` is `true` and the skill was invoked, or
86
+ * `should_trigger` is `false` and the skill was not invoked.
87
+
88
+ ### Running multiple times
89
+
90
+ Model behavior is nondeterministic — the same query might trigger the skill on one run but not the next. Run each query multiple times (3 is a reasonable starting point) and compute a **trigger rate**: the fraction of runs where the skill was invoked.
91
+
92
+ A should-trigger query passes if its trigger rate is above a threshold (0.5 is a reasonable default). A should-not-trigger query passes if its trigger rate is below that threshold.
93
+
94
+ With 20 queries at 3 runs each, that's 60 invocations. You'll want to script this. Here's the general structure — replace the `claude` invocation and detection logic in `check_triggered` with whatever your agent client provides:
95
+
96
+ ```bash theme={null}
97
+ #!/bin/bash
98
+ QUERIES_FILE="${1:?Usage: $0 <queries.json>}"
99
+ SKILL_NAME="my-skill"
100
+ RUNS=3
101
+
102
+ # This example uses Claude Code's JSON output to check for Skill tool calls.
103
+ # Replace this function with detection logic for your agent client.
104
+ # Should return 0 (success) if the skill was invoked, 1 otherwise.
105
+ check_triggered() {
106
+ local query="$1"
107
+ claude -p "$query" --output-format json 2>/dev/null \
108
+ | jq -e --arg skill "$SKILL_NAME" \
109
+ 'any(.messages[].content[]; .type == "tool_use" and .name == "Skill" and .input.skill == $skill)' \
110
+ > /dev/null 2>&1
111
+ }
112
+
113
+ count=$(jq length "$QUERIES_FILE")
114
+ for i in $(seq 0 $((count - 1))); do
115
+ query=$(jq -r ".[$i].query" "$QUERIES_FILE")
116
+ should_trigger=$(jq -r ".[$i].should_trigger" "$QUERIES_FILE")
117
+ triggers=0
118
+
119
+ for run in $(seq 1 $RUNS); do
120
+ check_triggered "$query" && triggers=$((triggers + 1))
121
+ done
122
+
123
+ jq -n \
124
+ --arg query "$query" \
125
+ --argjson should_trigger "$should_trigger" \
126
+ --argjson triggers "$triggers" \
127
+ --argjson runs "$RUNS" \
128
+ '{query: $query, should_trigger: $should_trigger, triggers: $triggers, runs: $runs, trigger_rate: ($triggers / $runs)}'
129
+ done | jq -s '.'
130
+ ```
131
+
132
+ <Tip>
133
+ If your agent client supports it, you can stop a run early once the outcome is clear — the agent either consulted the skill or started working without it. This can significantly reduce the time and cost of running the full eval set.
134
+ </Tip>
135
+
136
+ ## Avoiding overfitting with train/validation splits
137
+
138
+ If you optimize the description against all your queries, you risk overfitting — crafting a description that works for these specific phrasings but fails on new ones.
139
+
140
+ The solution is to split your query set:
141
+
142
+ * **Train set (\~60%)**: the queries you use to identify failures and guide improvements.
143
+ * **Validation set (\~40%)**: queries you set aside and only use to check whether improvements generalize.
144
+
145
+ Make sure both sets contain a proportional mix of should-trigger and should-not-trigger queries — don't accidentally put all the positives in one set. Shuffle randomly and keep the split fixed across iterations so you're comparing apples to apples.
146
+
147
+ If you're using a script like the one [above](#running-multiple-times), you can split your queries into two files — `train_queries.json` and `validation_queries.json` — and run the script against each one separately.
148
+
149
+ ## The optimization loop
150
+
151
+ 1. **Evaluate** the current description on both *train and validation sets*. The train results guide your changes; the validation results tell you whether those changes are generalizing.
152
+ 2. **Identify failures** in the *train set*: which should-trigger queries didn't trigger? Which should-not-trigger queries did?
153
+ * Only use train set failures to guide your changes — whether you're revising the description yourself or prompting an LLM, keep validation set results out of the process.
154
+ 3. **Revise the description.** Focus on generalizing:
155
+ * If should-trigger queries are failing, the description may be too narrow. Broaden the scope or add context about when the skill is useful.
156
+ * If should-not-trigger queries are false-triggering, the description may be too broad. Add specificity about what the skill does *not* do, or clarify the boundary between this skill and adjacent capabilities.
157
+ * Avoid adding specific keywords from failed queries — that's overfitting. Instead, find the general category or concept those queries represent and address that.
158
+ * If you're stuck after several iterations, try a structurally different approach to the description rather than incremental tweaks. A different framing or sentence structure may break through where refinement can't.
159
+ * Check that the description stays under the 1024-character limit — descriptions tend to grow during optimization.
160
+ 4. **Repeat** steps 1-3 until all *train set* queries pass or you stop seeing meaningful improvement.
161
+ 5. **Select the best iteration** by its validation pass rate — the fraction of queries in the *validation set* that passed. Note that the best description may not be the last one you produced; an earlier iteration might have a higher validation pass rate than later ones that overfit to the train set.
162
+
163
+ Five iterations is usually enough. If performance isn't improving, the issue may be with the queries (too easy, too hard, or poorly labeled) rather than the description.
164
+
165
+ <Tip>
166
+ The [`skill-creator`](https://github.com/anthropics/skills/tree/main/skills/skill-creator) Skill automates this loop end-to-end: it splits the eval set, evaluates trigger rates in parallel, proposes description improvements using Claude, and generates a live HTML report you can watch as it runs.
167
+ </Tip>
168
+
169
+ ## Applying the result
170
+
171
+ Once you've selected the best description:
172
+
173
+ 1. Update the `description` field in your `SKILL.md` frontmatter.
174
+ 2. Verify the description is under the [1024-character limit](/specification#description-field).
175
+ 3. Verify the description triggers as expected. Try a few prompts manually as a quick sanity check. For a more rigorous test, write 5-10 fresh queries (a mix of should-trigger and should-not-trigger) and run them through the eval script — since these queries were never part of the optimization process, they give you an honest check on whether the description generalizes.
176
+
177
+ Before and after:
178
+
179
+ ```yaml theme={null}
180
+ # Before
181
+ description: Process CSV files.
182
+
183
+ # After
184
+ description: >
185
+ Analyze CSV and tabular data files — compute summary statistics,
186
+ add derived columns, generate charts, and clean messy data. Use this
187
+ skill when the user has a CSV, TSV, or Excel file and wants to
188
+ explore, transform, or visualize the data, even if they don't
189
+ explicitly mention "CSV" or "analysis."
190
+ ```
191
+
192
+ The improved description is more specific about what the skill does (summary stats, derived columns, charts, cleaning) and broader about when it applies (CSV, TSV, Excel; even without explicit keywords).
193
+
194
+ ## Next steps
195
+
196
+ Once your skill triggers reliably, you'll want to evaluate whether it produces good outputs. See [Evaluating skill output quality](/skill-creation/evaluating-skills) for how to set up test cases, grade results, and iterate.
@@ -0,0 +1,272 @@
1
+ > ## Documentation Index
2
+ > Fetch the complete documentation index at: https://agentskills.io/llms.txt
3
+ > Use this file to discover all available pages before exploring further.
4
+
5
+ # Specification
6
+
7
+ > The complete format specification for Agent Skills.
8
+
9
+ ## Directory structure
10
+
11
+ A skill is a directory containing, at minimum, a `SKILL.md` file:
12
+
13
+ ```
14
+ skill-name/
15
+ ├── SKILL.md # Required: metadata + instructions
16
+ ├── scripts/ # Optional: executable code
17
+ ├── references/ # Optional: documentation
18
+ ├── assets/ # Optional: templates, resources
19
+ └── ... # Any additional files or directories
20
+ ```
21
+
22
+ ## `SKILL.md` format
23
+
24
+ The `SKILL.md` file must contain YAML frontmatter followed by Markdown content.
25
+
26
+ ### Frontmatter
27
+
28
+ | Field | Required | Constraints |
29
+ | --------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
30
+ | `name` | Yes | Max 64 characters. Lowercase letters, numbers, and hyphens only. Must not start or end with a hyphen. |
31
+ | `description` | Yes | Max 1024 characters. Non-empty. Describes what the skill does and when to use it. |
32
+ | `license` | No | License name or reference to a bundled license file. |
33
+ | `compatibility` | No | Max 500 characters. Indicates environment requirements (intended product, system packages, network access, etc.). |
34
+ | `metadata` | No | Arbitrary key-value mapping for additional metadata. |
35
+ | `allowed-tools` | No | Space-separated string of pre-approved tools the skill may use. (Experimental) |
36
+
37
+ <Card>
38
+ **Minimal example:**
39
+
40
+ ```markdown SKILL.md theme={null}
41
+ ---
42
+ name: skill-name
43
+ description: A description of what this skill does and when to use it.
44
+ ---
45
+ ```
46
+
47
+ **Example with optional fields:**
48
+
49
+ ```markdown SKILL.md theme={null}
50
+ ---
51
+ name: pdf-processing
52
+ description: Extract PDF text, fill forms, merge files. Use when handling PDFs.
53
+ license: Apache-2.0
54
+ metadata:
55
+ author: example-org
56
+ version: "1.0"
57
+ ---
58
+ ```
59
+ </Card>
60
+
61
+ #### `name` field
62
+
63
+ The required `name` field:
64
+
65
+ * Must be 1-64 characters
66
+ * May only contain unicode lowercase alphanumeric characters (`a-z`, `0-9`) and hyphens (`-`)
67
+ * Must not start or end with a hyphen (`-`)
68
+ * Must not contain consecutive hyphens (`--`)
69
+ * Must match the parent directory name
70
+
71
+ <Card>
72
+ **Valid examples:**
73
+
74
+ ```yaml theme={null}
75
+ name: pdf-processing
76
+ ```
77
+
78
+ ```yaml theme={null}
79
+ name: data-analysis
80
+ ```
81
+
82
+ ```yaml theme={null}
83
+ name: code-review
84
+ ```
85
+
86
+ **Invalid examples:**
87
+
88
+ ```yaml theme={null}
89
+ name: PDF-Processing # uppercase not allowed
90
+ ```
91
+
92
+ ```yaml theme={null}
93
+ name: -pdf # cannot start with hyphen
94
+ ```
95
+
96
+ ```yaml theme={null}
97
+ name: pdf--processing # consecutive hyphens not allowed
98
+ ```
99
+ </Card>
100
+
101
+ #### `description` field
102
+
103
+ The required `description` field:
104
+
105
+ * Must be 1-1024 characters
106
+ * Should describe both what the skill does and when to use it
107
+ * Should include specific keywords that help agents identify relevant tasks
108
+
109
+ <Card>
110
+ **Good example:**
111
+
112
+ ```yaml theme={null}
113
+ description: Extracts text and tables from PDF files, fills PDF forms, and merges multiple PDFs. Use when working with PDF documents or when the user mentions PDFs, forms, or document extraction.
114
+ ```
115
+
116
+ **Poor example:**
117
+
118
+ ```yaml theme={null}
119
+ description: Helps with PDFs.
120
+ ```
121
+ </Card>
122
+
123
+ #### `license` field
124
+
125
+ The optional `license` field:
126
+
127
+ * Specifies the license applied to the skill
128
+ * We recommend keeping it short (either the name of a license or the name of a bundled license file)
129
+
130
+ <Card>
131
+ **Example:**
132
+
133
+ ```yaml theme={null}
134
+ license: Proprietary. LICENSE.txt has complete terms
135
+ ```
136
+ </Card>
137
+
138
+ #### `compatibility` field
139
+
140
+ The optional `compatibility` field:
141
+
142
+ * Must be 1-500 characters if provided
143
+ * Should only be included if your skill has specific environment requirements
144
+ * Can indicate intended product, required system packages, network access needs, etc.
145
+
146
+ <Card>
147
+ **Examples:**
148
+
149
+ ```yaml theme={null}
150
+ compatibility: Designed for Claude Code (or similar products)
151
+ ```
152
+
153
+ ```yaml theme={null}
154
+ compatibility: Requires git, docker, jq, and access to the internet
155
+ ```
156
+
157
+ ```yaml theme={null}
158
+ compatibility: Requires Python 3.14+ and uv
159
+ ```
160
+ </Card>
161
+
162
+ <Note>
163
+ Most skills do not need the `compatibility` field.
164
+ </Note>
165
+
166
+ #### `metadata` field
167
+
168
+ The optional `metadata` field:
169
+
170
+ * A map from string keys to string values
171
+ * Clients can use this to store additional properties not defined by the Agent Skills spec
172
+ * We recommend making your key names reasonably unique to avoid accidental conflicts
173
+
174
+ <Card>
175
+ **Example:**
176
+
177
+ ```yaml theme={null}
178
+ metadata:
179
+ author: example-org
180
+ version: "1.0"
181
+ ```
182
+ </Card>
183
+
184
+ #### `allowed-tools` field
185
+
186
+ The optional `allowed-tools` field:
187
+
188
+ * A space-separated string of tools that are pre-approved to run
189
+ * Experimental. Support for this field may vary between agent implementations
190
+
191
+ <Card>
192
+ **Example:**
193
+
194
+ ```yaml theme={null}
195
+ allowed-tools: Bash(git:*) Bash(jq:*) Read
196
+ ```
197
+ </Card>
198
+
199
+ ### Body content
200
+
201
+ The Markdown body after the frontmatter contains the skill instructions. There are no format restrictions. Write whatever helps agents perform the task effectively.
202
+
203
+ Recommended sections:
204
+
205
+ * Step-by-step instructions
206
+ * Examples of inputs and outputs
207
+ * Common edge cases
208
+
209
+ Note that the agent will load this entire file once it's decided to activate a skill. Consider splitting longer `SKILL.md` content into referenced files.
210
+
211
+ ## Optional directories
212
+
213
+ ### `scripts/`
214
+
215
+ Contains executable code that agents can run. Scripts should:
216
+
217
+ * Be self-contained or clearly document dependencies
218
+ * Include helpful error messages
219
+ * Handle edge cases gracefully
220
+
221
+ Supported languages depend on the agent implementation. Common options include Python, Bash, and JavaScript.
222
+
223
+ ### `references/`
224
+
225
+ Contains additional documentation that agents can read when needed:
226
+
227
+ * `REFERENCE.md` - Detailed technical reference
228
+ * `FORMS.md` - Form templates or structured data formats
229
+ * Domain-specific files (`finance.md`, `legal.md`, etc.)
230
+
231
+ Keep individual [reference files](#file-references) focused. Agents load these on demand, so smaller files mean less use of context.
232
+
233
+ ### `assets/`
234
+
235
+ Contains static resources:
236
+
237
+ * Templates (document templates, configuration templates)
238
+ * Images (diagrams, examples)
239
+ * Data files (lookup tables, schemas)
240
+
241
+ ## Progressive disclosure
242
+
243
+ Agents load skills *progressively*, pulling in more detail only as a task calls for it. Skills should be structured to take advantage of this:
244
+
245
+ 1. **Metadata** (\~100 tokens): The `name` and `description` fields are loaded at startup for all skills
246
+ 2. **Instructions** (\< 5000 tokens recommended): The full `SKILL.md` body is loaded when the skill is activated
247
+ 3. **Resources** (as needed): Files (e.g. those in `scripts/`, `references/`, or `assets/`) are loaded only when required
248
+
249
+ Keep your main `SKILL.md` under 500 lines. Move detailed reference material to separate files.
250
+
251
+ ## File references
252
+
253
+ When referencing other files in your skill, use relative paths from the skill root:
254
+
255
+ ```markdown SKILL.md theme={null}
256
+ See [the reference guide](references/REFERENCE.md) for details.
257
+
258
+ Run the extraction script:
259
+ scripts/extract.py
260
+ ```
261
+
262
+ Keep file references one level deep from `SKILL.md`. Avoid deeply nested reference chains.
263
+
264
+ ## Validation
265
+
266
+ Use the [skills-ref](https://github.com/agentskills/agentskills/tree/main/skills-ref) reference library to validate your skills:
267
+
268
+ ```bash theme={null}
269
+ skills-ref validate ./my-skill
270
+ ```
271
+
272
+ This checks that your `SKILL.md` frontmatter is valid and follows all naming conventions.