New users are limited to 2 links — here’s the post with only the Claude Code docs and Theo’s tweet kept:
Dynamic context injection in Agent Skills (!command` syntax)
Feature request for product/service
Cursor IDE
Describe the request
Add dynamic context injection to Agent Skills (SKILL.md) — the same pattern Claude Code already ships as part of the Agent Skills standard extension.
Syntax: !command`` in the skill body. When a skill is invoked, Cursor runs the shell command locally before sending the skill to the model, and replaces the placeholder with stdout. The model gets live data + instructions in one turn, with no shell tool round-trip.
Example:
---
name: summarize-changes
description: Summarize uncommitted changes and flag risks
---
## Current changes
!`git diff HEAD`
## Instructions
Summarize the changes above in 2–3 bullets and list risks.
If the diff is empty, say there are no uncommitted changes.
Why this matters
Today, skills that need live state (git diff, gh pr diff, test output) tell the agent to run shell tools at runtime. That is slower, costs extra tokens, and is non-deterministic — the agent may skip the step, run the wrong command, or guess from open files instead of actual output.
With injection, repeatable workflows (PR review, commit summaries, pre-merge checks) become self-bootstrapping: the skill gathers facts before the model reasons.
Use cases
- Branch/PR review:
!git diff master…HEAD, `!`gh pr diff - Commit helper:
!git diff --staged`` - Pre-ship: test output (truncated)
Suggested safeguards
- Respect
beforeShellExecutionhooks - Opt-in per skill and/or org setting to disable (
disableSkillShellExecution, Claude Code parity) - Cap/truncate large output
Prior art
- Claude Code docs: Extend Claude with skills - Claude Code Docs
- Theo (@theo / t3.gg) on standardizing this across coding agents: Theo - t3.gg on X: "The "inject dynamic context" pattern in Claude Code skills is so useful. IMO, this should be part of the "skills standard" and included in tools like Codex CLI, Pi, Cursor etc https://t.co/qaGKqxTvKz" / X
Related (no link — new-user limit): forum search found no duplicate request; closest existing ask is preprocessor conditionals + replacement variables in rules/skills (static ${fileDir} / OS conditionals, not shell output injection).