Speed & Efficiency Intermediate

Work faster with Claude Code using keyboard shortcuts, one-shot mode, batch operations, parallel agents, and optimized terminal workflows. These techniques can multiply your productivity by 2-5x.

Keyboard Shortcuts Reference

Shortcut Action When to Use
Escape Cancel current operation When Claude is heading in the wrong direction
Tab Accept suggestion / autocomplete When Claude suggests a file path or command
Ctrl+C Interrupt Claude's response When you've seen enough and want to redirect
Up Arrow Recall previous prompt To reuse or modify a previous prompt
Shift+Tab Reject suggestion When Claude's suggestion isn't what you want

One-Shot Mode for Quick Tasks

For well-defined tasks, -p mode is dramatically faster than starting an interactive session:

Terminal
# Quick commit message
$ git diff --staged | claude -p "Write a commit message for these changes"

# Quick explanation
$ claude -p "Explain what src/middleware/rateLimit.ts does in 2 sentences"

# Quick fix
$ claude -p "Fix the typo in src/config.ts line 23"

# Shell alias for even faster access
alias cq='claude -p'  # "Claude Quick"
$ cq "Add a .gitignore entry for .env.local"

Batch Operations with Shell Scripts

Bash
#!/bin/bash
# add-types.sh - Add TypeScript types to all JS files
for file in src/**/*.js; do
    echo "Converting: $file"
    claude -p "Convert $file from JavaScript to TypeScript. Add proper types. Rename to .ts"
done

# lint-fix.sh - Auto-fix all lint errors
for file in $(npx eslint src/ --format json | jq -r '.[].filePath'); do
    claude -p "Fix the ESLint errors in $file without changing functionality"
done

Running Agents in Background

Don't wait for Claude to finish — run tasks in the background while you continue working:

Terminal
# Run Claude in background, save output
$ claude -p "Generate comprehensive tests for src/services/" > test-output.txt 2>&1 &

# Continue working while Claude runs
$ vim src/routes/new-feature.ts

# Check when it's done
$ jobs
$ cat test-output.txt

Parallel Agents for Independent Tasks

When you have multiple independent tasks, run them in parallel using separate terminal sessions or git worktrees:

Terminal
# Terminal 1: Agent working on frontend
$ claude -p "Implement the dashboard UI in src/components/Dashboard.tsx"

# Terminal 2: Agent working on backend (separate worktree)
$ git worktree add ../project-backend feature/api
$ cd ../project-backend
$ claude -p "Implement the dashboard API endpoints in src/routes/dashboard.ts"

# Terminal 3: Agent writing tests (another worktree)
$ git worktree add ../project-tests feature/tests
$ cd ../project-tests
$ claude -p "Write integration tests for the user authentication flow"
Git Worktrees: Worktrees let you have multiple checkouts of the same repository. Each parallel agent works on its own copy, avoiding file conflicts. Learn more in the Parallel Agents course.

Using /compact and /clear Wisely

Terminal
# /compact - Summarize conversation, keep context, free up space
# Use when: context is getting large but you're still on the same task
> /compact

# /clear - Start fresh within the same session
# Use when: switching to a completely different task
> /clear

# Pro tip: /compact with focus
> /compact Summarize only the database migration decisions we made

Vim + tmux + Claude Workflow

For terminal-native developers, this is the ultimate productivity setup:

Terminal Layout
# tmux layout: 3 panes
# +-----------------------+----------+
# |                       |          |
# |    Vim (editing)      |  Claude  |
# |                       |  Code    |
# |                       |          |
# +-----------------------+----------+
# |     Shell (tests/git)            |
# +----------------------------------+

# Create this layout:
$ tmux new -s dev
# Ctrl+B, % (vertical split)
# Ctrl+B, " (horizontal split in left pane)

# Left top: vim
# Right: claude
# Left bottom: shell for git, tests, etc.

Speed Tips Quick Reference

Technique Time Saved Best For
claude -p for quick tasks 30-60 seconds per task Simple fixes, generation, explanations
Shell aliases (cq) 5-10 seconds per command Frequent one-shot usage
Parallel agents 2-5x on independent tasks Multi-feature development
Background execution Wait time eliminated Long-running generation tasks
Specific file paths in prompts 10-30 seconds per prompt Every interaction
/compact before hitting limits Prevents session restart Long refactoring sessions

Try It Yourself

Set up a shell alias for claude -p and try using it for 5 quick tasks today. Notice how much faster it is than opening an interactive session. Next: advanced workflow strategies.

Next: Advanced Workflows →