Practical examples showing how the SDK reduces developer toil. Each example is a complete, runnable Go program.
| Example | Description |
|---|---|
| Plan Loop | Ralph-style iterate-until-done pattern: read a JSON plan, implement each item, review in a separate pass |
| Batch Generation | Generate the same program in 20 languages concurrently using goroutines and channels |
| Driver Scaffolding | Scaffold Store interface implementations for MySQL, MongoDB, Azure Table Storage, and more |
| Repository Maintenance | Iterate through repositories checking for dependency updates, language migrations, and missing capabilities |
These examples share a few patterns:
- Loop over a list -- languages, backends, repos, plan items. The SDK turns
claude -pintoa.Run()inside aforloop. - Structured data in, structured data out -- Go structs for plans, results, and reports instead of string parsing.
- Concurrency where it helps -- goroutines and channels for independent tasks, sequential loops when order matters.
- Cost tracking --
result.CostUSDon every response, accumulated across runs.
The goal in each case is to reduce toil: tasks that are repetitive, predictable, and low-judgment but still time-consuming when done by hand.