Documentation Index
Fetch the complete documentation index at: https://docs.selftune.dev/llms.txt
Use this file to discover all available pages before exploring further.
When to use scripts
Skills are markdown — they tell the agent what to do using natural language. Scripts are code — they do things deterministically. The question is: which parts of your skill belong in each? Use markdown for judgment: choosing an approach, interpreting user intent, adapting to context. Use scripts for mechanics: validation, data transformation, formatting, API calls with fixed parameters. A useful heuristic from the agent skills spec: if the agent reinvents the same logic every run, bundle it as a tested script.Two approaches
Reference existing packages
When an existing package does what you need, reference it directly in your SKILL.md without bundling scripts:| Runner | Ecosystem | Example |
|---|---|---|
npx / bunx | Node.js | npx [email protected] . |
uvx / pipx | Python | uvx ruff check . |
deno run | Deno | deno run jsr:@std/csv |
go run | Go | go run golang.org/x/tools/cmd/stringer@latest |
Bundle scripts in the skill
When you need custom logic, put scripts in ascripts/ directory:
Self-contained scripts
The best scripts declare their own dependencies inline, so there’s nothing to install:Python (PEP 723)
uv run scripts/extract.py https://example.com
TypeScript (Bun)
bun scripts/generate.ts --input data.json
Designing scripts for agents
Agents run scripts in non-interactive shells. The agent skills spec has specific design requirements:No interactive prompts (hard requirement)
Any TTY prompt will hang indefinitely. Accept all input via flags, environment variables, or stdin:Document with --help
This is how the agent learns your script’s interface:
Actionable error messages
Error messages should tell the agent exactly what to do next:Structured output
Prefer JSON or CSV over free-form text. Separate data (stdout) from diagnostics (stderr):Design checklist
| Consideration | Guidance |
|---|---|
| Idempotency | Agents may retry. Use “create if not exists” patterns. |
| Dry-run support | Add --dry-run for destructive or stateful operations. |
| Exit codes | Use distinct codes for different failure types. |
| Safe defaults | Require --confirm or --force for destructive operations. |
| Output size | Default to summaries. Many agent harnesses truncate beyond 10-30K characters. |
| No side effects | Don’t modify files unless explicitly asked. Return results to stdout. |
The progression: skill to script
As you iterate on a skill with selftune, you’ll naturally discover which parts should become scripts:Further reading
Agent Skills Spec: Scripts
The full scripting section of the open standard.
Structuring Skills
How scripts fit into skill directory structure.
Managing Context
Move logic to scripts to reduce context load.
Iteration Loop
How selftune helps you identify script candidates.