How to Use Claude Code: A Practical Guide for Developers
How to use Claude Code from installation to advanced workflows. Step-by-step commands, real examples, and tips to get productive fast.
You installed Claude Code. Now what? This guide covers everything from your first command to advanced workflows that will actually save you time.
//How to Use Claude Code
To use Claude Code, install it globally via npm, authenticate with your Anthropic account, navigate to your project directory, and start describing what you want in plain English. That's the short version. The rest of this guide covers the details.
The core loop is simple: you describe a task, Claude Code reads your codebase, proposes changes, and executes them with your approval. No IDE required. No plugins to configure. Just your terminal and natural language.
//Installation
You need Node.js 18 or later. Check your version:
node --version
If you're good, install Claude Code globally:
npm install -g @anthropic-ai/claude-code
Or with Bun:
bun install -g @anthropic-ai/claude-code
Verify the installation:
claude --version
You should see a version number. If you get "command not found," check that your global npm bin is in your PATH.
//Authentication
Navigate to any project directory and run:
claude
First time, it opens a browser window to authenticate with Anthropic. Sign in or create an account. Once authenticated, you're dropped into an interactive session.
You have a few options for billing:
Free tier. Limited usage. Good for trying it out.
Claude Pro ($20/month). Reasonable allowance for regular use. You'll hit limits if you use it heavily.
Claude Max ($100 or $200/month). For serious daily use. The higher tier gives you more context and faster responses.
API credits. Pay per token. Good for automation or if you want granular control over costs.
The subscription approach is simpler. API credits give you more flexibility but require watching your usage.
//Basic Commands
Once you're in a Claude Code session, you're talking to Claude in natural language. No special syntax required.
Ask about your code:
What does the UserService class do?
How is authentication handled in this project?
Find all the places where we call the payments API
Make changes:
Add input validation to the signup form
Rename the getUser function to fetchUserById
Add error handling to all the API routes
Run commands:
Run the tests
Install lodash and add it to the imports where we need it
Start the dev server
Claude Code will show you what it plans to do and ask for confirmation before making changes or running commands. You stay in control.
Slash commands:
Some common operations have shortcuts:
/help- Show available commands/clear- Clear the conversation/compact- Summarize and compress the conversation/config- View or change settings
These are built-in. You can also create custom slash commands, which we'll cover later.
//Common Workflows
Here's how to use Claude Code for tasks you'll actually do every day.
Exploring a Codebase
New to a project? Start here:
Give me an overview of this codebase. What's the tech stack and how is it organized?
Then drill down:
How does the authentication flow work?
Where are the API routes defined?
What's the database schema look like?
Claude Code reads the relevant files and gives you a coherent explanation. Much faster than grep-ing through unfamiliar code.
Writing Tests
Describe the behavior you want to test:
Write tests for the UserService class. Cover the happy path and common error cases.
Or be more specific:
Add a test that verifies signup fails when the email is already taken
Claude Code understands your testing framework. It'll use Jest, Vitest, pytest, or whatever you have configured.
For test-driven development:
Write a failing test for a function that validates email addresses. Then implement the function to make it pass.
Refactoring
This is where Claude Code really shines. Multi-file refactors that would take hours become single prompts:
Refactor the auth module to separate business logic from HTTP handlers
Convert all the callback-based functions to async/await
Rename the User model to Account and update all references
Claude Code understands the scope. It finds all the files that need changes, proposes the edits, and applies them once you approve.
For big refactors, use plan mode:
/plan Migrate from Express to Hono
This makes Claude Code research first and propose a plan before making changes.
Debugging
Paste an error and ask for help:
I'm getting this error: TypeError: Cannot read property 'id' of undefined
Here's the stack trace:
[paste stack trace]
Fix it.
Claude Code has your whole codebase in context. It can trace the error to its source rather than guessing.
For trickier bugs:
The checkout flow sometimes fails silently. Add logging to help debug this.
Git Operations
Claude Code handles git natively:
Commit these changes with a descriptive message
Create a new branch called feature/user-profiles
Show me the diff of what changed since yesterday
Create a pull request for this feature
The commit messages are actually good because Claude Code understands what changed and why.
//Advanced Usage
Once you're comfortable with the basics, these features take it further.
CLAUDE.md files. Drop a CLAUDE.md file in your project root to give Claude Code persistent instructions. Things like coding conventions, project-specific context, or common commands. Claude Code reads this automatically at the start of every session.
Example:
# Project Guidelines
- Use TypeScript strict mode
- Prefer functional components with hooks
- Run `bun test` before committing
- API routes live in src/routes/
Subagents. For complex tasks, Claude Code can delegate to specialized agents. The Explore agent handles codebase searches. The Plan agent does research before proposing changes. You can also create custom agents for your specific workflows.
Custom slash commands. Create your own shortcuts by adding files to .claude/commands/. Each file defines a command name and the prompt it expands to. Great for repetitive tasks specific to your project.
Plan mode. For anything non-trivial, start with /plan. Claude Code will research the codebase, think through the approach, and present a plan before making changes. You review the plan first, then approve implementation.
MCP servers. Claude Code can connect to external tools via the Model Context Protocol. Database access, API integrations, custom tooling. This is the power-user feature for building sophisticated workflows.
//Tips for Better Results
After months of daily use, here's what I've learned:
Be specific. "Make the code better" won't help. "Refactor the auth module to use dependency injection" will. The more specific your prompt, the better the result.
Provide context. If you're working on a specific feature, say so. "I'm building a user profile page" helps Claude Code understand which files matter.
Review before accepting. Claude Code asks for confirmation before changes. Actually read what it proposes. It's good, but not perfect.
Use plan mode for complex tasks. If the task touches more than 3-4 files, start with /plan. The upfront research saves time and catches issues early.
Iterate. First result not quite right? Say what's wrong and ask for adjustments. "Make the error messages more specific" or "Use a switch statement instead of if-else."
Trust but verify. Claude Code is remarkably capable. But it's still an AI. Run the tests. Check the diff. Catch issues before they become bugs.
Compact regularly. Long sessions accumulate context. Use /compact periodically to summarize and free up space for new information.
//Verdict
Learning how to use Claude Code takes maybe an hour. Getting good at it takes a few days of real usage. The investment pays off quickly.
Start with simple tasks. Ask it about your codebase. Make small edits. As you build trust, graduate to bigger refactors and more complex workflows.
The mental model shift is key: you're not coding with AI assistance. You're delegating to an AI and reviewing results. Once that clicks, you'll wonder how you worked without it.
Now go build something.
Ready to supercharge your Claude Code setup?
One command analyzes your codebase and generates CLAUDE.md, skills, and agents tailored to your exact stack.