Claude Code Can Run Commands Before Loading a Skill
SKILL.md now supports inline command execution, letting Claude Code inject command output into a skill before the model sees it.
Claude Code can now run commands before a skill is loaded.
In SKILL.md, you can use the ! + command-in-backticks syntax, for example !`gh pr diff` . Claude Code first executes the command, inserts its output into the skill text, and only then passes the result to the model.
This lets you preload relevant context without extra tool calls. For example, when working with a pull request, the model immediately receives its diff instead of spending a separate turn asking for changes.
There is another detail. When context: fork is used, a separate subagent is created with the skill as its prompt. It runs in the background and cannot see the main conversation history, so the skill itself must contain all required context.
If the command fails, skill loading is interrupted. For commands that may fail, it is recommended to append || true.
Why it matters
AnalysisIt reduces unnecessary tool calls and makes skill context more deterministic for AI coding workflows.
Discuss in community
Share your questions and insights with developers
Related in Ecosystem
Practical guides, core terminology, and agent skills
Claude Code Projects: How a Single AI Orchestrates a Team of Autonomous Agents
A deep dive into Claude Code Projects: Coordinator and Threads architecture, parallel branches, shared memory via MEMORY.md, and cloud agent management.
Claude Code adds harness-audit command for AI agent infrastructure checks
The new Claude Code command audits AI agent settings, flags legacy code and suggests diffs without running or modifying project code.
Cursor: grab the name while it’s hot
Cursor is a prominent AI coding tool whose name is becoming strongly associated with AI-assisted programming.
MCP Servers and Claude Code: A Practical Guide to Connecting and Building
How to expand Claude Code's capabilities with Model Context Protocol: connecting the filesystem, GitHub, PostgreSQL, Brave Search, and developing a custom server in TypeScript.