Always use claude!
| Command | Description |
|---|---|
claude |
Start fresh session |
claude -c |
Continue last session |
claude --resume |
Pick from recent sessions |
claude -p "prompt" |
Headless mode (for scripts/CI) |
claude --add-dir ../path |
Add directories to context |
claude --model sonnet |
Use faster/cheaper model |
alias cc="claude -c"
alias cr="claude --resume"
alias cs="claude --model sonnet"| Command | Description |
|---|---|
/help |
Show all commands |
/compact |
Compress context (keeps working, saves tokens) |
/clear |
Clear conversation entirely |
/cost |
Show token usage |
Esc |
Cancel current operation |
Ctrl+C |
Interrupt / exit |
~/.claude/
├── CLAUDE.md # Your global preferences
├── settings.json # Permissions, MCP servers
└── .env # Credentials (NEVER commit)
<project>/
└── .claude/
├── CLAUDE.md # Project-specific instructions
└── settings.json # Project settings
Project CLAUDE.md > User CLAUDE.md > Defaults
| Model | Best For | Flag |
|---|---|---|
| Opus | Complex reasoning, large refactors | (default) |
| Sonnet | Quick tasks, simple edits, cost savings | --model sonnet |
Pre/post execution scripts. Add to ~/.claude/settings.json:
{
"hooks": {
"post-tool-use": {
"edit": "npm run lint --fix"
}
}
}Create ~/.claude/skills/<skill-name>.md:
---
name: commit
description: Create a conventional commit
---
Create a git commit following Conventional Commits format.
Include a descriptive message based on staged changes.Usage: /commit in session
Add to ~/.claude/settings.json:
{
"mcpServers": {
"atlassian": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-atlassian"]
},
"slack": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-slack"]
}
}
}# Vague (avoid)
"Fix the bug"
# Specific (better)
"Investigate why login fails when email contains '+' character"
# Good pattern
"In the UserService class, add a method to validate email
addresses. Follow the existing validation pattern used
for phone numbers."
1. "Run the tests"
2. "Fix the failing test in auth.test.ts"
3. "Run tests again to verify"
- Context getting long but still relevant
- Want to continue same task with less token usage
- Switching to unrelated task
- Claude seems confused or stuck
- Accumulated context is polluting responses
- Referencing old/deleted code
- Repeating previous mistakes
- Slower responses
- Inconsistent behavior
For complex tasks, use plan mode:
"Enter plan mode and save the plan to PLAN.md"
Claude will:
- Explore the codebase
- Write a plan to the file
- Wait for your approval
- Execute after approval
Claude can spawn background agents:
- Explore agent - Codebase research
- Plan agent - Architecture design
These run concurrently while you continue working.
Great for one-off tasks:
"Write a Python script that scrapes attendee names
from this conference page: [URL]"
"Summarize the last 50 messages in #alerts Slack channel"
"Parse this CSV and generate SQL insert statements"
Powerful pattern for fixing issues:
1. "Run the test suite"
2. Claude sees failures
3. "Fix the failing tests"
4. Claude makes changes
5. "Run tests again"
6. Repeat until green
"Review the changes in this PR: [URL]"
"What are the potential issues with the code
in src/auth/login.ts?"
"Review my staged changes before I commit"
- Use
sonnetfor simple tasks /compactto reduce context size- Start fresh sessions for new topics
- Be specific to avoid back-and-forth
- Use
/costto monitor usage
| Key | Action |
|---|---|
Esc |
Cancel current operation |
Ctrl+C |
Interrupt |
Up Arrow |
Previous command |
Tab |
Autocomplete |
- Community Tips: https://github.com/ykdojo/claude-code-tips
- Official Docs: Run
/helpor visit anthropic.com - Report Issues: https://github.com/anthropics/claude-code/issues
Generated for Claude Code Power User Tutorial