Claude Code 最佳实践指南 (English)
Claude Code 最佳实践指南 (English)
Generated: 2026-06-21 12:09:48
---
You might not believe it when I say this, but my first two months with Claude Code were an absolute tear-jerking, laughable disaster.
I'd toss in a requirement, it'd blast out all the code. Then I'd run it — screens full of red errors. A few rounds of fixes later, context got scrambled, and it started rambling complete nonsense. Eventually I'd quietly close the terminal and go back to writing things by hand. At that moment, I seriously wondered if I'd bought an expensive toy.
It wasn't until I steeled myself and devoured every bit of Anthropic's official docs, every single post from Boris Cherny (Claude Code's core developer) on X, and that well-known community project that I actually started to get the hang of it.
This piece you're reading? It's the real deal from a year of stepping on rakes. No fluff — just the stuff I paid for with my time.
---
Don't rush it to write code — give it an onboarding manual first
Think about it: when a new hire joins your project, you show them the docs, right? That's exactly what CLAUDE.md is for.
A lot of people just jump in with "start coding" — and then what? It doesn't know your team's naming conventions, and the code it writes looks like it was born from a different parent project.
What to do? Run claude /init to generate a starter file, then — here's the hard part — compress it to under 200 lines. How? For every single line, ask yourself: would removing this make Claude mess up? No? Delete it.
I've seen CLAUDE.md files that are over 800 lines, stuffed with the entire team wiki. By the time Claude gets to the second half, it's forgotten what was at the beginning. That file might as well be blank.
Only put in things it can't figure out from the code itself. For example, your private UI component naming conventions, API base URLs, special testing framework config. Don't write "this project uses React" — it can see that in your package.json.
Speaking of which, here's a trap to watch out for: once you commit CLAUDE.md to version control, the whole team benefits. But it's not set-and-forget. I review it every two weeks, cutting out anything Claude no longer needs. Keep it lean, and it'll actually read it.
If you don't change these two settings, you're wasting it — one makes you dumb, the other drives you crazy with popups
First up: effort.
Anthropic quietly dropped the default effort from high down to medium at some point, and they didn't even announce it. I spent several days feeling like Claude Code had gotten stupid — output quality tanked. I was so mad I almost switched tools. After digging around, I finally found this little gremlin was the culprit.
It's like you bought a sports car, but it's limited to 40 mph by default.
My fix? I hard-lock it in .claude/settings.json:
{
"effort": "high"
}
For complex tasks I go straight to /effort max. For trivial formatting, I'll drop down to /effort low.
And there's an even sneakier trap: adaptive thinking. Lately, Claude has started deciding on its own how much compute to allocate each turn. When it judges a task as "simple," it skips the thinking step entirely — and then creates a cascade of disastrous downstream bugs. The fix is to use an environment variable to set a fixed reasoning budget per turn. Don't let it second-guess itself.
Second trap: permissions policy.
The default "confirm every step"? I tried it one morning and got 47 confirmation prompts. You read that right: 47. Imagine someone asking "are you sure?" every time you write a line of code — you'd never get anything done.
Here's my setup:
- Trusted repos: Turn on
acceptEditsmode — auto-accept file modifications. - Unfamiliar codebases: Use
planmode — review the plan first, then let it act.
Write explicit
Cael Lee
Full-stack developer with 8+ years of experience. Currently building AI-powered developer tools. I've tested 20+ AI API providers and coding assistants.