How to Set Up Claude Code: The Complete 2026 Guide
TL;DR
- The outcome of a full setup is the gap between a smart autocomplete and an autonomous coding agent that understands your architecture, remembers past decisions, and follows your deployment process step by step.
- The configuration stack builds in seven steps: install Claude Code (
npm install -g @anthropic-ai/claude-code, Node.js 18 or later), write a CLAUDE.md, set up persistent memory in.claude/memory.md, add custom skills, configure hooks, build agent workflows, then connect MCP servers. - CLAUDE.md is the single most impactful file (about 10 minutes to write); memory must stay compact, with a hard 100-line cap, because every line consumes context window space.
- Skills are advisory procedures in
.claude/skills/, while hooks are hard constraints defined in.claude/settings.jsonthat Claude cannot skip or override. - Agent workflows use progressive trust: start read-only (analyze, report), then add write actions, then external actions like deploy and PR creation as confidence grows.
Why your Claude Code setup matters
Claude Code is powerful out of the box, but most developers only scratch the surface. The difference between a default Claude Code setup and a fully configured one is dramatic: it's the gap between a smart autocomplete and an autonomous AI coding agent that understands your architecture.
A default Claude Code session can answer questions about your code and make simple changes. A properly configured setup understands your project's conventions, remembers decisions from last week, follows your deployment process step by step, and catches code quality issues before they reach production.
This Claude Code setup guide covers the full configuration path: installation, project configuration, custom skills, persistent memory, automation hooks, and the development workflow patterns that separate casual users from power users. Whether you're setting up Claude Code for the first time or optimizing an existing installation, every step here compounds your productivity. If you're new to Claude Code entirely, start with our introduction to Claude Code first.
Step 1: Install Claude Code
If you haven't already, install Claude Code via npm:
npm install -g @anthropic-ai/claude-code
Run claude in any project directory to start a session. Claude Code will read your codebase, understand your project structure, and start helping immediately. If the install errors out (an EACCES permission wall, a command not found after a clean install, or a Node version complaint), our guide to a failed Claude Code installation maps each symptom to its fix.
A few things to verify after installation:
- Node.js version: Claude Code requires Node.js 18 or later. Run
node --versionto check. - Authentication: You'll need an Anthropic API key or a Claude Max subscription. Claude Code prompts you to authenticate on first run.
- Terminal: Works in any terminal, including iTerm, Warp, the built-in VS Code terminal, or plain Terminal.app. Some developers prefer a dedicated terminal window so Claude Code sessions don't interfere with their normal terminal workflow.
At this point you have a working Claude Code installation. Everything that follows is about making it dramatically more effective.
Step 2: Create your CLAUDE.md
The CLAUDE.md file is the single most impactful configuration you can make. It sits in your project root and tells Claude Code how to work with your specific codebase. Claude reads it automatically at the start of every session.
A good CLAUDE.md includes:
- Project context: what the project does, tech stack, architecture
- Coding conventions: naming, formatting, patterns to follow
- File structure: where things live, what the key files are
- Commands: how to build, test, deploy
- Constraints: what not to do, common pitfalls
Think of it as onboarding documentation, but for your AI coding partner.
What a practical CLAUDE.md looks like
# Project: Acme Dashboard
## Tech Stack
- Next.js 14 (App Router)
- TypeScript (strict mode)
- Tailwind CSS
- Drizzle ORM with Postgres
- Deployed on Vercel
## File Structure
- `src/app/`: pages and API routes
- `src/components/`: reusable UI components
- `src/lib/`: utilities, database, auth
- `src/db/`: Drizzle schema and migrations
## Commands
- `pnpm dev`: start dev server
- `pnpm build`: production build
- `pnpm test`: run test suite
- `pnpm db:migrate`: run database migrations
## Conventions
- Use named exports, not default exports
- Components use PascalCase filenames
- API routes return typed responses
- All database queries go through the repository pattern
## Don't
- Never commit .env files
- Never use `any` type: always define proper types
- Never push directly to main: always use PRs
This takes 10 minutes to write and immediately makes every Claude Code session more productive. Claude stops guessing about your project structure and starts following your actual conventions.
Once your setup is solid, the next step is building a repeatable process around it. Our guide to building an effective AI coding workflow covers the full loop from configuration to measuring output.
CLAUDE.md hierarchy
Claude Code supports multiple CLAUDE.md files at different levels:
~/CLAUDE.md: global rules that apply to all projects (your personal preferences)./CLAUDE.md: project-level rules (tech stack, conventions, commands)./src/CLAUDE.md: directory-level rules (subsystem-specific guidance)
Rules cascade: project-level overrides global, directory-level overrides project. This lets you set universal preferences (like "always use TypeScript strict mode") globally while keeping project-specific details local.
Step 3: Set up persistent memory
By default, Claude Code starts fresh every session. That means it forgets decisions, context, and preferences. Setting up a memory system changes this completely.
Create a .claude/memory.md file that Claude reads at the start of every session. This file should contain:
- Active project state (what you're working on right now)
- Architectural decisions already made (and why)
- Known issues and workarounds
- User preferences (coding style, review strictness)
A starter memory file
# Project Memory
## Current Focus
- Building user authentication system
- Migrating database from SQLite to Postgres
## Decisions Made
- Using JWT tokens (not sessions): decided March 5
- API versioning via URL prefix (/v1/): decided March 3
## Known Issues
- Rate limiter doesn't work behind Cloudflare proxy
- Test suite takes 4 minutes: needs parallelization
## Preferences
- Always use TypeScript strict mode
- Prefer named exports over default exports
The golden rule: keep it compact
The most common memory mistake is letting the file grow unbounded. Every line consumes context window space, the same space Claude needs for understanding your code and generating responses.
Hard rules that work:
- 100 lines maximum for your main memory file
- Prune aggressively: remove items when they're done or no longer relevant
- Summarize, don't log: "Auth system complete" not a detailed changelog
- Date your entries: makes it easy to spot stale items
A 500-line memory file doesn't give Claude more context, it gives it more noise. We cover advanced memory patterns, including multi-layer architectures and automated lifecycle management, in How to Build a Memory System for Claude Code.
Step 4: Add custom skills
Skills are reusable procedures that Claude Code can invoke. They live in .claude/skills/ as markdown files with structured instructions. When Claude encounters a task that matches a skill, it loads and follows it, giving you consistent, repeatable results instead of ad-hoc improvisation. Our Claude Code skills guide explains the matching and loading mechanics in detail if you want to understand exactly when a skill fires.
High-value skills to create first
Start with the tasks you explain to Claude most often:
- Deployment: one-command deploy to Railway, Vercel, or any platform with pre-checks and rollback steps
- Database migrations: safe schema changes with backup and verification
- Code review: automated review against your team's standards
- Testing: run the right test suite for what changed
- PR creation: generate PR descriptions that match your team's format
Anatomy of a skill file
---
description: Run database migrations safely
tools: Bash, Read, Write
---
# Database Migration Skill
## When to use
- Schema changes needed
- New tables, columns, or indexes
## Procedure
1. Read current schema state
2. Generate migration file with timestamp
3. Run migration against staging first
4. Verify data integrity
5. Apply to production
6. Update schema documentation
## Constraints
- Never drop columns without a deprecation period
- Always create indexes concurrently
- Back up affected tables before destructive changes
The frontmatter tells Claude when and how to use the skill. The procedure gives it step-by-step instructions. The constraints prevent common mistakes. This structure works because it encodes your team's expertise into a format Claude can follow reliably.
For a deeper dive into skill design, categories, and building an effective library, read Claude Code Skills Explained.
Step 5: Configure hooks
Hooks are deterministic enforcement: they run automatically before or after Claude takes certain actions. Unlike skills (which are advisory), hooks are hard constraints. Claude cannot skip or override a hook.
How hooks work
Hooks are defined in .claude/settings.json. Each hook specifies a trigger event and a command to run:
{
"hooks": {
"PreCommit": [
{
"command": "pnpm lint && pnpm typecheck",
"description": "Lint and type-check before committing"
}
],
"PreWrite": [
{
"command": "bash .claude/hooks/check-secrets.sh",
"description": "Prevent writing files that contain secrets"
}
]
}
}
Essential hooks to configure
Pre-commit hooks: run linting, type-checking, and tests before every commit. This prevents Claude from committing code that doesn't meet your standards, even when working autonomously.
Pre-write hooks: validate file content before Claude writes it. Common uses: prevent hardcoded secrets, enforce file size limits, check that generated code includes required boilerplate (like license headers).
Post-tool hooks: run after Claude uses certain tools. Useful for logging, audit trails, and verification steps. For example, log every file Claude modifies so you can review changes later.
Hooks are your safety net. They let you give Claude more autonomy because you know the guardrails will catch problems regardless of what Claude decides to do.
Step 6: Build agent workflows
Once you have skills and memory working, the next level is agent workflows: multi-step procedures that Claude executes autonomously by chaining skills together.
Example: automated daily standup
A "daily standup" workflow that runs every morning:
- Read git log since yesterday
- Check CI/CD status for recent builds
- Review open PRs and their review status
- Summarize blockers from yesterday's notes
- Write a daily standup summary to your notes
Example: PR review pipeline
An automated PR review workflow:
- Read the PR diff
- Check for security issues (dependency vulnerabilities, exposed secrets)
- Run the test suite against the PR branch
- Review code quality against your team's standards
- Generate a review comment with specific, actionable feedback
Building trust with automation
The key to agent workflows is progressive trust. Start with read-only workflows (analyze, report, summarize). Once you trust the output, add write actions (create files, commit code). Finally, add external actions (deploy, create PRs, send notifications).
Each step gives you confidence before expanding the scope. A well-built agent workflow should feel like delegating to a reliable colleague: you check the output occasionally, but you trust the process.
The configuration stack at a glance
Each layer builds on the previous one:
| Layer | What it does | Time to set up |
|---|---|---|
| CLAUDE.md | Project context and conventions | 10 minutes |
| Memory | Cross-session continuity | 15 minutes |
| Skills (5-10) | Repeatable procedures | 1-2 hours |
| Hooks | Automated guardrails | 30 minutes |
| Agent workflows | Autonomous multi-step tasks | 2-4 hours |
| Full optimization | All layers tuned and tested | Days to weeks |
You don't need everything at once. CLAUDE.md alone is a significant improvement. Each additional layer compounds the value.
Step 7: Connect MCP servers
MCP (Model Context Protocol) servers extend what Claude Code can access. Without MCP, Claude Code reads files and runs terminal commands. With MCP servers, it can query databases, manage GitHub issues, control browsers, and interact with dozens of external services directly.
Add a server with one command:
claude mcp add github --scope project -- npx @modelcontextprotocol/server-github
Start with 2-3 servers that match your workflow: database access, GitHub, and browser automation cover most development needs. Each server adds tool definitions to Claude Code's context, so add what you use and disable the rest. Our complete MCP servers guide covers setup, configuration, and the most useful servers for developers. If a server you added never shows its tools, Claude Code MCP not connecting walks through the six causes and their fixes.
Common Claude Code setup issues
"Rate limit reached" errors: This is the most common frustration. Claude Code sends your entire conversation history with each request, so long sessions consume tokens fast. Run /compact regularly and start fresh sessions at natural breakpoints. See our Claude Code rate limit fix for the full solution.
Claude forgets context between sessions: You need persistent memory. Create .claude/memory.md (covered in Step 3 above) and make sure Claude reads it at session start.
Claude ignores your project conventions: Your CLAUDE.md file needs to be more specific. Instead of "follow good practices," spell out exact conventions: naming patterns, file structure rules, and commands to run.
Slow response times: Large codebases can slow Claude Code down if it's reading too many files. Use .claudeignore (same syntax as .gitignore) to exclude node_modules, build artifacts, and other files Claude doesn't need to read.
Claude makes changes you didn't ask for: Configure hooks (Step 5) to enforce guardrails. Pre-write hooks can validate content before any file changes happen, and pre-commit hooks catch issues before code is committed.
Claude keeps asking permission for every command, or refuses one outright: That is the permission system doing its job, but it needs tuning. Claude Code permission errors covers the settings.json allow list patterns that stop the constant prompts. If Claude Code installed fine but is misbehaving in other ways, why Claude Code is not working groups the common runtime failures by type.
The fast path: Claudify
If setting up all of this manually sounds like a lot of work, it is. That's exactly why Claudify exists.
Claudify is a pre-built operating system for Claude Code that includes everything in this guide and more: 1,727 skills covering development, deployment, testing, security, and documentation; persistent memory architecture with automated lifecycle management; hook-based quality enforcement; and 9 specialist agents for different development domains.
It installs in one command and transforms your Claude Code setup instantly. Instead of spending days configuring everything from scratch, you get a battle-tested system that's already been optimized across hundreds of real projects.
Further reading
- Claude Code documentation: Anthropic's official reference for installation, configuration, and advanced features
- awesome-claude-code: a community-curated collection of Claude Code resources, plugins, and examples
What to do next
Whether you build your setup manually or use Claudify, the key is to actually invest in configuration. Claude Code rewards the effort: a well-configured setup doesn't just save time, it fundamentally changes what's possible.
Start with CLAUDE.md. That single file will give you the biggest immediate improvement. Then add memory for cross-session continuity. Then build skills for your most repeated tasks. Each layer makes Claude Code meaningfully more capable.
And if you want the full stack, including skills, memory, hooks, and agents, ready to go in one command, get Claudify.
More like this
Ready to upgrade your Claude Code setup?
Get Claudify