Getting Started
Basic Commands
# Start interactive session
claude-code
# Run single command
claude-code "Create a Python Flask app with /hello endpoint"
# Run with specific file
claude-code -f main.py "Add error handling"
# Dry run (preview changes)
claude-code --dry-run "Refactor this function"
Interactive Mode
$ claude-code
Claude Code CLI v1.0.0
Type 'help' for available commands, 'exit' to quit.
> Create a REST API with user authentication
I'll help you create a REST API with user authentication. Let me break this down:
1. Set up Express.js project structure
2. Add user model with password hashing
3. Create authentication middleware
4. Implement login/register endpoints
5. Add protected routes
Shall I proceed with this plan? [Y/n]
File Operations
# Read file
claude-code "Show me the contents of package.json"
# Edit file
claude-code "Update the version in package.json to 2.0.0"
# Create file
claude-code "Create a README.md with project description"
# Delete file
claude-code "Remove the old test files in tests/legacy/"
CLAUDE.md Configuration
What is CLAUDE.md?
CLAUDE.md is a project configuration file that tells Claude Code about your project’s conventions, coding style, and preferences.
Example CLAUDE.md
# Project Guidelines
## Tech Stack
- Frontend: React 18, TypeScript, Tailwind CSS
- Backend: Node.js, Express, PostgreSQL
- Testing: Jest, React Testing Library
## Code Style
- Use functional components with hooks
- Prefer const over let, avoid var
- Use async/await, not promises
- Maximum line length: 100 characters
## Testing Requirements
- All new features must have tests
- Minimum coverage: 80%
- Run tests before committing
## Git Workflow
- Feature branches: feature/xxx
- Commit format: type(scope): message
- Types: feat, fix, docs, style, refactor, test, chore
Using CLAUDE.md
# Claude Code automatically reads CLAUDE.md
claude-code "Add a new user registration endpoint"
# Claude will follow your project conventions automatically
Advanced Features
Multi-File Editing
# Update imports across multiple files
claude-code "Update all imports to use the new utils module"
# Refactor across project
claude-code "Rename variable 'userData' to 'userProfile' everywhere"
Command Execution
# Run tests
claude-code "Run the test suite and fix any failures"
# Build project
claude-code "Build the project and fix compilation errors"
# Install dependencies
claude-code "Add lodash as a dependency"
Git Integration
# Generate commit message
claude-code "Create a commit message for these changes"
# Review changes
claude-code "Review my changes and suggest improvements"
# Create PR description
claude-code "Write a pull request description"
Use Cases
1. Quick Prototyping
claude-code "Create a Todo app with React and localStorage"
2. Code Refactoring
claude-code "Refactor this class to use dependency injection"
3. Bug Fixing
claude-code "Fix the null pointer exception in UserService.java"
4. Documentation
claude-code "Generate JSDoc comments for all public methods"
5. Test Generation
claude-code "Write unit tests for the authentication module"
Best Practices
1. Be Specific
❌ Bad: "Fix the bug"
✅ Good: "Fix the TypeError on line 45 where user.name is accessed
without checking if user exists"
2. Provide Context
claude-code "I'm getting this error: [paste error]
When I run: [paste command]
Expected: [expected behavior]
Actual: [actual behavior]"
3. Review Changes
# Always review before accepting
claude-code --dry-run "Make these changes"
# Check diff
git diff
# Then accept
claude-code "Apply the changes"
4. Use Incremental Changes
- Make small, focused requests
- Test after each change
- Commit frequently
Security Considerations
Sandboxed Execution
Claude Code runs commands in a sandboxed environment:
✅ Safe: Read files, run tests, build project
⚠️ Requires confirmation: Delete files, modify git history
❌ Blocked: Access system files, run as root
API Key Security
# Store API key securely
export ANTHROPIC_API_KEY="your-key"
# Use .env file (add to .gitignore)
echo "ANTHROPIC_API_KEY=your-key" >> .env
# Never commit API keys
git check-ignore .env
Troubleshooting
Issue 1: Authentication Errors
Solution:
# Re-login
claude-code logout
claude-code login
# Check API key
echo $ANTHROPIC_API_KEY
Issue 2: Slow Performance
Solution:
# Use faster model
claude-code config set model claude-haiku-4
# Clear cache
claude-code cache clear
Issue 3: Command Execution Fails
Solution:
# Check permissions
ls -la
# Run manually to see error
npm test
# Then ask Claude to fix
claude-code "Fix the test failures"
Pricing
Free Tier
✅ 20 messages/day
✅ Basic features
✅ Community support
Pro Tier ($20/month)
✅ Unlimited messages
✅ Priority access
✅ Advanced features
✅ Email support
Team Tier ($40/user/month)
✅ Everything in Pro
✅ Team management
✅ Admin controls
✅ Priority support
Resources
- Official Website: https://anthropic.com/claude-code
- Documentation: https://docs.anthropic.com/claude-code
- GitHub: https://github.com/anthropics/claude-code
- Discord: https://discord.gg/anthropic
- API Reference: https://docs.anthropic.com/claude/reference
Conclusion
Claude Code CLI is a powerful addition to any developer’s toolkit in 2026. With its terminal-native design, project awareness, and intelligent code modifications, it significantly boosts productivity while maintaining code quality.
Key Takeaways:
- ✅ Seamless terminal integration
- ✅ Project-aware with CLAUDE.md support
- ✅ Safe command execution in sandbox
- ✅ Multi-file editing capabilities
- ✅ Competitive pricing ($20/month)
Who Should Use Claude Code?
- Terminal-focused developers
- Teams wanting AI-assisted development
- Anyone looking to boost coding productivity
Give Claude Code a try and experience the future of terminal-based development!
Related Reading: