trax/.claude/SHORTCUTS.md

189 lines
4.2 KiB
Markdown

# Claude Code Power Shortcuts & Commands
## Essential Shortcuts
### Mode Switching
- **Shift+Tab** → Enter plan mode (planning only, no implementation)
- **Shift+Tab (twice)** → Deep plan mode with web research
- **!** → Bash mode (run commands inline without leaving Claude)
- **#** → Memory mode (save context to .claude.md)
### Navigation & Control
- **/resume** → Jump to past conversation and continue
- **/export** → Copy entire conversation (paste into Cursor/Windsurf)
- **/clear** → Clear context between tasks
- **Double ESC** → Revert to past conversation point
- **/init** → Initialize project understanding
### Custom Commands (Slash Commands)
- **/tdd-cycle** → Execute complete TDD workflow
- **/progress** → Show development status
- **/quick-test** → Fast validation of changes
- **/research** → Trigger research agents
- **/parallel-setup** → Set up Git worktrees
## Bash Mode Examples
Use `!` prefix for inline commands:
```
!npm install package-name
!git status
!uv run pytest
!echo "Quick check" > test.txt
```
Benefits:
- Commands run directly without context switch
- Output becomes part of conversation history
- Claude understands what you've done
## Memory Mode Examples
Use `#` prefix to save context:
```
#remember This project uses distil-large-v3 for Whisper
#remember Database uses JSONB for flexible storage
#remember Target: 5-min audio in <30 seconds
```
Then choose storage level:
- Project (saved to .claude.md)
- User (global across projects)
## Advanced Commands
### Task Management
```
task-master next # Get next task
task-master show 42 # Show task details
task-master set-status --id=42 --status=done
```
### Quality Checks
```
!uv run pytest --cov=src # Test coverage
!uv run mypy src/ # Type checking
!uv run black --check src/ # Format check
!./scripts/validate_loc.sh # File size check
```
### Git Operations
```
!git diff --cached # See staged changes
!git log --oneline -10 # Recent commits
!gh pr create --title "Feature X" # Create PR
```
## Permissions & Auto-Approval
### Skip specific permissions:
```
# Always auto-approve these:
- cd commands
- ls commands
- read operations
```
### Dangerous mode (not recommended):
```
--dangerously-skip-permissions
```
## Token Optimization Shortcuts
### When context is getting full:
1. **/export** → Save conversation
2. **/clear** → Clear context
3. Start new session and paste if needed
### For large file operations:
- Use Task tool (automatic sub-agent)
- Prompt: "Use task tool to search for X across all files"
## Workflow Shortcuts
### Quick TDD Cycle:
```
1. /tdd-cycle
2. Follow prompts
3. Tests → Code → Validate
```
### Quick Research:
```
1. /research whisper
2. Sub-agent creates report
3. Read .claude/research/whisper-optimization.md
```
### Quick Progress Check:
```
1. /progress
2. See coverage, file sizes, task status
```
## Session Management
### Save session state:
```
#remember Current working on: [feature]
Update .claude/context/session.md
```
### Resume work:
```
/resume
Select previous conversation
Continue from checkpoint
```
### Export for team:
```
/export
Share markdown with team
Anyone can paste into their Claude
```
## Performance Tips
### Prevent token bloat:
- Use Task tool for >3 file reads
- Clear context between major features
- Export conversations before 80% full
### Speed up responses:
- Use bash mode for quick commands
- Pre-load context with #remember
- Keep plans in .claude/tasks/
### Parallel work:
- Set up worktrees with /parallel-setup
- Run multiple Claude sessions
- Share context via .claude/context/
## Troubleshooting
### If Claude gets confused:
```
Double ESC → Revert to earlier point
/clear → Fresh start
Read .claude/context/session.md → Restore context
```
### If tests fail:
```
!uv run pytest -xvs → Detailed failure info
Check .claude/hooks/type-check.py output
```
### If performance degrades:
```
Check token usage
Use Task tool more
/export and start fresh
```
---
*Pro tip: Master `!` for bash mode and `#` for memory mode - they're the most powerful shortcuts!*