Agentic Loop Enables Autonomous Development
Claude Code operates via an agentic loop: it receives natural language requests, analyzes your codebase, executes actions (read files, edit code, run commands), observes results, and iterates until complete or needs approval. This differs from chat-based AIs by handling complex tasks independently, like tracing bugs across files or refactoring class components to hooks. Interrupt with Esc; toggle modes—Normal (asks permission for writes/commands), Auto (approves routine ops), Plan (read-only analysis)—via Shift+Tab. Built-in tools auto-trigger for tasks, e.g., adding a button reads/editing Header.tsx then runs linters. Context window holds ~200k tokens (messages, files, outputs); manage with /clear for unrelated tasks or /compact to summarize and reclaim space. Performance drops as context fills, so reference files directly with @src/App.tsx to skip searches and save tokens.
For React, describe components plainly—"add loading spinner to UserList"—and it generates TypeScript-typed code with hooks/styling, shows diffs for approval (accept/reject/Esc), then verifies via npm test. Git ops like commits, branches, PRs work via language: "commit changes descriptively" or "resolve merge conflicts." Install gh CLI for rate-limit-free GitHub integration.
CLAUDE.md and Memory Lock in Project Conventions
Place CLAUDE.md at project root (./CLAUDE.md, git-shared), home (~/.claude/CLAUDE.md, personal), or subdirs for scoped rules—loaded every session as persistent onboarding. Run /init to auto-generate from codebase: lists npm run dev/test/lint/build, infers styles (functional components, TypeScript strict, 2-space indent, Zustand stores). Example for React dashboard specifies architecture (components/, hooks/, services/), testing (RTL not Enzyme). Keep <200 lines; only add what code doesn't reveal. Auto Memory (default, ~/.claude/projects/
For scale, use .claude/rules/ for file-type rules, e.g., enforce hooks in React files.
Setup, Pricing, and Efficiency Hacks
Requires Node 18+, Git, Claude Pro/Max ($20/$100/$200/mo for Sonnet/Opus access; API pay-as-you-go). Install natively: macOS/Linux curl -fsSL https://claude.ai/install.sh | bash; Windows PowerShell irm https://claude.ai/install.ps1 | iex or CMD curl variant. Homebrew/WinGet alternatives lack auto-updates. Login once (/login) stores securely; supports Pro/Console/third-party (Bedrock/Vertex). Start: cd project; claude (interactive), claude -p "task" (one-shot), --continue/--resume.
Essential cmds: /help, ?, what does this project do?, explain @src/Header.tsx, trace login flow. Efficiency: Specific prompts ("fix blank screen after wrong creds in LoginForm.tsx" not "fix login bug") minimize file reads/tokens. Always add verification ("...and run npm test"). Break complex tasks stepwise: 1) structure, 2) types, 3) states, 4) tests. Clear context between tasks for sharp output. File @ refs save massive tokens vs. vague searches.