SOP 006: Dynamic Context Injection
Fresh| Field | Value |
|---|---|
| SOP ID | 006 |
| Version | 1.0 |
| Status | Active |
| Last Updated | 2026-02-14 |
Purpose
Use the !command`` syntax to run shell commands before skill content is sent to Claude, injecting live data into the prompt.
How It Works
Important
This is preprocessing, not something Claude executes. Claude only sees the final result with command output already inserted.
Procedure
Step 1: Add Shell Commands to Skill Content
Use the !command`` syntax anywhere in your SKILL.md:
yaml
---
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`
- Changed files: !`gh pr diff --name-only`
## Your task
Summarize this pull request...Step 2: Understand the Execution Order
- Each
!command`` executes immediately (before Claude sees anything) - The output replaces the placeholder in the skill content
- Claude receives the fully-rendered prompt with actual data
Step 3: Combine with Arguments
yaml
---
name: review-file
description: Review a specific file with git context
---
## File to review
!`cat $ARGUMENTS`
## Recent changes
!`git log --oneline -5 -- $ARGUMENTS`
## Your task
Review this file for issues...Step 4: Enable Extended Thinking
Include the word "ultrathink" anywhere in your skill content to enable extended thinking mode:
yaml
---
name: deep-analysis
description: Perform deep code analysis with extended thinking
---
ultrathink
Analyze the following codebase thoroughly...Verification Checklist
- [ ] Shell commands use correct
!command`` syntax - [ ] Commands work standalone in terminal before adding to skill
- [ ] Combined with
context: forkif skill runs in isolation - [ ]
allowed-toolsincludes required Bash patterns - [ ] Tested that output renders correctly in Claude's context