Generate annotated, runnable code examples that teach developers how to use an API or SDK. Use when asked to show usage examples, create quickstart samples, or demonstrate specific features.
Produces clear, annotated, runnable code samples that teach developers how to use an API, SDK, or library. Each example should be copy-pasteable and work immediately.
1. Title (what this example demonstrates)
2. Prerequisites (1-2 lines: what you need installed/configured)
3. Brief prose introduction (2-3 sentences: what we're building and why)
4. The code (fully annotated)
5. Expected output (what the developer should see when they run it)
6. What to try next (one suggestion for extending the example)
# Set up the client with your API key.
# The client handles authentication and retry logic automatically.
client = APIClient(api_key=os.environ["API_KEY"])
# Fetch the first 10 users. The response is paginated by default.
users = client.users.list(limit=10)
When generating multiple examples, order them:
"YOUR_API_KEY" with a comment on where to get it)