Inside a Claude Code session, prefixing any input with ! runs it as a shell command directly, bypassing Claude entirely. The command executes in your terminal, the output appears inline, and you continue the conversation. No tokens consumed, no permission prompt, no waiting for Claude to process the request.
How It Works
At the Claude Code prompt, type ! followed by any shell command:
!dbt run -s model_name!git status!gcloud auth login!ls models/base/The command runs immediately in your shell environment — same working directory, same environment variables, same authentication context as if you’d typed it in a regular terminal. The output prints directly, and you’re back at the Claude Code prompt.
Compare this to asking Claude to run the same command:
Run dbt run -s model_nameWhen you ask Claude, it uses the Bash tool. That means: Claude reads your prompt (input tokens), decides to run the command (reasoning tokens), requests permission (you approve), executes the command, reads the output (more tokens), and formulates a response about what happened (output tokens). The whole round-trip costs tokens and time.
With !dbt run -s model_name, the command just runs. No tokens, no permission, no Claude involvement.
When to Use the Bang Prefix
Authentication
This is the highest-value use case for analytics engineers working with GCP. Before asking Claude to do anything that requires cloud access — querying BigQuery, reading Cloud Storage, running bq commands — you need to be authenticated:
!gcloud auth login!gcloud auth application-default login!gcloud config set project my-analytics-projectRunning these with ! means the authentication happens in your shell, and Claude inherits the authenticated context for subsequent tool calls. If you ask Claude to run gcloud auth login instead, it triggers an interactive browser flow through Claude’s Bash tool, which can be awkward.
The same applies to other cloud providers:
!aws configure!az loginQuick Checks
Commands where you need the output but don’t need Claude to interpret it:
!dbt ls -s tag:daily # What models have the daily tag?!dbt ls -s +model_name # What are the upstream dependencies?!git log --oneline -5 # Recent commits!cat models/base/base__shopify__orders.sql # Quick file peek!wc -l models/**/*.sql # How many SQL files/lines?These are read-only checks where the output is self-explanatory. Routing them through Claude would waste tokens on interpretation you don’t need.
Git Operations
Branch management, staging, and commits where you know exactly what you want:
!git checkout -b feature/new-attribution-model!git add models/intermediate/!git commit -m "Add attribution intermediate models"!git push origin feature/new-attribution-modelClaude is excellent at constructing complex git operations when you’re unsure what to do. But for routine git workflow — creating a branch, committing work, pushing — the bang prefix keeps it fast.
Environment Inspection
Checking your environment without asking Claude to investigate:
!echo $ANTHROPIC_API_KEY # Which auth method am I using?!which dbt # Where's dbt installed?!dbt --version # What version?!python --version # Python version!cat dbt_project.yml # Quick config checkWhen NOT to Use It
The bang prefix makes sense for commands where you know what to run and don’t need help interpreting the result. Use Claude (without !) when:
- You need Claude to react to the output. “Run dbt build and fix any errors” requires Claude to see the error output and act on it.
!dbt buildshows you the errors but Claude doesn’t see them. - You’re not sure which command to run. “Check if there are any failing tests in the marts layer” lets Claude figure out the right command (
dbt test --select marts.*). The bang prefix requires you to know the command already. - You want Claude to chain multiple operations. Complex workflows where the next step depends on the previous result need Claude’s orchestration, not manual command execution.
Token Savings Over a Session
In a typical hour-long session, an analytics engineer might run 10-15 quick checks, git operations, and authentication commands. Each routed through Claude costs roughly 500-2,000 tokens (input + reasoning + output). Over 15 commands, that is 7,500-30,000 tokens saved.
On API billing, this is a few cents. On a subscription plan, it is quota headroom. Each ! command returns in milliseconds; each Claude-mediated command takes 5-15 seconds for the round-trip. Over a day of heavy Claude Code usage, the accumulated time savings are measurable.
Combining Bang Prefix with Claude’s Context
A useful pattern: run a command with ! to check something, then reference the result in your next Claude prompt.
!dbt ls -s +mrt__revenueYou see the dependency list. Then:
Refactor the column customer_id to customer__id across all modelsin the mrt__revenue lineage. The upstream models are:base__stripe__charges, int__orders__enriched, mrt__revenue.You used ! for the quick lookup and gave Claude the context it needs in the prompt. Faster than asking Claude to discover the lineage and then refactor.