cqbase.net · English & Chinese

CQBase

Context & Query Base

Tutorials

Claude Cookbooks

Anthropic’s notebooks of concrete Claude recipes, closer to runnable code than a product page.

anthropics/claude-cookbooks is an MIT-licensed collection of notebooks showing specific ways to use Claude: tools, long context, classification, and other recipes you can adapt. It is closer to code you can run than to a product overview.

Choose a notebook near the feature you want, switch the model name to one your account can call, and rerun it on a small piece of your own data. Do not treat the sample data as a benchmark.

This page is a guide, not the original text.

What problem it solves

anthropics/claude-cookbooks is Anthropic’s official collection of example notebooks. It shows concrete ways to call the Claude API, rather than describing the product in marketing language. The repository is MIT licensed and is not archived. A browsable web catalog lives at platform.claude.com/cookbook; use it to find a recipe, then open the matching notebook in the repository.

Verified on 2026-11-16 (Asia/Shanghai). The most recent repository push was at 19:23 UTC on 4 November 2026, which is 03:23 Asia/Shanghai on 5 November 2026. Two details go stale easily. First, the repository was previously named anthropics/anthropic-cookbook, and some links in the current README still use that older name. GitHub usually redirects to the current repository, but you should treat anthropics/claude-cookbooks as the canonical path. Second, the recipe table in the root README is narrower than both the actual repository tree and the official web catalog. The repo also has directories such as skills, managed_agents, claude_agent_sdk, extended_thinking, and evals, and the website includes entries dated November 2026. Do not use that README table as a complete inventory.

Who it is for

It is for developers who already plan to use the Claude API and want a runnable recipe they can adapt. The examples are primarily in Python. You need your own API key; the documented request path is console.anthropic.com.

If you only chat at claude.ai and do not call the API, this repository will not help much. Do not treat the sample data in a recipe, or the outputs saved inside a notebook, as a benchmark for your own task.

How to use it

The steps below come from CONTRIBUTING.md, undefined, and pyproject.toml, all checked on 2026-11-16. Official docs recommend uv:

git clone https://github.com/anthropics/claude-cookbooks.git
cd claude-cookbooks
uv sync --all-extras
cp .env.example .env

Then put your ANTHROPIC_API_KEY in .env and do not commit that file. .env.example sets the optional default test model to claude-haiku-5-5. You can also read the web catalog first and clone only when you know which notebook you want to run.

Official sources do not fully agree on the Python version. CONTRIBUTING.md says “Python 3.11 or higher.” The same day’s pyproject.toml says requires-python = ">=3.11,<3.13". This guide did not run the suite on Python 3.13, so it cannot say that a newer version will or will not work. If you are following the official environment, honor the pyproject.toml constraint, or start with 3.11 or 3.12.

Model names go stale even faster. CONTRIBUTING lists claude-opus-5-5, claude-sonnet-5-5, claude-fable-5-1, and claude-haiku-5-5 as the then-current aliases, says not to use older dated model IDs, and suggests claude-haiku-5-5 as a low-cost default for examples. The official models overview checked on 2026-11-16 lists claude-fable-5-2 as the latest Fable alias. After you open a notebook, change the model name to one your account can actually call and that matches that overview. Do not assume a hard-coded string in the notebook is still valid.

A worked example

This is a path for running a single, relatively cheap notebook. This guide did not execute any notebook, so it does not invent cell output or a classification score.

  1. In the web catalog or the repository tree, pick a short recipe close to the feature you need. If you are only proving the environment works, prefer a small classification or summarization notebook, or one marked as a starter, over a long multi-agent or evaluation piece.
  2. Install dependencies and add your API key as in the previous section. Compare the model name in the notebook with the models overview and switch it to a model your account can call. To check the plumbing only, you can use the claude-haiku-5-5 default from .env.example.
  3. Replace the sample data with a small piece of your own text or files, then run the notebook from top to bottom. Expected effect: the client should call the API successfully and follow the steps that recipe demonstrates. Inspect the response yourself. Do not treat older outputs saved in the repository as the current model’s score.
  4. After a successful run, confirm that the key was not written into the notebook or into git. Then change only the prompts or tool definitions that relate to your feature.

Common pitfalls

  • Treating the recipe table in the root README as a complete list of official examples. That table is narrower than the repository tree and platform.claude.com/cookbook, and it still contains links that use the old repository name.
  • Running an older notebook without updating the model ID. CONTRIBUTING and the official models overview are not fully in sync (for example Fable 5.1 versus 5.2). Trust the models overview and the models your account can actually call.
  • Ignoring the two different Python version statements. If uv sync fails, check whether your local Python falls inside the >=3.11,<3.13 range in pyproject.toml.
  • Writing the API key into a notebook or committing .env. Official docs say to read the key from the environment.
  • Publishing sample data or saved notebook output as if it were an evaluation result.

FAQ

The current official repository is anthropics/claude-cookbooks. It previously used the name anthropics/anthropic-cookbook. Old GitHub URLs usually redirect, but you should clone, cite, and file issues against the current name. The project name in pyproject.toml is still anthropic-cookbook; that does not change the clone URL.

Which Python version do I need?

CONTRIBUTING says 3.11 or higher; pyproject.toml says >=3.11,<3.13. Those statements are not identical. This guide did not run versions outside that range. When you follow the official lockfile, prefer the pyproject.toml constraint.

Can I keep the model name that appears in a notebook?

Not always. Check the official models overview and the models your account can actually call. .env.example uses claude-haiku-5-5 as a low-cost default, but you still need to confirm it yourself.

Do I have to clone the repository just to read?

No. You can start on platform.claude.com/cookbook. Clone and follow CONTRIBUTING when you want to run the code. The web catalog and the repository files can differ; when you run something, the notebook in the repository is the source to follow.

What is the license, and do I need an API key?

The repository is MIT licensed; see LICENSE. To call the Claude API you need your own key, requested from the console keys page. Read the key from the environment; do not commit it. For account or regional availability, use Anthropic’s official pages only. This page does not discuss workarounds.

Sources and license

The anthropics/claude-cookbooks repository is licensed under MIT. This page is a paraphrase, for CQBase — Context & Query Base, of the README, CONTRIBUTING.md, pyproject.toml, .env.example, the web catalog, and the official models overview, all checked on 2026-11-16. If setup steps or model names change, the repository and official docs win.

Subscribe to CQBase Weekly

One email a week with newly catalogued public AI skills, prompts, MCP servers, and methods. Unsubscribe at any time. We will not hand your address to a third party for their marketing.