Skip to content

Your First Tasks

Let’s walk through common tasks you’ll do with Claude Code. These examples use Python, but the patterns apply to any language.

You’ve just joined a project. Start here:

> explain this codebase at a high level
> what are the main entry points?
> draw a diagram of how the components interact
> walk me through what happens when a user logs in
> explain the User model and its relationships
> what's the purpose of the middleware in app.py?

The best bug fix prompts include context:

Good:

> users report that password reset emails aren't being sent.
> the error in the logs is "SMTP connection refused"
> find and fix the issue

Even Better:

> users report that password reset emails aren't being sent
> this started happening after yesterday's deployment
> the error in the logs is "SMTP connection refused"
> we use SendGrid for email
> find and fix the issue
> the checkout flow is broken but I don't know why
> run the tests and help me figure out what's wrong

Claude will:

  1. Run your test suite
  2. Analyze failures
  3. Trace the issue to source
  4. Propose a fix
> write pytest unit tests for the UserService class
> focus on edge cases and error conditions
claude > write tests for the payment processing module
I'll create comprehensive tests for payments.py. Here's my plan:
1. Test successful payment processing
2. Test insufficient funds handling
3. Test invalid card data
4. Test network timeout recovery
5. Test idempotency (duplicate requests)
Creating tests/test_payments.py...
claude > run them
Running: pytest tests/test_payments.py -v
test_successful_payment PASSED
test_insufficient_funds PASSED
test_invalid_card PASSED
test_network_timeout PASSED
test_idempotency FAILED # Oops, found a bug!
The idempotency test failed. Looking at the code, I see that
duplicate requests aren't being handled. Want me to fix this?

Tell Claude what you want to achieve:

> refactor the database module to use connection pooling
> this function is 200 lines long, break it into smaller functions
> convert this class to use async/await
> extract the validation logic into a separate module
> refactor the auth module
> constraints:
> - don't change the public API
> - keep backward compatibility
> - add type hints

For larger features, use plan mode (press Alt+M to cycle to plan mode):

> add a user notification system
Claude will ask:
- What types of notifications? (email, push, in-app)
- What events trigger notifications?
- Should users be able to configure preferences?
- What's the delivery mechanism?
claude > add rate limiting to the API
Let me understand the requirements:
1. What endpoints need rate limiting?
○ All endpoints
○ Only authenticated endpoints
○ Specific endpoints (list them)
[You select: Only authenticated endpoints]
2. What rate limit strategy?
○ Fixed window (e.g., 100 requests per minute)
○ Sliding window
○ Token bucket
[You select: Fixed window]
3. Where should limits be stored?
○ In-memory (resets on restart)
○ Redis (persistent across instances)
[You select: Redis]
Great, here's the plan:
1. Add redis-py to requirements.txt
2. Create rate_limiter.py with RateLimiter class
3. Add rate_limit decorator
4. Apply to authenticated routes
5. Add tests
6. Update API documentation
Proceed with implementation?
> review my changes before I commit
> are there any security issues in the auth module?
> check for performance problems in the database queries
> is this code following our style guide?
> add docstrings to all public functions in api.py
> create a README for this project
> generate API documentation from the route handlers
> write a developer setup guide
> add caching to the user lookup
> use Redis, not in-memory
> cache for 5 minutes
> invalidate on user update
> create a new API endpoint similar to /api/users
> but for products
> use the same patterns and error handling
> add a new model like the User model in models.py
> for storing product reviews

Don’t try to do everything in one prompt:

# First, get the basic structure
> create a new endpoint for product search
# Then refine
> add pagination to the search results
# Then optimize
> add caching for common searches