If you want to use Claude Code effectively — not just run it once and wonder what all the fuss is about — this tutorial walks you through the practical workflow: installation, first tasks, project conventions, permissions, and the habits that separate productive sessions from frustrating ones. Claude Code is Anthropic's agentic coding tool that runs in your terminal, reads your codebase, edits files, runs commands, and handles multi-step tasks like refactors, bug fixes, and test writing. Unlike autocomplete-style assistants, it operates on whole tasks rather than single lines, which changes how you should interact with it. The learning curve is real but short, and most of it comes from understanding a few core concepts: context management, permission modes, and how to give instructions that an agent can actually act on.
Installing and Setting Up Claude Code
Claude Code runs as a command-line tool. You install it via the native installer:
curl -fsSL https://claude.ai/install.sh | bash
Once installed, navigate to your project directory and launch it:
cd my-project
claude
The first launch walks you through authentication with your Anthropic account. You can use a Claude Pro or Max subscription, or the Anthropic Console API with pay-as-you-go billing. If your team already uses a cloud provider, Claude Code also supports Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry as backends, which matters for organizations with data-residency or procurement requirements.
Before writing your first prompt, take two minutes to configure the essentials. Run /init inside a session — Claude Code will analyze your project and generate a CLAUDE.md file, a markdown document that acts as persistent project memory. This file is the single highest-leverage thing you can set up, because it tells the agent about your stack, commands, and conventions on every session without you repeating yourself.
A minimal but effective CLAUDE.md looks like this:
# Project: TaskFlow API
## Stack
- Node.js 20, Express, TypeScript, PostgreSQL
- Prisma ORM
## Commands
- `npm run dev` — start dev server
- `npm test` — run Jest test suite
- `npm run lint` — ESLint with strict config
## Conventions
- Use named exports, never default exports
- All API routes live in src/routes, handlers in src/handlers
- Never modify prisma/migrations manually — generate migrations with Prisma CLI
Keep it short. Claude Code reads this file into context every session, so a 500-line essay wastes tokens and dilutes the instructions that matter.
Your First Real Task: How to Prompt an Agent
The biggest mindset shift from chat-based AI is that Claude Code executes rather than suggests. That means your prompts should describe outcomes, not steps. Compare these two approaches:
Vague: "Add authentication to my app."
Effective: "Add JWT-based auth to the Express app. Use the existing User model in prisma/schema.prisma, put login and register endpoints in src/routes/auth.ts following the pattern in src/routes/posts.ts, hash passwords with bcrypt, and add integration tests in src/routes/tests/auth.test.ts. Run the test suite when done."
The second prompt works because it anchors the agent to existing patterns in your codebase. Claude Code is good at inferring conventions, but pointing it at a reference file removes guesswork and dramatically reduces the chance it invents a structure that conflicts with your architecture.
For exploratory work, start in read-only mode. Ask Claude to explain how a feature works or propose an approach before letting it edit anything:
> How does order fulfillment currently work? Trace the flow from
the POST /orders endpoint through to the payment provider call.
Don't change anything yet — just explain it and flag anything fragile.
This "understand first, then act" pattern is one of the most reliable habits for larger codebases. It costs a minute and prevents the classic failure mode of an agent confidently modifying the wrong layer of your application.
Permissions, Safety, and Working Modes
Claude Code asks for permission before running commands or editing files by default, and you approve each action interactively. As you build trust, you can loosen this with permission modes and allowlists. The /permissions command lets you pre-approve specific tools — for example, always allowing npm test while still requiring confirmation for anything that mutates state.
A practical setup for most developers:
- Allow read-only tools and your test runner freely.
- Require confirmation for file writes during unfamiliar work.
- Never blanket-allow arbitrary shell execution in production-adjacent repos.
Use git as your safety net. Commit or stash before starting a task so Claude's changes are isolated in a diff you can review with git diff. If a session goes sideways, git checkout -- . is your undo button. For riskier refactors, ask Claude to work on a branch — it handles this naturally when you mention it in the prompt.
One common mistake: approving a long chain of commands without reading them because the first few looked fine. Agents occasionally run something like rm -rf on a build directory or force-push assumptions into scripts. Read the permission prompts, especially for destructive commands. The approval flow exists precisely because agentic tools make autonomous decisions, and your review is the guardrail.
Context Management: The Skill That Matters Most
Claude Code's effectiveness depends heavily on what's in its context window. Long sessions accumulate stale information, and very large files can crowd out the parts of your codebase that actually matter. Three techniques keep sessions sharp:
First, use /clear between unrelated tasks. If you just finished debugging a CSS issue, don't start a database migration in the same session — the leftover context biases the agent toward irrelevant details.
Second, use /compact when a session is getting long but you want to keep the thread. It summarizes the conversation so far and frees up space, which is useful for extended refactoring work.
Third, point at files explicitly when precision matters. Instead of "fix the bug in the payment module," try "fix the bug in src/payments/stripe.ts where refunds double-count the handling fee." Specific file references ground the agent and reduce exploration overhead.
For large monorepos, keep multiple CLAUDE.md files — one at the root and others in subdirectories. Claude Code picks up the relevant ones based on where you're working, which keeps instructions scoped and relevant.
Extending Claude Code with MCP and Custom Commands
Two features turn Claude Code from a helpful tool into a workflow platform. The Model Context Protocol (MCP) lets you connect external servers that provide additional tools and data — database inspectors, issue trackers, design tools, or internal APIs. You add MCP servers via claude mcp add, and their tools then appear alongside built-in capabilities. A common setup connects a Postgres MCP server so Claude can inspect schema and query data directly while debugging, instead of you pasting table definitions into chat.
Custom commands let you encode repeated workflows and have been merged into skills. Create a SKILL.md file with instructions (invocable via /fix-issue):
Look at the GitHub issue described below and fix it.
Steps:
1. Reproduce the issue based on the description
2. Identify the root cause
3. Implement a minimal fix
4. Add a regression test
5. Run the full test suite
Issue: $ARGUMENTS
Now /fix-issue 1428 runs your entire standardized debugging workflow. Teams share these commands through the repository, which turns individual productivity into team-wide convention — arguably the most underrated aspect of the tool.
Common Pitfalls and How to Avoid Them
A few failure patterns come up repeatedly. Overly broad tasks produce mediocre results: "build the whole feature" invites the agent to make a dozen architectural decisions you should have made. Break work into reviewable chunks — a data model change, then endpoints, then UI — approving each step.
Skipping verification is the second trap. Claude Code runs your tests when asked, but it can also rationalize a failing test away. Make "run the full test suite and don't mark anything skipped" an explicit part of your prompts for anything nontrivial.
Third, stale context after external changes. If you pull new commits or switch branches mid-session, the agent's mental model may be outdated. A quick /clear plus a fresh summary of the current state is cheaper than debugging its confusion.
Finally, don't use Claude Code as a substitute for understanding your own codebase. It excels at accelerating work you could do yourself; it's a poor choice when you need to learn a system, because accepting its explanations without verification builds a false mental model. For learning, use it to generate questions and trace code, then read the code yourself.
Frequently Asked Questions
Yes, in practice. You need either a Claude Pro or Max subscription, or API billing through the Anthropic Console (or a supported cloud provider like Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry). There is no meaningful free tier for agentic usage, since tasks consume substantial tokens.
**GitHub Copilot** primarily works inside your editor as autocomplete and inline chat, suggesting code as you type. Claude Code is a terminal-based agent that autonomously executes multi-step tasks — editing multiple files, running commands, and iterating on test results. They complement each other: Copilot for line-level speed, Claude Code for task-level work.
Yes. It’s language-agnostic and works from your repository’s actual content rather than language-specific tooling. It tends to perform best in ecosystems with strong conventions, established test frameworks, and good tooling output it can read — but Python, Go, Rust, TypeScript, and infrastructure-as-code repos all work well.
Claude Code sends relevant code and context to the model to complete tasks, which is inherent to how it works. If this is a concern for your organization, review Anthropic’s data usage policies and consider API or cloud-provider configurations with commercial terms that fit your compliance requirements. Never connect it to secrets or credentials you wouldn’t expose to a trusted contractor.
Any machine with a terminal. Claude Code itself is lightweight; the heavy computation happens server-side. It works on macOS, Linux, and Windows (natively or via WSL).
Conclusion
Claude Code rewards a small amount of setup with a large amount of leverage. Generate a CLAUDE.md with /init, prompt with outcomes anchored to your existing patterns, keep sessions clean with /clear and /compact, and treat permission prompts as the review layer they're designed to be. The agents handle the mechanical work — multi-file edits, test loops, boilerplate — while you retain the architectural judgment. Start small: pick a well-tested, low-risk task in your codebase, run it through Claude Code this week, and review the diff as carefully as you'd review a junior developer's pull request. That review habit, more than any prompt trick, is what makes agentic coding tools safe and genuinely productive.
Transparency Note: Links in this article are not affiliate links. I recommend these tools and platforms based on their relevance to the topic, and no compensation is received for including them.