chore: import upstream snapshot with attribution
Validate YAML Workflows / Validate YAML Configuration Files (push) Has been cancelled
Validate YAML Workflows / Validate YAML Configuration Files (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: python-scratchpad
|
||||
description: Use the existing Python execution tools as a scratchpad for calculations, data transformation, and quick script-based validation.
|
||||
allowed-tools: execute_code
|
||||
---
|
||||
|
||||
# Python Scratchpad
|
||||
|
||||
Use this skill when the task benefits from a short Python script instead of pure reasoning.
|
||||
|
||||
This skill is especially useful for:
|
||||
- arithmetic and unit conversions
|
||||
- validating regexes or parsing logic
|
||||
- transforming JSON, CSV, or small text payloads
|
||||
- checking assumptions with a small reproducible script
|
||||
|
||||
Requirements:
|
||||
- The agent should have access to `execute_code`.
|
||||
|
||||
Workflow:
|
||||
1. If the task needs computation or a repeatable transformation, activate this skill.
|
||||
2. If you need examples, call `read_skill_file` for `references/examples.md`.
|
||||
3. Write a short Python script for the exact task.
|
||||
4. Prefer `execute_code`.
|
||||
5. Use the script output in the final answer.
|
||||
6. Keep scripts small and task-specific.
|
||||
|
||||
Rules:
|
||||
1. Prefer standard library Python.
|
||||
2. Print only the values you need.
|
||||
3. Do not invent outputs without running the script.
|
||||
4. If `execute_code` is not available, say exactly: `No Python execution tool is configured for this agent.`
|
||||
5. Do not claim there is a generic execution-environment problem unless a tool call actually returned such an error.
|
||||
|
||||
Expected behavior:
|
||||
- Explain the result briefly after using the script.
|
||||
- Include the computed value or transformed output in the final answer.
|
||||
@@ -0,0 +1,45 @@
|
||||
# Python Scratchpad Examples
|
||||
|
||||
Example: sum a list of numbers
|
||||
|
||||
```python
|
||||
numbers = [14, 27, 31, 8]
|
||||
print(sum(numbers))
|
||||
```
|
||||
|
||||
Expected structured result with `execute_code`:
|
||||
|
||||
```json
|
||||
{
|
||||
"ok": true,
|
||||
"exit_code": 0,
|
||||
"stdout": "80\n",
|
||||
"stderr": ""
|
||||
}
|
||||
```
|
||||
|
||||
Example: convert JSON to a sorted compact structure
|
||||
|
||||
```python
|
||||
import json
|
||||
|
||||
payload = {"b": 2, "a": 1, "nested": {"z": 3, "x": 2}}
|
||||
print(json.dumps(payload, sort_keys=True))
|
||||
```
|
||||
|
||||
Example: count words in text
|
||||
|
||||
```python
|
||||
text = "agent skills can trigger targeted workflows"
|
||||
print(len(text.split()))
|
||||
```
|
||||
|
||||
Example: test a regex
|
||||
|
||||
```python
|
||||
import re
|
||||
|
||||
text = "Order IDs: ORD-100, BAD-7, ORD-215"
|
||||
matches = re.findall(r"ORD-\d+", text)
|
||||
print(matches)
|
||||
```
|
||||
Reference in New Issue
Block a user