Claude Clue #26: Running Commands in Your Prompt
If you've spent any time in Claude Code, you've watched it run its own commands all day: reading files, checking git, running tests.
If you've spent any time in Claude Code, you've watched it run its own commands all day: reading files, checking git, running tests. But every so often, you want Claude working from the output of a command you ran, not one it decided to run. Claude Code has a feature for exactly that, called dynamic context injection, and it lives inside custom commands and skills. The idea is simple. When you kick off one of your own commands, Claude Code runs the shell pieces first and feeds their output into the prompt, so Claude reads the result instead of the command. I went hunting for this after updating some environment variables and wanting Claude to act on the new values, without handing it the keys to my whole shell.
The syntax is small enough that you can forget you're doing anything clever. You tuck a command into backticks behind an exclamation point, like !\git status --short, and that line gets swapped for the actual status instead of Claude reading the command you typed. Got a few commands to run? Open a fenced block with ```! and stack them up, close them out with ``` and go! Claude never sees the command itself, only the freshly rendered output (which is the part that feels a little like magic, but is actually just regular old programming).
This is preprocessing, not something Claude executes, so Claude only ever sees the final result.
Roscoe drafted, Claude refined it. It still has no idea which commands I ran to feed it.