New TIL: I figured out how to use my LLM CLI tool in a shebang line, which means you can write executable scripts in English, or hook up more complex scripts with a snippet of YAML template https://t.co/8mngqTbiTO
Simon Willison Turns English Prompts into Executable Scripts Using Shebang Lines
· Updated
Simon Willison demonstrated a method to make natural language prompts executable using the
#!/usr/bin/env -S llm -f shebang line. This pattern leverages Simon Willison's llm fragments mechanism to append script contents directly to a prompt, turning plain text files into functional command-line tools.This discovery shifts AI interaction from reactive chatting to standard Unix engineering. By wrapping prompts in executable files, users can define specific models, system instructions, and embedded Python functions as tools. It bridges the gap between Simon Willison's vibe coding thesis and reliable, repeatable terminal-based automation.
You can now build custom AI utilities—like an SVG generator or blog search tool—without writing boilerplate wrapper code. These scripts support parameters and tool-calling, making them ideal for automating repetitive data tasks. The llm tool is open-source and supports frontier models like GPT-5.5 access via Codex.
Simon Willison
@simonw
16retweets293likes
View on XStill wondering? A few quick answers below.
To make a prompt executable, use the #!/usr/bin/env -S llm -f shebang line at the top of a text file. The -S option splits the arguments, while -f tells the llm tool to read the file itself as the prompt. After saving, use the chmod +x command to make the script executable.
The -S or split option is necessary when using the env command to ensure that llm and its flags are treated as separate arguments. Without it, the system tries to find a single command named llm -f, which does not exist. This allows the environment to correctly pass the script path to the llm utility.
Yes, you can create complex scripts by using llm templates in YAML format. By ending the shebang line with the -t flag, the script can define system prompts, specific models, and even embedded Python functions. These functions act as tools that the model can call autonomously to perform calculations or fetch data from external APIs.
You can pass arguments to your executable scripts just like any other command-line utility. If your script uses an llm template with variables, use the -p flag followed by the parameter name and value when running the file. Other standard llm options, such as -m to specify a different model, can also be appended during execution.

