# Claude tool use Let Claude decide which files to document, and have Scribe write them. ## In plain words Claude can be handed “tools” — jobs it delegates instead of answering itself. Say what you want in English; Claude picks the files, and Scribe writes the docs. **Put another way:** Two specialists, not one generalist: Claude picks the files, Scribe writes the docs. ## Reach for it when - You want to say “document everything I touched in the billing folder” and have that understood. - You are already scripting against Claude and want documentation to be one more step. - You want consistent docs, not whatever a chat window happens to produce that day. ## Setting it up 1. **Install the two packages**: Run pip install anthropic requests — Claude's library, plus a way to make web requests. 2. **Get your key**: Sign in, open the dashboard, and go to API Keys → Create key — the string starts with writ_ and is shown only once. 3. **Save the script**: Save the code below as writulos_claude.py, replace writ_YOUR_API_KEY, and set ANTHROPIC_API_KEY for Claude itself. 4. **Run it**: python writulos_claude.py — Claude picks the file, and the documentation prints to your terminal. 5. **Want the whole project?**: The dashboard's Agent Integration tab has a longer version that walks your whole repo, 20 files at a time. writulos_claude.py: ``` # pip install anthropic requests import anthropic, requests WRITULOS_KEY = "writ_YOUR_API_KEY" # The one tool you hand to Claude. generate_docs = { "name": "generate_docs", "description": "Generate markdown docs for a single code file.", "input_schema": { "type": "object", "properties": { "code": {"type": "string"}, "filename": {"type": "string"}, }, "required": ["code", "filename"], }, } client = anthropic.Anthropic() response = client.messages.create( model="claude-haiku-4-5", max_tokens=1024, tools=[generate_docs], tool_choice={"type": "any"}, messages=[{"role": "user", "content": "Document auth.py"}], ) # Claude picks the file; Writulos writes the doc. for block in response.content: if block.type == "tool_use": doc = requests.post( "https://scribe.writulos.com/api/generate", headers={"x-api-key": WRITULOS_KEY}, json={ "code": open(block.input["filename"]).read(), "filename": block.input["filename"], }, ).json() print(doc["documentation"]) ``` ## What you end up with - Documentation printed to your terminal, in the same structure every other route produces. - Your script only chooses the files and calls the tool. The documentation itself comes back from Scribe. - Each file documented costs one generation from your monthly allowance. ## Things people ask ### Do I need two API keys? Yes — the Writulos key (writ_…) pays for the docs, and the Anthropic key lets your script talk to Claude. ### Can it do more than one file? Yes — a second tool backed by the batch endpoint documents up to 20 files at once, as the dashboard's full script does. ### Which Claude model should I use? The example uses claude-haiku-4-5 — cheap and quick, since it only picks filenames; doc quality doesn't depend on it. ## Try it on one file first. The web app needs no key or sign-up — see what comes out before you wire anything up. [Try it now →](https://scribe.writulos.com/app)