Launch Claude Code with a Prompt Using -p to Start Working Immediately
Starting a Claude Code session and then typing your first prompt is two steps when it could be one. The -p flag sends your prompt as Claude launches, so it starts working immediately.
claude -p "Run the tests and fix any failures"
Claude opens an interactive session and begins executing your prompt right away. Unlike --print which gives you a one-shot response and exits, -p drops you into a full session where you can follow up.
This is perfect for scripting your morning workflow:
# Start the day with a status check
claude -p "Show me what changed since yesterday — git log, any failing tests, any new TODOs"
# Jump straight into a task
claude -p "Continue the auth refactor from .claude/progress.md"
# Start a focused session
claude -p "I'm working on the payment integration today. Read src/billing/ and summarise the current state."
Combine with other flags for targeted sessions:
# Quick task with a specific model
claude --model haiku -p "What port does this app listen on?"
# Focused session with extra directories
claude --add-dir ../shared-lib -p "How does our app use the shared library's auth module?"
# Start in plan mode
claude -p "Plan how to add multi-tenancy to this app. Don't write code yet."
You can also use this in shell aliases for common starting points:
# In ~/.zshrc
alias cc-tests='claude -p "Run all tests and fix any failures. Keep going until green."'
alias cc-review='claude -p "Review my uncommitted changes and flag any issues."'
alias cc-standup='claude -p "Summarise what changed in this repo in the last 24 hours."'
Now cc-tests opens Claude and immediately starts running your test suite.
The fastest session is the one that starts working before you finish opening it — pass your prompt on the command line and skip the typing.
via Claude Code
Log in to leave a comment.
When typing feels slow — describing a complex bug, explaining architecture, or thinking through a problem out loud — press Option+V to switch to voice input. Speak naturally and Claude Code transcribes your words into a prompt, so you can describe what you need at the speed of thought.
When Claude is heading down the wrong path — editing the wrong file, writing code you don't want, or giving a long explanation you don't need — press Escape to stop it immediately. You keep everything it did up to that point and can redirect with a new prompt.
Closed a session and realized you weren't done? Pass --continue (or -c) when launching Claude Code to pick up exactly where you left off — same context, same files, same conversation history — without re-explaining what you were working on.