CloudCodeTree LogoCloudCodeTree
AI NewsTutorialsAbout
CloudCodeTree Logo
CloudCodeTree
  • AI News
  • Tutorials
  • About
← Back to AI News
Run a Command, Get an Instant Analysis: Claude Code's ! Shell Mode Does More Than You Think

Run a Command, Get an Instant Analysis: Claude Code's ! Shell Mode Does More Than You Think

Chris Harper

2 min read

Jul 14, 2026 · 04:17 UTC

AI
Workflow
Claude Code
Best Practices

Prefix any shell command with ! in a Claude Code session and Claude automatically analyzes the output — failing tests, build errors, lint results — without a follow-up prompt.

Most Claude Code users know the ! prefix runs a shell command. Fewer know that since v2.1.186, Claude automatically responds to the output without you asking.

Before:

> ! npm test
[Claude runs the command, output lands in context]
> "The test output above has 3 failures — what's wrong?"

After:

> ! npm test
[Claude runs the command, output lands in context]
[Claude automatically]: The three failures are all in the auth module. TokenExpiredError
is thrown at line 47 of src/auth/jwt.ts — the test mock isn't advancing the fake clock
past token expiry. Fix: call jest.advanceTimersByTime(3601000) before asserting.

One turn, one token cost, no copy-paste required.

Where this changes your workflow

  • ! cargo build → immediate analysis of Rust compile errors, with suggested fixes
  • ! pnpm lint → summary of which lint rules are failing and why
  • ! git diff HEAD~1 → explanation of what changed and what to review before pushing
  • ! curl -s http://localhost:3000/api/health | jq → analysis of the API response structure

Claude treats the command output as context it should understand, not just text to accumulate. It reads the full output — including stack traces — and gives you actionable analysis.

Turning it off

If you prefer ! to only inject output into context without triggering a response:

{
  "respondToBashCommands": false
}

Add this to .claude/settings.json. With the setting off, ! commands still land in the transcript (so later prompts can reference them) but Claude doesn't auto-respond — useful when building a context window before asking a single synthesizing question.

Inside /goal loops

The auto-response works inside /goal loops too. When Claude runs ! npm test during a loop turn, it sees the failure output and patches based on it — making the loop dramatically more self-correcting:

> /goal all tests pass
[Claude runs ! npm test each turn, reads failures, patches, re-tests automatically]

This is the difference between a loop that hits an error and stops, and one that reads the error and keeps going.

Sources: Shell mode with the ! prefix — Claude Code Docs · Week 26 digest — Claude Code Docs