When should you use it?
- Ticket routing rules keep misfiling tickets
- You have a year of tickets already labeled by category
- You want an accuracy number before switching on automation
Not for: Teams without labeled history or a developer to run Python
What do you need, and what do you get?
You need
- Labeled historical tickets
- Category definitions
- An Anthropic API key and Python
You get
- Classifier prompt
- Accuracy and confusion matrix on your test tickets
How does it work, step by step?
- Open the notebookOpen it on GitHub, or clone the repository and run it in Jupyter or Colab.
- Add an API keyThe notebook calls the model API; set the key as an environment variable, never in the notebook.
- Swap in your dataReplace the example data with a small, anonymized sample of your own.
- Check the resultsCompare outputs against what a person would have produced before using it on real work.
The prompt
The original prompt by Anthropic (claude-cookbooks), word for word, with a link to where it was published. Below it is our adapted version with fill-in blanks, if you want it. Works in Claude. Values in lime are placeholders.
Original prompt by Anthropic (claude-cookbooks)
You will classify a customer support ticket into one of the following categories:
<categories>
{{categories}}
</categories>
Here is the customer support ticket:
<ticket>
{{ticket}}
</ticket>
Use the following examples to help you classify the query:
<examples>
{{examples}}
</examples>
First you will think step-by-step about the problem in scratchpad tags.
You should consider all the information provided and create a concrete argument for your classification.
Respond using this format:
<response>
<scratchpad>Your thoughts and analysis go here</scratchpad>
<category>The category label you chose goes here</category>
</response>Exactly as published by Anthropic (claude-cookbooks) in Classification guide · anthropics/claude-cookbooks.
Our adapted version (optional)
Fill in the blanks (optional; the copied prompt uses your values)
Classify this support ticket into exactly one category. Categories with definitions: {category_definitions} Similar past tickets with their correct labels: {labelled_examples} Ticket: {ticket} Reason briefly about which definition fits, then give the category label on its own line. If two categories fit equally, say so instead of guessing.
What can go wrong?
- Accuracy on the notebook's insurance data says nothing about yours; measure on your own tickets.
- Keep categories mutually exclusive or accuracy will suffer whatever the prompt.
Our take
Most no-code ticket routing goes live without anyone knowing how often it's right. This notebook's main lesson is the method: hold back labeled tickets, measure accuracy after every prompt change, and only automate once the number is good enough for your risk. The techniques it layers (clear category definitions, retrieved similar examples, reasoning before the answer) are the same ones that help in any classification prompt. In our dry run we ran the published prompt by hand on twelve sample MSP tickets across five categories, with three retrieved examples each: eleven matched the label we expected, and the miss was a billing question about a security product, which is a category-definition problem rather than a prompt problem. We'd tell any team doing this to fix overlapping categories first. Re-measure accuracy every few months on fresh tickets, because new products and issues shift what customers write about. A classifier that was 90% right last spring can drift without anyone noticing unless the measurement is repeated.
Where the time goes back: Routing gets automated only once you have measured how often it is right.
FAQ
Can I use this without coding?
How many labeled tickets do I need?
Source and credit
The original prompt on this page is by Anthropic (claude-cookbooks), shown word for word with a link to where it was published. The summary, notes and adapted version are ours.
- Original
- Classification guide · anthropics/claude-cookbooks
- Creator
- Anthropic
- Published on
- GitHub (anthropics/claude-cookbooks)
- Original date
- May 19, 2024
- License
- MIT
- Originally for
- Claude
- AI dry run
- Oct 20, 2026: passed. Dry-run tested by our AI test agent on sample input. Format followed (scratchpad + category); 70%→95% accuracy claim not repeated on our page.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails. - Verified
- Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.
The original is licensed under the MIT License (Copyright (c) 2023 Anthropic). The original prompt above is reproduced under that license with its copyright notice; our adapted prompt and summary are our own wording.
Are you the creator? Claim or correct this page.