Boris Cherny: Tips for Using Claude Code
A tutorial by Boris Cherny. Featured in the OTF curated resource library.
Think in Tasks, Not Prompts
The biggest mindset shift for Claude Code users is moving from 'write me code' to 'complete this task.' Boris emphasizes that Claude Code is an agent, not an autocomplete tool. It reads files, runs commands, checks results, and iterates.
This means your prompts should describe outcomes, not implementations. Instead of 'write a function that filters users by role,' say 'add role-based filtering to the users page so admins see all users and editors only see their own.' The agent figures out the implementation path.
Boris's rule of thumb: if your prompt reads like a code specification, it's too low-level. If it reads like a ticket description, it's about right.
Context Is King
Boris shares specific strategies for giving Claude Code the context it needs to produce great output.
Start every session with an AGENTS.md reference
Keep an AGENTS.md file at your project root describing your stack, conventions, and current focus areas. Claude Code reads it automatically and uses it to align its output with your preferences.
Reference specific files in your prompts
Instead of saying 'update the API', say 'update the API handler in src/lib/api.ts to include the new tutorial_details endpoint.' Explicit file references eliminate ambiguity and reduce exploration time.
Use /compact to manage long sessions
After 20+ turns in a conversation, the context window fills up and quality degrades. Use `/compact` to summarize the session so far and free up context for new work. Boris does this roughly every 15-20 interactions.
High-Impact Prompt Patterns
The 'Plan First' Pattern
Prefix complex tasks with: 'Before making any changes, read the relevant files and outline your plan.' This produces a visible plan you can approve or adjust before any code is written.
The 'Follow the Pattern' Pattern
Reference existing code as a template: 'Create a new hook for tools following the same pattern as useProjects in src/hooks/useProjects.ts.' This ensures consistency without spelling out every detail.
The 'Fix and Verify' Pattern
After requesting a fix, add: 'After making the change, run the type checker and fix any resulting errors.' This creates a self-correcting loop that catches cascading issues.
The 'Explain Then Do' Pattern
For learning new codebases: 'Explain how the data fetching layer works in this project, then add a new endpoint for user profiles.' You get documentation and implementation in one prompt.
The Debugging Workflow
Boris describes a specific debugging workflow he uses daily:
1. Copy the exact error — paste the full error message and stack trace. Don't summarize or paraphrase.
2. State expected vs actual — 'I expected X but got Y when I did Z.'
3. Let the agent investigate — say 'Investigate this error. Read the relevant files, trace the issue, and propose a fix.'
4. Review before accepting — always review the proposed fix. Sometimes the agent fixes the symptom but not the root cause.
The key insight: Claude Code is often better at debugging than implementing new features, because debugging is fundamentally about reading and reasoning about existing code — exactly what agents excel at.
Advanced Techniques
Multi-Agent Workflows
Run multiple Claude Code sessions in parallel on different tasks. One handles the frontend, another handles the backend. Merge the results with git. Boris calls this 'agent-branching.'
Custom Slash Commands
Create custom slash commands for repetitive workflows. For example, a `/seed-data` command that generates test data matching your schema, or `/deploy-check` that verifies deployment readiness.
Headless Mode for CI
Use Claude Code in your CI pipeline for automated tasks: generating changelog entries, updating documentation after API changes, or creating release notes from commit history.
Common Mistakes to Avoid
Over-Specifying Implementation
Telling the agent exactly which functions to write, which libraries to use, and how to structure the code. Let the agent make these decisions — it often finds better approaches.
Ignoring Agent Warnings
When Claude Code says 'this change might break X', take it seriously. The agent has read the full codebase and is flagging real risks that you might have missed.
Not Reviewing Diffs
Accept-all without reviewing is tempting when the agent is on a roll. But every change should be reviewed — especially security-sensitive code, database migrations, and public API changes.