Getting Started with Claude Code
Claude Code is Anthropic's agentic coding tool. It reads your codebase, edits files, runs commands, and integrates with your terminal, IDE, browser, and apps.
Overview
What Claude Code is and why we use it
Claude Code is an agentic coding tool that reads your codebase, edits files, and runs commands. Unlike simple code completion, Claude Code operates in an agentic loop — it gathers context, plans, acts, and verifies its own work.
Why Our CloseFuture Team Uses Claude Code?
Ship Faster
Automate boilerplate, test writing, and code gen. Ship features in hours, not days.
Git Automation
Commits, branches, PRs, code reviews — all through natural language.
Auto Testing
Generate tests, run them, fix failures, and iterate until they pass.
Bug Fixing
Analyze stack traces, find root causes, and apply targeted fixes.
Documentation
Auto-generate JSDoc, README updates, and release notes.
Team Standards
CLAUDE.md shares conventions across all sessions and team members.
What You Can Do
- Ask questions about your codebase — "How does our auth middleware work?"
- Edit code across multiple files — "Add input validation to the signup form"
- Run and fix tests — "Write tests for the cart service and fix any failures"
- Search and navigate — "Find all API endpoints that don't have auth checks"
- Git operations — "Commit these changes, create a PR with a clear description"
- Automate CI workflows — Use in GitHub Actions for automated code reviews
- Connect external tools — Jira, Slack, Supabase databases via MCP protocol
Platforms at a Glance
| Platform | Best For | Key Features |
|---|---|---|
| Terminal CLI | Full control, scripting | All features, composable with Unix tools |
| VS Code | IDE workflow | Inline diffs, @-mentions, plan review |
| JetBrains | IntelliJ/PyCharm users | Interactive diffs, context sharing |
| Desktop App | Visual review, parallel work | Side-by-side sessions, visual diffs |
| Web | No local setup, mobile | Cloud sandboxed, long-running tasks |
| GitHub Actions | CI/CD automation | Automated PR review, code gen |
| Slack | Team workflows | Route bugs to PRs from chat |
Quickstart
From zero to running in 5 minutes
System Requirements
- OS: macOS 13+, Windows 10 1809+, Ubuntu 20.04+, Debian 10+
- Hardware: 4 GB+ RAM
- Network: Internet connection required
- Shell: bash, zsh, or PowerShell recommended
Step-by-Step Setup
Create your account
Go to claude.ai and sign up. Upgrade to Pro ($20/mo) or Max ($100 or $200/mo) under Settings → Billing.
Install Claude Code
curl -fsSL https://claude.ai/install.sh | bash# PowerShell
irm https://claude.ai/install.ps1 | iex
# Or WinGet
winget install Anthropic.ClaudeCodebrew install --cask claude-code# Requires Node.js 18+
npm install -g @anthropic-ai/claude-codeNavigate to your project and start
cd your-project
claudeAuthenticate
On first run, Claude opens your browser for login. Sign in with your Anthropic account and trust the project directory.
Start coding
# Ask about your project
> summarize this codebase and explain the architecture
# Make changes
> add input validation to the signup form in src/components/Signup.tsx
# Run tests
> run the test suite and fix any failures.gitignore and never sends ignored files. It reads your project structure to understand context.How Claude Code Works
The agentic loop and available tools
Claude Code operates through an intelligent three-phase agentic loop. Unlike traditional code assistants, Claude gathers context, acts, and verifies its own work — iterating until complete.
1. Gather Context
Read/search files, analyze errors, review git state, load CLAUDE.md instructions
2. Take Action
Edit files, run commands, execute git operations, invoke external tools via MCP
3. Verify Results
Run tests, analyze output, course-correct, iterate until the task is complete
Available Tools
| Tool | What It Does |
|---|---|
| Read | Read file contents with line-level precision |
| Write / Edit | Create new files or make targeted edits |
| Glob | Find files by pattern (e.g., **/*.tsx) |
| Grep | Search file contents with regex |
| Bash | Execute shell commands (builds, tests, git, etc.) |
| Task (Subagent) | Spawn sub-agents for parallel work |
| WebSearch | Search the web for documentation and solutions |
| MCP Tools | External integrations (Jira, Slack, databases, etc.) |
Permission System
| Mode | Behavior | Activate |
|---|---|---|
| Normal (default) | Asks before file edits and shell commands | Default |
| Auto-Accept Edits | Edits files silently, asks for shell commands | Shift+Tab |
| Plan Mode | Read-only analysis, creates a plan for your approval | Shift+Tab ×2 |
Common Workflows
How to use Claude Code for everyday tasks
Explore → Plan → Code → Commit
Explore (Plan Mode)
Start with Shift+Tab to enter Plan Mode. Ask Claude to read and understand the relevant code.
> read src/auth/ and explain how session handling worksPlan
Ask for a detailed implementation plan. Review it, adjust if needed.
> create a plan to add OAuth2 support using the existing auth patternsImplement
Switch back to Normal Mode and let Claude execute the plan.
> implement the plan. write tests and run them after each changeCommit
> commit the changes with a descriptive message and create a PRFix Bugs
> the login form throws a TypeError when email is empty - find and fix it
> users report a blank screen after failed login. check token refresh in src/auth/
> fix the race condition in the checkout flowWrite and Fix Tests
> write comprehensive tests for the CartService class, aim for >90% coverage
> find untested functions in the notification module and add edge case tests
> run the test suite and fix all failuresRefactor Code
> refactor fetchUserData to use async/await instead of .then() chains
> migrate our Express routes from JavaScript to TypeScript with proper type definitions
> find deprecated API usage across the project and suggest modern alternativesGit & PRs
> commit my changes with a descriptive message
> create a new branch called feature/oauth2
> create a PR with a summary of what changed and why
> help me resolve the merge conflicts in src/api/users.tsPipe & Script (Headless)
# One-shot query
claude -p "summarize this project"
# Process piped content
git diff main...feature | claude -p "review these changes for bugs and security issues"
# Structured output
claude -p "list all API endpoints" --output-format json > endpoints.jsonBest Practices
Get the most out of Claude Code
Write Effective Prompts
| Strategy | ❌ Before | ✓ After |
|---|---|---|
| Be specific | "fix the bugs" | "fix the null pointer in UserService.getProfile() when user.email is undefined" |
| Point to sources | "why is the API weird?" | "look through the git history of ExecutionFactory and explain the design decisions" |
| Reference patterns | "add a calendar widget" | "look at HotDogWidget.php as a reference and implement a CalendarWidget similarly" |
| Include verification | "write a validator" | "write validateEmail. test: user@example.com=true, invalid=false. run tests after" |
Context Management
- Use
/clearbetween unrelated tasks - Use
/compactto compress long conversations - Run
/clearafter 2+ failed correction attempts — start fresh - Use subagents for exploratory work (they get separate context)
- Put persistent rules in
CLAUDE.md, not in conversation
Pitfalls to Avoid
| Pitfall | Fix |
|---|---|
| Kitchen-sink sessions (mixing unrelated tasks) | /clear between different tasks |
| Correcting Claude repeatedly | /clear and rewrite a better initial prompt |
| Over-specified CLAUDE.md | Keep it short — aim for under 100 lines |
| Trust-then-verify gap | Always include tests or screenshots as verification |
CLAUDE.md
Project memory and team standards
CLAUDE.md is a markdown file Claude reads at the start of every session. Run /init to create one.
Where to Put It
| Location | Scope | Git |
|---|---|---|
~/.claude/CLAUDE.md | Global — all projects, all sessions | Not in git |
./CLAUDE.md | Project — shared with team | Check into git |
./CLAUDE.local.md | Personal project prefs | Add to .gitignore |
./src/CLAUDE.md | Subdirectory — auto-loaded for that folder | Check into git |
What to Include
# CLAUDE.md
## Tech Stack
- TypeScript strict mode, React 18, Next.js 14
- Tailwind CSS for styling
- Vitest for testing (not Jest)
- pnpm (not npm or yarn)
## Commands
- Build: `pnpm build`
- Test: `pnpm test`
- Lint: `pnpm lint`
## Architecture
- API routes in src/api/
- Components in src/components/
- All DB access through Supabase Client
## Conventions
- Branch naming: feature/*, bugfix/*, hotfix/*
- Commit messages: conventional commits (feat:, fix:, refactor:)Terminal (CLI)
The full-featured command-line interface
Starting a Session
claude # Interactive session
claude "task description" # Start with a task
claude -p "query" # One-shot (print mode)
claude -c # Continue most recent conversation
claude -r # Resume a specific session
claude -r auth-refactor # Resume by session nameInteractive Commands
| Command | Description |
|---|---|
/help | Show all commands and keyboard shortcuts |
/compact | Compress conversation to save context |
/clear | Reset conversation — start fresh |
/model | Switch model mid-session (Sonnet, Opus, Haiku) |
/context | Check context window usage |
/commit | Create a well-formatted git commit |
/review-pr | Review a pull request |
/init | Generate a CLAUDE.md for the project |
/login | Switch accounts |
/doctor | Diagnose installation issues |
/config | Open settings interface |
/hooks | Configure automation hooks |
/skills | List available skills |
/agents | Configure subagents |
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Shift+Tab | Cycle permission modes (Normal → Auto-Accept → Plan) |
Esc | Interrupt current action |
Esc Esc | Rewind to last checkpoint |
Ctrl+C | Cancel / exit |
? | Show all keyboard shortcuts |
VS Code Integration
Full IDE integration with inline diffs
Search for "Claude Code" in the Extensions marketplace (Ctrl+Shift+X) and install. Requires VS Code 1.98.0+.
Key Shortcuts
| Shortcut | Action |
|---|---|
Alt+K | Insert @-mention (reference a file) |
Ctrl+Esc | Toggle focus between editor and Claude |
Ctrl+Shift+Esc | Open Claude in a new editor tab |
Ctrl+N | New conversation |
Shift+Tab | Cycle permission modes |
Alt+T | Toggle extended thinking |
Features
- Inline diffs — review every code change before accepting
- @-mentions —
@filenamefor files,@folder/for directories - Checkpoints — hover over messages to rewind code and conversation
- Plan Mode — analyze safely before committing to changes
- Drag & drop — drag files into chat as context
JetBrains IDEs
IntelliJ, PyCharm, WebStorm, and more
Install the Claude Code plugin from the JetBrains Marketplace. Supports IntelliJ IDEA, PyCharm, WebStorm, GoLand, PHPStorm, and others.
- Interactive diffs for reviewing code changes
- Context sharing with the IDE
- Same command set as the CLI (
/compact,/clear, etc.) - Permission mode cycling with
Shift+Tab
Desktop App
Visual interface with parallel sessions
Download from claude.ai/download for macOS (Intel/Apple Silicon) or Windows (x64, ARM64).
- Side-by-side parallel sessions with separate git worktrees
- Visual diffs for reviewing changes
- All the same agentic capabilities as the terminal
- Use
/desktopin CLI to hand off a session to the desktop app
Claude Code on the Web
No install required, cloud-sandboxed
Go to claude.ai/code and sign in. No local setup needed.
- Full agentic coding in a sandboxed cloud environment
- Connect to GitHub repos directly
- Long-running tasks continue even if you close the browser
- Works on mobile — check progress from anywhere
- Use
/teleportin CLI to pull a cloud session to your terminal
Model Context Protocol (MCP)
Connect Claude to external tools and services
MCP lets Claude Code communicate with external tools — databases, APIs, project management tools, and more.
Adding MCP Servers
# Add a server
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
# Add a stdio server
claude mcp add my-server -- node /path/to/server.js
# List configured servers
claude mcp list
# Remove a server
claude mcp remove my-serverPopular Integrations
Jira / Linear
Read and update tickets from within Claude
Slack
Send messages and read channel context
Databases
Query Postgres, MySQL, SQLite directly
Google Drive
Read docs and spreadsheets as context
Figma
Read design files and translate to code
Monitoring
Connect to Sentry, Datadog, etc.
Hooks
Automate actions before or after Claude acts
Hooks run deterministic commands at specific points in Claude's workflow — like linting after edits or blocking changes to certain directories.
{
"hooks": {
"afterEdit": [
{ "command": "eslint --fix $FILE", "description": "Auto-fix lint issues" }
],
"beforeCommit": [
{ "command": "pnpm typecheck", "description": "Type-check before committing" }
]
}
}Available Hook Points
- afterEdit — runs after any file is modified
- beforeCommit — runs before git commits
- afterCommit — runs after git commits
- onSessionStart — runs when a session begins
Skills
Reusable slash commands for common workflows
Skills are custom slash commands you create for repeatable workflows. They live in .claude/skills/.
---
name: review-pr
description: Review a PR with our team's checklist
---
# PR Review Workflow
1. Read all changed files
2. Check for security issues (SQL injection, XSS, auth bypass)
3. Check for performance issues (N+1 queries, missing indexes)
4. Verify tests exist for new functionality
5. Check adherence to our code style (see CLAUDE.md)
6. Write a structured review commentThen use it with /review-pr. Run /skills to see all available skills.
Subagents
Specialized AI assistants within a session
Subagents are specialized assistants that run in their own context window with specific tools and permissions.
- Preserve context — keep exploration out of your main conversation
- Enforce constraints — limit which tools a subagent can use
- Specialize — dedicated agents for testing, docs, security review
- Control costs — route tasks to faster, cheaper models like Haiku
Creating a Subagent
---
name: security-reviewer
description: Review code for security vulnerabilities
model: sonnet
tools:
- Read
- Grep
- Glob
---
You are a security-focused code reviewer. Analyze code for:
- SQL injection, XSS, CSRF vulnerabilities
- Authentication and authorization issues
- Hardcoded secrets or credentialsAgent Teams
Multiple agents working in parallel
While subagents work within a single session, agent teams coordinate across separate sessions. A lead agent distributes work and merges results.
- Parallel processing — multiple agents work on different parts simultaneously
- Separate git worktrees — each agent works in isolation
- Lead agent coordinates — distributes tasks, reviews output, merges
- Useful for large refactors, multi-service changes, comprehensive testing
Settings & Configuration
Customize Claude Code behavior
Configure via /config in a session, or edit .claude/settings.json directly.
Configuration Scopes
| Scope | Location | Use For |
|---|---|---|
| User | ~/.claude/settings.json | Personal preferences across all projects |
| Project | .claude/settings.json | Team settings, check into git |
| Local | .claude/settings.local.json | Personal project prefs, gitignored |
| Enterprise | Server-managed | Organization-wide policies |
{
"permissions": {
"allow": ["Bash(npm test)", "Bash(git status)", "Bash(pnpm lint)"]
},
"model": "sonnet",
"theme": "dark"
}Permissions
Control what Claude can and can't do
{
"permissions": {
"allow": [
"Bash(npm test)",
"Bash(npm run lint)",
"Bash(git status)",
"Bash(git diff *)",
"Read", "Glob", "Grep"
],
"deny": [
"Bash(rm -rf *)",
"Bash(git push --force *)"
]
}
}Permission Modes
- Normal: Ask for each edit and command
- Auto-Accept Edits: Edit files freely, ask for commands
- Plan Mode: Read-only. Creates a plan for approval before any changes
--dangerously-skip-permissions bypasses all permission prompts. Only use this in sandboxed CI environments, never locally.Security
Data privacy and safety
- Code context is sent to Anthropic's API for processing
- Anthropic does not train on your code by default
- Team and Enterprise plans have additional data privacy guarantees
- Claude respects
.gitignore— ignored files are never sent - Permission system prevents unauthorized destructive actions
- All API communication is encrypted over HTTPS
Model Configuration
Choose the right model for the task
| Model | Best For | Speed | Usage Cost |
|---|---|---|---|
| Sonnet (default) | Most coding tasks — good balance | Fast | Low |
| Opus | Complex reasoning, architecture | Slower | High |
| Haiku | Simple tasks, high volume | Fastest | Lowest |
# Start with a specific model
claude --model opus
# Switch mid-session
/model sonnet
# Toggle extended thinking (Opus)
# Alt+T in VS CodeExtended Thinking
- Enabled by default for Opus
- Toggle with
Alt+T(VS Code) orOption+T(macOS) - Disable with
export MAX_THINKING_TOKENS=0
CLI Reference
Complete command-line reference
Flags
| Flag | Description |
|---|---|
-p, --print | Print response without interactive mode |
-c, --continue | Continue most recent conversation |
-r, --resume | Resume a specific session by name or ID |
--model <name> | Set model (sonnet, opus, haiku) |
--permission-mode | Set mode (default, plan, acceptEdits) |
--add-dir <path> | Add additional working directories |
--tools <list> | Restrict available tools |
--output-format | Output format: text, json, stream-json |
--max-turns <n> | Limit number of agentic turns |
--json-schema | Get validated structured JSON output |
--verbose | Enable verbose logging |
--chrome | Enable Chrome browser automation |
Checkpointing
Undo anything — safely
Claude automatically creates checkpoints before making changes. You can rewind to any checkpoint to restore both code and conversation state.
- Terminal: Press
Esctwice, or use/rewind - VS Code: Hover over a message and click the rewind icon
- Rewind restores: code changes, conversation state, and file system
- You can fork from a checkpoint to try a different approach
GitHub Actions
CI/CD automation with Claude Code
Use Claude Code in your GitHub Actions workflows for automated code reviews, PR generation, and more.
name: Claude Code Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Review this PR for:
- Bugs and logic errors
- Security vulnerabilities
- Performance issues
Provide specific, actionable feedback.SDK & Programmatic Usage
Build with Claude Code as a library
# Headless mode
claude -p "explain this function" --output-format text
# JSON output for parsing
claude -p "list all API endpoints" --output-format json
# Stream output
cat access.log | claude -p "detect anomalies" --output-format stream-json
# Combine with other tools
git diff main --name-only | xargs -I{} claude -p "review {} for security issues" --output-format jsonTroubleshooting
Common issues and solutions
| Issue | Solution |
|---|---|
command not found: claude | Reinstall, or add to PATH. Run claude doctor. |
| Authentication failures | Run /login to re-authenticate. |
| Slow responses | Use /compact to reduce context. Switch to Sonnet if on Opus. |
| Rate limit reached | Wait for reset (rolling window) or upgrade to Max plan. |
| Extension not loading | Update VS Code to 1.98.0+. Reinstall extension. Check /doctor. |
| MCP server not connecting | Run claude mcp list. Use --debug mcp flag. |
claude --doctor or /doctor in a session for automated diagnostics.Claude Code + Supabase Integration
Complete guide with Agents, Commands, and MCP
This integration installs 2 specialized agents, 8 database commands, and an MCP server that turn Claude Code into a full-featured Supabase development environment.
What's Included
2 Agents
Schema Architect & Realtime Optimizer — specialized agents for database design and WebSocket tuning
8 Commands
Slash commands for schema sync, migrations, performance, security audits, backups, types, data explorer, and realtime monitoring
1 MCP Server
Direct Supabase API integration through Model Context Protocol
Installation
npx claude-code-templates@latest \
--command supabase-schema-sync,supabase-migration-assistant,supabase-performance-optimizer,supabase-security-audit,supabase-backup-manager,supabase-type-generator,supabase-data-explorer,supabase-realtime-monitor \
--agent supabase-schema-architect,supabase-realtime-optimizer \
--mcp supabase# Install a specific agent
npx claude-code-templates@latest --agent supabase-schema-architect
# Install a specific command
npx claude-code-templates@latest --command supabase-schema-sync
# Install the MCP server only
npx claude-code-templates@latest --mcp supabaseMCP Server Configuration
Supabase provides an official Remote MCP Server — the simplest way to connect.
{
"mcpServers": {
"supabase": {
"url": "https://mcp.supabase.com/mcp"
}
}
}# Add via CLI
claude mcp add --transport http supabase https://mcp.supabase.com/mcp
# Authenticate (opens browser login)
# Type /mcp in Claude Code and follow the login flow| Category | Tools |
|---|---|
| Database | list_tables, apply_migration, execute_sql |
| Edge Functions | list_edge_functions, deploy_edge_function |
| Development | get_project_url, get_publishable_keys, generate_typescript_types |
| Debugging | get_logs, get_advisors |
| Documentation | search_docs — search Supabase docs from Claude Code |
Tutorials & Videos
Watch and learn from demos
Mastering Claude Code in 30 Minutes
Official walkthrough of Claude Code's features and agentic workflows.
Claude Code Best Practices
Tips for effective prompting and workflow optimization.
Taking Claude to the Next Level
Advanced features, MCP integrations, and scaling.
Building Headless Automation
Automate workflows with Claude Code's headless mode and SDK.
Documentation & Links
Official docs and community resources
Official Documentation
Overview
What Claude Code is and platforms
Quickstart
Install and start in 5 minutes
How It Works
The agentic loop and tools
Best Practices
Prompting and optimization tips
Full Docs
Complete documentation
Community
FAQ
Frequently asked questions
/compact to save context tokens.cd into your project and run claude. It reads your codebase, respects .gitignore, and works within your existing git workflow. Add a CLAUDE.md for team standards.rm -rf without explicit approval.claude -c to continue the most recent session, or claude -r for an interactive picker. Name sessions with /rename my-task for easy resumption.