119
### 4. execute skill script
120
121
Executes bundled scripts from skill with arguments
122
-Scripts run in sandbox with injected arguments
122
+Scripts receive arguments via standard CLI conventions (sys.argv, process.argv)
123
Use when: skill provides script for deterministic operation or automation
124
125
~~~json
126
{
127
"thoughts": [
128
- "Need to extract PDF form fields programmatically",
129
- "Skill provides extract_fields.py script",
130
- "Executing with target PDF path"
128
+ "Need to convert PDF to images",
129
+ "Skill provides convert_pdf_to_images.py script",
130
+ "Script expects positional args: input_pdf output_dir"
131
],
132
- "headline": "Executing PDF field extraction script",
132
+ "headline": "Converting PDF to images",
133
"tool_name": "skills_tool",
134
"tool_args": {
135
"method": "execute_script",
136
"skill_name": "pdf_editing",
137
- "script_path": "scripts/extract_fields.py",
137
+ "script_path": "scripts/convert_pdf_to_images.py",
138
"script_args": {
139
- "pdf_path": "/path/to/form.pdf",
140
- "output_format": "json"
139
+ "input_pdf": "/path/to/document.pdf",
140
+ "output_dir": "/tmp/images"
141
}
142
}
143
}
148
- script_path: relative path to script file
149
- script_args: dictionary of arguments passed to script
150
151
-Supported script types:
152
-- .py (Python): args injected as _skill_args dictionary
153
-- .js (Node.js): args injected as _skill_args constant
154
-- .sh (Shell): args exported as environment variables
151
+Optional args:
152
+- arg_style: how to pass arguments to script (default: "positional")
153
+ - "positional": values as positional args → sys.argv = ['script.py', 'value1', 'value2']
154
+ - "named": as --key value pairs → sys.argv = ['script.py', '--key1', 'value1', '--key2', 'value2']
155
+ - "env": only environment variables, no CLI args
156
+
157
+How scripts receive arguments:
158
+- .py (Python): sys.argv[1], sys.argv[2], etc. (standard argparse/CLI compatible)
159
+- .js (Node.js): process.argv[2], process.argv[3], etc. (standard CLI compatible)
160
+- .sh (Shell): $1, $2, etc. as positional parameters
161
+
162
+Environment variables (always available as fallback):
163
+- SKILL_ARG_KEY1=value1, SKILL_ARG_KEY2=value2, etc.
164
+- Scripts can use os.environ.get('SKILL_ARG_INPUT_PDF') if needed
165
166
Script execution:
167
- Runs in Docker container sandbox
169
- Returns stdout/stderr output
170
- Secure and isolated execution
171
172
+Example with argparse script (use arg_style="named"):
173
+~~~json
174
+{
175
+ "thoughts": [
176
+ "Script uses argparse with --input and --output flags",
177
+ "Need to use named arg_style"
178
+ ],
179
+ "headline": "Running argparse-based script",
180
+ "tool_name": "skills_tool",
181
+ "tool_args": {
182
+ "method": "execute_script",
183
+ "skill_name": "data_processor",
184
+ "script_path": "scripts/process.py",
185
+ "script_args": {
186
+ "input": "/path/to/data.csv",
187
+ "output": "/tmp/result.json"
188
+ },
189
+ "arg_style": "named"
190
+ }
191
+}
192
+~~~
193
+
194
### 5. search skills by query
195
196
Searches skills by text matching in name, description, and tags
296
297
## Examples
298
267
-Example 1: PDF form field extraction
299
+Example 1: Simple script with positional args (default)
300
+Script expects: python script.py /path/to/file.pdf
301
~~~json
302
{
303
"thoughts": [
271
- "User has PDF form to analyze",
272
- "pdf_editing skill has extraction capabilities",
273
- "Will load skill and execute extraction script"
304
+ "User has PDF to convert to images",
305
+ "Script uses sys.argv[1] for input, sys.argv[2] for output",
306
+ "Using default positional arg_style"
307
],
275
- "headline": "Extracting PDF form fields",
308
+ "headline": "Converting PDF to images",
309
"tool_name": "skills_tool",
310
"tool_args": {
311
"method": "execute_script",
312
"skill_name": "pdf_editing",
280
- "script_path": "scripts/extract_fields.py",
313
+ "script_path": "scripts/convert_pdf_to_images.py",
314
"script_args": {
282
- "pdf_path": "/workspace/application.pdf"
315
+ "input_pdf": "/workspace/document.pdf",
316
+ "output_dir": "/tmp/images"
317
}
318
}
319
}
320
~~~
321
+Result: sys.argv = ['script.py', '/workspace/document.pdf', '/tmp/images']
322
288
-Example 2: Web scraping with custom selector
323
+Example 2: Argparse script with named args
324
+Script expects: python script.py --url https://... --selector .price
325
~~~json
326
{
327
"thoughts": [
328
"Need to scrape product prices from website",
293
- "web_scraping skill provides fetch script",
294
- "Using CSS selector to target price elements"
329
+ "Script uses argparse with --url and --selector flags",
330
+ "Using arg_style='named' for argparse compatibility"
331
],
332
"headline": "Scraping product prices from webpage",
333
"tool_name": "skills_tool",
338
"script_args": {
339
"url": "https://example.com/products",
340
"selector": ".price"
305
- }
341
+ },
342
+ "arg_style": "named"
343
+ }
344
+}
345
+~~~
346
+Result: sys.argv = ['script.py', '--url', 'https://...', '--selector', '.price']
347
+
348
+Example 3: Environment-only script
349
+Script reads from os.environ only
350
+~~~json
351
+{
352
+ "thoughts": [
353
+ "Script reads configuration from environment variables",
354
+ "Using arg_style='env' to only set env vars"
355
+ ],
356
+ "headline": "Running config-based processor",
357
+ "tool_name": "skills_tool",
358
+ "tool_args": {
359
+ "method": "execute_script",
360
+ "skill_name": "data_processor",
361
+ "script_path": "scripts/process.py",
362
+ "script_args": {
363
+ "input_file": "/data/input.csv",
364
+ "mode": "production"
365
+ },
366
+ "arg_style": "env"
367
}
368
}
369
~~~
370
+Result: SKILL_ARG_INPUT_FILE=/data/input.csv, SKILL_ARG_MODE=production
371
310
-Example 3: Data analysis workflow
372
+Example 4: Data analysis workflow
373
~~~json
374
{
375
"thoughts": [
386
}
387
~~~
388
327
-Then follow up with script:
389
+Then follow up with script (positional args):
390
~~~json
391
{
392
"thoughts": [
331
- "Skill loaded, now analyzing CSV with grouping",
332
- "Using analyze_csv script with group_by parameter"
393
+ "Skill loaded, now analyzing CSV",
394
+ "Script takes csv_path as first arg, group_by as second"
395
],
396
"headline": "Analyzing sales data grouped by category",
397
"tool_name": "skills_tool",
412
- Skills metadata already loaded in your system prompt
413
- Skills cache after first load for efficiency
414
- Referenced files listed in load response
353
-- Scripts inject arguments as _skill_args variable
415
+- Scripts receive arguments via sys.argv (positional by default) + SKILL_ARG_* env vars
416
+- Use arg_style parameter to control argument passing: "positional", "named", or "env"
417
- All operations return formatted text responses
418
- Skills follow the open SKILL.md standard (cross-platform compatible)
419
- Use skills for structured procedures and contextual expertise