Work effectively with Claude Code
These tips help you get better results from Claude Code.
Ask Claude Code for help
Claude Code can teach you how to use it. Ask questions like “how do I set up hooks?” or “what’s the best way to structure my CLAUDE.md?” and Claude will explain.
Built-in commands also guide you through setup:
/init walks you through creating a CLAUDE.md for your project
/doctor runs a setup checkup that diagnoses installation and configuration issues and can fix them
It’s a conversation
Claude Code is conversational. You don’t need perfect prompts. Start with what you want, then refine:
Fix the login bug
[Claude investigates, tries something]
That's not quite right. The issue is in the session handling.
[Claude adjusts approach]
When the first attempt isn’t right, you don’t start over. You iterate.
Interrupt and steer
You can redirect Claude at any point without waiting for the turn to finish or starting over:
Press Esc to stop Claude immediately. The running tool call is canceled and Claude waits for your next instruction.
Type a correction and press Enter to send it without stopping the running tool. Claude reads it as soon as the current action completes and adjusts before deciding its next step.
Be specific upfront
The more precise your initial prompt, the fewer corrections you’ll need. Reference specific files, mention constraints, and point to example patterns.
The checkout flow is broken for users with expired cards.
Check src/payments/ for the issue, especially token refresh.
Write a failing test first, then fix it.
Vague prompts work, but you’ll spend more time steering. Specific prompts like the one above often succeed on the first attempt.
Give Claude something to verify against
Claude performs better when it can check its own work. Include test cases, paste screenshots of expected UI, or define the output you want.
Implement validateEmail. Test cases: 'user@example.com' → true,
'invalid' → false, 'user@.com' → false. Run the tests after.
For visual work, paste a screenshot of the design and ask Claude to compare its implementation against it.
Explore before implementing
For complex problems, separate research from coding. Use plan mode (Shift+Tab twice) to analyze the codebase first:
Read src/auth/ and understand how we handle sessions.
Then create a plan for adding OAuth support.
Review the plan, refine it through conversation, then let Claude implement. This two-phase approach produces better results than jumping straight to code.
Delegate, don’t dictate
Think of delegating to a capable colleague. Give context and direction, then trust Claude to figure out the details:
The checkout flow is broken for users with expired cards.
The relevant code is in src/payments/. Can you investigate and fix it?
No comments:
Post a Comment