curl -fsSL https://claude.ai/install.sh | bash brew install --cask claude-code # macOS irm https://claude.ai/install.ps1 | iex # Windows # first session cd your-project/ claude # start interactive session /init # generate CLAUDE.md from codebase # update claude update
/init scans your codebase and creates a starter memory file with tech stack, conventions, and architecture.claude # interactive REPL claude "explain this project" claude -p "fix lint" # print mode (one-shot) cat err.log | claude -p "summarize" claude -c # continue last conversation claude -r my-session # resume named session
claude auth login # sign in claude auth status # check status claude auth logout # sign out
Persistent project instructions loaded automatically at start of every session.
npm run dev, make test/etc/claude-code/CLAUDE.md # Managed policy (enterprise) ~/.claude/CLAUDE.md # User (all projects) ./CLAUDE.md # Project root (committed) ./.claude/CLAUDE.md # Alt project location ./src/module/CLAUDE.md # Nested (on-demand) ./.claude/rules/*.md # Path-scoped rules
~/.claude/projects/<hash>/memory/ MEMORY.md # Index (first 200 lines loaded) *.md # Individual memory files
--- name: memory-name description: "one-line summary" type: user|feedback|project|reference --- Content goes here.
✗ Code patterns / architecture (derive from code)
✗ Git history / who-changed-what (use git log)
✗ Debugging solutions (fix is in the code)
✗ Anything in CLAUDE.md already
✗ Ephemeral task details
Deterministic shell commands that run at lifecycle events. Defined in settings.json.
{
"hooks": {
"PreToolUse": [{
"matcher": "Edit|Write",
"hooks": [{
"type": "command",
"command": "my-script.sh"
}]
}]
}
}
Edit|Write → command npx prettier --write $TOOL_INPUT_FILE{
"permissions": {
"allow": [
"Bash(git *)",
"Bash(npm run *)",
"Edit(/src/**/*.ts)",
"WebFetch(domain:github.com)",
"mcp__github__*"
],
"deny": ["Bash(rm -rf *)"]
}
}
* matches any arguments. mcp__<server>__* allows all tools from an MCP server.Skills = custom slash commands. Claude auto-invokes via natural language match on description.
~/.claude/skills/my-skill/SKILL.md # user-level .claude/skills/my-skill/SKILL.md # project-level
--- name: my-skill description: "What it does" user-invocable: true allowed-tools: "Read,Grep,Bash(git *)" effort: high model: opus context: fork # run in subagent paths: "src/**/*.ts" # auto-load for files shell: bash # bash or powershell --- Instructions for the skill. Use $ARGUMENTS for user input.
## Live data - Branch: !`git branch --show-current` - Diff: !`git diff --stat` - Status: !`git status -s`
Backtick commands in SKILL.md run at load time and inject output into the prompt.
Connect external tools & services. Claude can call MCP tools like native tools.
# In settings.json or .claude/mcp.json { "mcpServers": { "github": { "type": "stdio", "command": "gh", "args": ["api-server"] }, "remote": { "type": "http", "url": "https://mcp.example.com" } } }
stdio (local process), http (remote), sse (streaming){
"model": "opus",
"effortLevel": "medium",
"permissions": {
"allow": ["Bash(git *)", "Edit"]
},
"hooks": { ... },
"mcpServers": { ... },
"env": { "DEBUG": "true" }
}
find)grep/rg)claude --model opus # at startup /model opus # during session Alt+P # keyboard shortcut
/effort low|medium|high|max # max = Opus 4.6 only, deepest reasoning
Both IDEs support diff viewer, diagnostics sharing, and inline suggestions.
cd project && claude # 1. Describe feature / intent # 2. Let Claude explore (Plan mode) # 3. Review & approve implementation /compact # if context fills up /clear # between unrelated tasks Esc Esc # rewind if wrong direction
claude -w feature-auth # isolated worktree 1 claude -w feature-ui # isolated worktree 2 /batch "add tests to *" # 5-30 parallel workers
claude -p "fix lint" --output-format json cat err.log | claude -p "summarize" claude -p "review" --max-turns 5
# use structure for complex requests Goal: exploit SSTI safely in local challenge Context: Flask/Jinja app in ./src Constraints: no external tools Files: @src/app.py Expected output: curl PoC + explanation
/clear between unrelated tasks@file to reference files/compact when context fills/clear & reprompt)-n for easy resume