| id | tutorial-getting-started-error-handling |
|---|---|
| type | procedural |
| created | 2026-05-21 10:47:00 -0400 |
| diataxis_type | tutorial |
| title | Get started with the error-handling plugin |
This tutorial walks you through installing the plugin and seeing both skills trigger on a real piece of code. You will:
- Install the plugin from the marketplace.
- Ask Claude to review a deliberately broken CLI error path —
cdc-reviewfires. - Ask Claude to add a dual-format error to the same code —
cdc-errfires. - See the two skills hand off cleanly.
You need: Claude Code installed, a terminal, and ~10 minutes.
In Claude Code:
/plugin marketplace add zircote/cdc-error-plugin
/plugin install error-handling@cdc-errors
When the picker shows cdc-err, cdc-review, and cdc-handle under Available skills, the plugin is loaded.
Make a throwaway directory and paste this Python in app.py:
import sys, requests
def fetch(url):
try:
r = requests.get(url, timeout=5)
r.raise_for_status()
return r.json()
except Exception:
pass # swallow
if __name__ == "__main__":
data = fetch(sys.argv[1])
print(data)The bug is the bare except: pass — it swallows the cause chain and the program then crashes with a confusing TypeError because data is None.
In Claude Code, in that directory:
review the error handling in app.py
cdc-review activates. You should see:
- a classified finding tagged
[must-fix]for the swallowed exception, - a before/after diff that re-raises with cause preservation,
- at least one
[praise]finding (the timeout was set correctly).
This is the source-code-quality side of the plugin.
Now ask for the output format:
make app.py emit a problem+json envelope to stderr when the fetch fails
cdc-err activates. You should see:
- a JSON envelope with the five RFC 9457 fields (
type,title,status,detail,instance), - the three mandatory agent extensions (
retry_after,suggested_fix,code_actions[]), - a
--format=json|prettyflag with TTY auto-detection.
This is the CLI-output side.
Ask a question that crosses both:
review app.py's error output AND propagation
Both skills engage, each declining the other's scope and naming the sibling. cdc-review covers propagation; cdc-err covers the envelope.
- Read Why CLI errors are a dual-consumer problem for the rationale.
- See How to add cdc-err to an existing CLI for a real-project recipe.
- Browse the reference index for envelope fields, severity taxonomy, and language-specific patterns.