Examples
Real .md files. Save them and run them with think.
Hello world
Let's start with the simplest possible thing.
hello.md
Print "hello world" and exit.
Terminal
$ think hello.md
hello world
Weather lookup
Takes an optional city or zip code. If you don't pass one, it tries to geolocate.
weather.md
Figure out where I am and tell me the current
weather conditions. If arguments are passed in,
it could be a zip code or city. If not, try to
geolocate.
Output format:
City, State
Temperature, conditions. Wind and humidity.
Terminal
$ think weather.md "New York"
New York, NY
45°F, clear skies. Wind: 8 mph NW. Humidity: 52%.
Install it and you can just run weather "New York" from anywhere.
Pipe data through
Since stdout is sacred, piping just works.
summarize.md
Read stdin and output a one-paragraph summary.
Terminal
$ cat README.md | think summarize.md
ThinkingScript is a natural language interpreter
that lets you write executable scripts in plain
English. It sends prompts to an LLM which uses
tools to accomplish tasks, with user approval at
every step...
JSON processing
You don't need to remember the jq syntax for this. Just describe what you want.
extract-emails.md
Read the JSON from stdin. Extract all email
addresses and output them one per line, sorted
alphabetically. No duplicates.
Terminal
$ cat users.json | think extract-emails.md
alice@example.com
bob@example.com
carol@example.com
Project scaffolding
The prompt here is messy and informal. That's the whole point. You don't need to get the wording perfect.
rails-new.md
Create a new Rails application.
Check the first argument for a path, if its not
there prompt me for it, then run `rails new`
with that path.
When that's done, cd into that directory, run
`rails server` and then open the browser to
the URL that's running.
Terminal
$ think rails-new.md ~/Code/my-app
System administration
disk-report.md
Check disk usage on this machine. Show me the
top 5 directories by size, human readable.
If anything is over 90% full, warn me.
Chain them all together
Each script reads stdin, does its thing, writes to stdout. Stack as many as you want.
Terminal
$ cat raw-data.csv \
| think clean.md \
| think analyze.md \
| think format-report.md > report.md
Install them all and it gets real clean.
Terminal
$ cat raw-data.csv | clean | analyze | format-report > report.md