tool-execution-loop
Installation
SKILL.md
Tool Execution Loop
What This Skill Covers
Only the non-obvious parts of building a reliable tool loop. Assumes you already know how to make a basic /v1/messages call.
Core Loop Shape
async function runLoop(messages, tools) {
while (true) {
const res = await callClaude({ messages, tools });
messages.push({ role: "assistant", content: res.content });
if (res.stop_reason === "end_turn") return res.content;