How to Use Claude Code: Complete Guide

2026-08-04
Learn how to use Claude Code from setup to advanced workflows. Covers skills, hooks, commands, CLAUDE.md config, and everything-claude-code setup. Step-by-step guide for developers.
This guide covers everything from your first claude command to building custom skills and hooks. How long does it take to get productive? About an afternoon. Claude Code works differently from IDE plugins — it's an agent that reads your project, edits files, and runs commands. Getting comfortable with its workflow takes some practice, but the payback is real once it clicks.
Getting Started: Your First Claude Code Session
You need Node.js 18+ and an Anthropic account (Pro plan or API key). Install Claude Code globally:
npm install -g @anthropic-ai/claude-code
Verify it works:
claude --version
Navigate to any project directory and launch Claude Code:
cd my-project
claude
Claude Code scans your project structure, reads relevant files, and opens an interactive session. You'll see a welcome banner showing the model and your usage quota. The first thing you'll notice: there's no chat sidebar or autocomplete popup. It's a terminal REPL. Type your request and Claude gets to work.
Your first prompt can be as simple as "explain this project's architecture" or "what does the auth module do?" Claude reads through your codebase and gives a structured answer. That's a good way to verify everything is wired up before you ask it to write code.
Setting Up CLAUDE.md: Your Project's Memory File
CLAUDE.md is the most important file you'll write for Claude Code. It sits in your project root and contains everything Claude can't figure out by reading your code: build commands, code style rules, testing conventions, and architectural decisions.
Run /init in a Claude Code session to generate a starter CLAUDE.md automatically. Claude scans your project and writes a draft. Edit it. Remove boilerplate. Add what matters:
# Build & Test Commands
- Build: npm run build
- Lint: npm run lint
- Test: npm test -- --coverage
- Run single test: npx jest path/to/test.ts
# Code Style
- Use TypeScript strict mode
- Prefer named exports over default exports
- React components use function declarations, not arrow functions
- API routes follow REST conventions in src/api/
# Architecture
- src/api/: Express route handlers
- src/services/: Business logic, no HTTP concerns
- src/db/: Prisma schema and query helpers
- Config lives in src/config/, loaded from env vars
Keep it under 200 lines. If it gets longer, split rules into .claude/rules/ with path matchers.
The golden rule: if Claude can learn it by reading your code, don't put it in CLAUDE.md. Only write what it can't infer — conventions you chose, patterns your team agreed on, commands that aren't obvious.
Essential Slash Commands in Claude Code
Slash commands are your control panel inside a session. Type / at the beginning of a message to see the full list. These are the ones you'll use every day:
/init — Generates a CLAUDE.md from your project. Run this first in any new project.
/compact — Compresses the conversation context when it gets long. Claude summarizes the discussion so far and frees up token space for continued work. Use this in sessions that run past 30-40 messages.
/clear — Wipes the conversation context completely. Useful when you want to switch tasks without starting a new session.
/review — Reviews your current code changes. Feed it a diff or let it check unstaged changes. Claude flags potential bugs, style issues, and security concerns.
/memory — Opens the CLAUDE.md editor. Quick way to add a rule or convention you just discovered you need.
/cost or /usage — Shows token usage, session cost, and quota limits. Check this before starting a big task to make sure you won't hit your ceiling halfway through.
/fast — Switches to a faster (usually Haiku) model for simple tasks. Good for quick questions or trivial edits where you don't need the full reasoning depth.
Working with Claude Code Skills
Skills are reusable instruction packs that extend Claude's capabilities. Think of them as pre-built expertise modules — install one and Claude instantly knows how to handle that domain.
Installing Skills
The plugin browser is the easiest way to discover and install skills:
claude skills install
Or search the marketplace from inside a session:
/plugin
Browse the available skills, pick what matches your workflow, and install with a click. Popular starter skills include:
find-skills— The skill discovery engine. Searches across 200,000+ community skills by topic.frontend-design— Gives Claude a design system to follow when generating UI.playwright— Teaches Claude Playwright testing patterns and best practices.skill-creator— Helps you write your own custom skills.
Creating a Custom Skill
A skill is just a Markdown file. Create ~/.claude/skills/my-skill/SKILL.md:
---
name: my-api-conventions
description: API design conventions for our Express + Zod stack
---
# API Conventions
## Route Structure
- All routes use Zod for input validation
- Errors return { error: string, code: number }
## Example
Good:
`router.get('/users/:id', validate(getUserSchema), getUser)`
Bad:
`router.get('/users/:id', (req, res) => { ... })`
Claude loads this automatically when your task involves API work. The name and description in the frontmatter are what Claude reads at session start — keep the description specific enough that Claude can tell when to load the full skill.
Using Hooks to Automate Claude Code
Hooks run scripts at specific lifecycle events. They're the enforcement layer — skills tell Claude what to do, hooks stop it from doing what it shouldn't.
Pre-Commit Hook Example
Create ~/.claude/hooks/pre-commit.sh:
#!/bin/bash
# Run linter before every commit
npm run lint
if [ $? -ne 0 ]; then
echo "Lint failed. Fix errors before committing."
exit 1
fi
Make it executable: chmod +x ~/.claude/hooks/pre-commit.sh
Now whenever Claude tries to commit code, it runs your linter first. Failing lint = blocked commit. This catches mistakes before they hit your repo.
Session Start Hook
A SessionStart hook injects context automatically when you start a new session:
#!/bin/bash
# Load the latest project status
echo "Current branch: $(git branch --show-current)"
echo "Last commit: $(git log -1 --oneline)"
echo "Unstaged changes:"
git status --short
This saves you from typing "what branch are we on and what was I doing?" at the start of every session.
Where to Find Hook Documentation
The official Claude Code hooks documentation lives in Anthropic's developer docs. It covers all lifecycle events (SessionStart, SessionStop, PreToolUse, PostToolUse, Notification) and the script interface. For deeper examples, check the Claude Code GitHub repository — its docs folder contains annotated hook scripts for common workflows. The everything-claude-code repository also ships with a comprehensive set of pre-built hooks that cover common workflows — linting, testing, formatting, and security checks.
Working with Sub-Agents
Sub-agents are Claude Code's parallel execution system. Instead of having one Claude work through a task sequentially, you can spawn multiple specialized agents that run simultaneously.
Tell Claude: "Run three sub-agents: one to add TypeScript types to the API module, one to write tests for the new endpoints, and one to update the documentation." Claude splits the work across three independent sessions. Each sub-agent has its own context window, so they don't step on each other.
Sub-agents work best for tasks that are naturally independent. Adding types to separate modules, writing tests for different components, generating documentation for multiple packages — these all parallelize cleanly. They don't help when tasks depend on each other's output.
The everything-claude-code package includes 64 pre-configured sub-agents for common patterns: code review, test generation, documentation writing, migration scripting, and more.
Integrating with VS Code and JetBrains
Claude Code works in the terminal, but you're probably in an IDE most of the time. The VS Code extension brings the same agent experience into your editor. Install it from the VS Code marketplace, log in, and access Claude from the sidebar.
In VS Code, you can highlight code and ask Claude to explain or refactor it. The extension also supports the same slash commands as the terminal — /review, /init, and the rest work identically. File diffs appear inline, and you approve or reject changes right in the editor.
JetBrains support comes through a dedicated plugin available in the JetBrains marketplace. It works across IntelliJ, PyCharm, WebStorm, and the rest of the JetBrains IDE family. Configuration is shared with the CLI — your CLAUDE.md and skills apply across all interfaces.
Practical Claude Code CLI Tips
The Claude Code CLI documentation on Anthropic's site covers every command in detail, but here are the ones that make the biggest difference day to day.
- Start small. Don't ask Claude to build a full feature on your first prompt. Start with "refactor this function to use async/await" or "add error handling to this endpoint." Build trust gradually.
- Be specific about what not to change. "Add rate limiting to the API but don't touch the auth middleware or the database schema." Claude follows exclusion instructions well, and being explicit about off-limits areas prevents unwanted changes.
Use /compact before it's critical.When your session hits 30+ messages, Claude's context fills up. Compact proactively, not reactively. A compacted session keeps all the key decisions and code context while freeing space for continued work.- Review every file change. Claude Code asks for confirmation before editing files. Read the diffs. Really read them — even when you're 40 messages deep and trust the agent. It catches mistakes that compound into hours of debugging.
- Version your CLAUDE.md. Commit it to your repo. When conventions change, update CLAUDE.md. Team members pulling the repo get the same Claude configuration. This is how you get consistent AI-assisted development across a team.
Conclusion
Claude Code is the most capable AI coding agent you can run in your terminal today. The skills system and everything-claude-code project make it extensible. Hooks keep it from breaking your rules. CLAUDE.md gives it persistent project memory across sessions.
The setup investment — installing the CLI, writing a good CLAUDE.md, picking a few skills — takes maybe an afternoon. After that, you're spending less time on boilerplate, context-switching, and repetitive refactors, and more time on the parts of development that need your actual judgment.
If you haven't installed Claude Code yet, start with the npm command above. For mobile access to Claude's chat features, download the Claude app on APKPure — it keeps you connected to your conversations wherever you are.
You can also get ChatGPT here:









