CLAUDE CODE MASTERY
Claude Code Expert Guide
Hooks, permissions, CLAUDE.md patterns, CLI workflows, and CI/CD integration — master Anthropic's agentic coding tool.
CLAUDE CODE SETUP
Install and configure Claude Code — Anthropic's agentic coding CLI — in under 5 minutes.
1
Install Claude Code
npm install -g @anthropic-ai/claude-codeRequires Node.js 18+. Claude Code runs as a CLI agent in your terminal.
2
Authenticate
claude
# Follow the OAuth flow in your browser
# Or set ANTHROPIC_API_KEY in your shellAPI key auth skips the browser flow — ideal for CI/CD and headless environments.
3
Create CLAUDE.md
cat > CLAUDE.md << 'EOF'
# Project Context
- Stack: React + TypeScript + Tailwind CSS
- Always use semantic tokens from design system
- Run `npm test` before committing
- Follow existing patterns in src/components/
EOFCLAUDE.md is the primary way to give Claude persistent project context. It reads this on every session.
4
Configure Permissions
cat > .claude/settings.json << 'EOF'
{
"permissions": {
"allow": [
"Read",
"Write",
"Bash(npm test)",
"Bash(npm run lint)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(git push --force)"
]
}
}
EOFPermissions control what Claude can do autonomously vs. what requires approval.
5
Run Your First Task
claude "Review src/App.tsx and suggest improvements"
# Or interactive mode:
claudeOne-shot mode for quick tasks; interactive mode for multi-turn conversations with your codebase.