- Published on
Reading: Claude Code Best Practice
- Authors
- Name
- Heefan
References:
Claude Code: Best practices for agentic coding
Take-away from the article
Setup & Environment
- Create
CLAUDE.md
files to document common commands, code style guidelines, testing instructions, and repository etiquette - Customize your tool allowlist to permit safe actions you frequently use
- Install the
gh
CLI if using GitHub for seamless integration
Core Workflows
1. Explore → Plan → Code → Commit
- Tell Claude to read files first without coding, then make a plan before implementing
- Use "think" commands ("think" < "think hard" < "think harder" < "ultrathink") to give Claude more computation time
2. Test-Driven Development
- Write tests first, commit them, then have Claude write code to pass the tests
3. Visual Development
- Give Claude screenshots or design mocks, then have it implement and iterate based on visual feedback
Best Practices
- Be specific: Clear, detailed instructions work much better than vague requests
- Use images: Paste screenshots, drag-and-drop images, or provide file paths for visual context
- Reference files: Use tab-completion to help Claude find the right files to work with
- Course correct: Press Escape to interrupt Claude and redirect its approach
- Clear context: Use
/clear
frequently to keep conversations focused
Advanced Techniques
- Use headless mode (
-p
flag) for automation and CI workflows - Run multiple Claude instances in parallel using git worktrees for independent tasks
- Create custom slash commands in
.claude/commands
folder for repeated workflows
The key insight is that Claude Code works best when you give it clear context, specific instructions, and tools to verify its work through testing or visual feedback.
Philosophy different between Cursor IDE and Claude Code
Core Philosophy
Cursor IDE: "AI-First Editor"
- Built "from the ground up with AI as a first-class citizen" rather than "retrofitting AI capabilities into existing editors"
- Designed around natural language programming and intelligent code assistance from day one
- Visual, IDE-integrated approach where you can see every step and decision
Claude Code: "Low-Level Power Tool"
- Intentionally low-level and unopinionated, providing close to raw model access
- Command-line focused with emphasis on flexibility and scriptability
- "Hides most of its decision-making process. You give it a task, it disappears into its command-line cave, and emerges with (hopefully) working code"
Key Differences
User Experience:
- Cursor: GUI-based, visual feedback, watch AI work in real-time within a familiar IDE
- Claude Code: Terminal-based, autonomous execution, "maximum vibe, minimum micromanagement"
Control & Transparency:
- Cursor: "Lets you watch every step, every file change, every decision"
- Claude Code: Black box approach - you provide instructions and get results, but less visibility into the process
Integration:
- Cursor: Built as a complete IDE replacement with AI deeply integrated into every aspect
- Claude Code: Integrates with your existing terminal environment and tools
Trust Model:
- Cursor: Collaborative - you're actively involved in the AI's decision-making
- Claude Code: "It's asking for a lot of trust" - you delegate tasks and let it work autonomously
Target Workflows
Cursor excels for:
- Developers who want visual feedback and control
- Learning and understanding code changes as they happen
- Traditional IDE workflows enhanced with AI
Claude Code excels for:
- Automation and scripting
- Complex multi-step tasks that benefit from autonomous execution
- Developers comfortable with command-line tools and trusting AI agents
The fundamental difference is that Cursor reimagined the IDE experience with AI at its core, while Claude Code provides powerful AI capabilities through a flexible, terminal-based interface that integrates with existing developer workflows.
--END--