brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: a skill can run shell commands before Claude reads it

Claude
~/tips/tip-claude-skill-shell-injection

---

Runs a shell command before a skill loads, so Claude gets fresh data in its prompt.

Telling Claude to "first run gh pr diff" costs a turn. A skill can do it before the turn even starts.

In a SKILL.md file, write ! followed by a command in backticks. Claude Code runs it first and replaces the placeholder with the output, so Claude receives real data and never sees the command. This is the example from the docs:

---
name: pr-summary
description: Summarize changes in a pull request
context: fork
agent: Explore
allowed-tools: Bash(gh *)
---

## Pull request context
- PR diff: !`gh pr diff`
- PR comments: !`gh pr view --comments`

## Your task
Summarize this pull request.

Save it as .claude/skills/pr-summary/SKILL.md and call it with /pr-summary. context: fork runs it in a forked subagent, and allowed-tools lets that run use gh without asking.

I like that the data is fetched deterministically. The model does not have to remember to run the command.

A skill like this is a small recipe: gather the facts with commands, then give Claude a task that is already grounded in them. For anything that starts with "look at the current state of X", that is a better start than a free-form request.

The caveat: the inline form only works when the ! starts a line or follows whitespace. For a multi-line command, use a fenced block opened with three backticks and a !.

Further reading: Extend Claude with skills – Claude Code docs, On this site: .claude/settings.local.json overrides the team file just for you, On this site: .mcp.json can read ${VAR} so the team file holds no secrets

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link